- Switching between processes is termed as context switch. When the CPU switches to another process, the system must save the state of the old process and load the saved state for the new process;
- process table keeps track of processes,
- context information stored in PCB,
- process suspended: register contents etc stored in PCB,
- process resumed: PCB contents loaded into registers
- Context-switch time is overhead; the system does no useful work while switching.
- Context switching can be critical to performance,
- Dealing with multiple processes is difficult;
- Synchronization ensure a process waiting for an I/O device receives the signal, signals may be lost or duplicated.
- Failed mutual exclusion attempt to use a shared resource at the same time.
- Non-deterministic program operation; program should only depend on input to it, not relying on common memory areas.
- Deadlocks.
Figure 2.4:
CPU Switch From Process to Process
|
- OS requirements for multiprogramming;
- Policy to determine which process to schedule (Scheduler).
- Mechanism to switch between processes (Low-level code that implements the decision Dispatcher).
- Methods to protect processes from one another (memory system).
2004-05-25