What does a Mordern OS do?
Provide Standard Interface
Mediates Resource Usage
Process is an execution stream in the context of a particular process state.
Thread is an execution stream in the context of a thread state.
The key difference: Multiple threads share parts of their state.
Allowing read write the same memory, but each thread still have own registers.
- The threads must corrdinate their activities very closely.
- It is much easier to coordinate activities.
- Open file tables
- Singal management information
Multiple processes at a time.
Allow system to separate out activites cleanly.
Because multiprogamming, there needs to share the resource, such as CPU.
Therefore, OS needs the ability to switch from one process to another.
That is Context Switch
The way to implement the Context Switch is to save and restore the hardware state in PCB (Process Control Block).
Porcessor Status Word
Some machine needs the Memory Management Unit(MMU)
But the older PC switch all the process’s memory out to disk
OS is fundamentally event-driven.
That is to wait for an event to happen, response appropriately to the event, then wait for the next event
It is tipically register.
Don’t need to do anything to the MMU when switch threads.
That is the OS will have a separate thread for each process.
And perform the OS activities on behalf of the process.
Allow the programmer to program the actions associate with that activity as a single serial stream of actions and events
Programmer does not have to deal with the complexity of interleaving multiple activities on the same thread