queue header PCB7 PCB2 ready head queue tail registers registers mag head tape unit 0 tail mag head tape tail PCB3 PCB14 PCBs unit 1 disk head unit 0 tail PCBs terminal head unit 0 tail
ready queue CPU 1/O I/O queue I/O request time slice expired child fork a executes child interrupt wait for an occurs interrupt Figure 3.6-Queueing-diagram representation of process scheduling
Figure 3.6 - Queueing-diagram representation of process scheduling
Schedulers Short-term scheduler (or CPU scheduler)-selects which process should be executed next and allocates CPU Sometimes the only scheduler in a system Short-term scheduler is invoked frequently(milliseconds)(must be fast) Long-term scheduler (or job scheduler)-selects which processes should be brought into the ready queue(in a batch system,selects processes spooled in a mass-storage device and loads them into memory) Long-term scheduler is invoked infrequently(seconds,minutes)(may be slow) The long-term scheduler controls the degree of multiprogramming time-sharing systems such as UNIX and Microsoft Windows systems often have no long-term scheduler
- Schedulers • Short-term scheduler (or CPU scheduler) – selects which process should be executed next and allocates CPU • Sometimes the only scheduler in a system • Short-term scheduler is invoked frequently (milliseconds)(must be fast) • Long-term scheduler (or job scheduler) – selects which processes should be brought into the ready queue (in a batch system, selects processes spooled in a mass-storage device and loads them into memory) • Long-term scheduler is invoked infrequently (seconds, minutes) (may be slow) • The long-term scheduler controls the degree of multiprogramming • time-sharing systems such as UNIX and Microsoft Windows systems often have no long-term scheduler
Some systems also employ a medium-term scheduler remove process from memory,store on disk,bring back in from disk to continue execution:swapping An efficient scheduling system will select a good process mix of CPU- bound processes and I/O bound processes. I/O-bound process-spends more time doing I/O than computations,many short CPU bursts CPU-bound process-spends more time doing computations;few very long CPU bursts
• Some systems also employ a medium-term scheduler . • remove process from memory, store on disk, bring back in from disk to continue execution: swapping • An efficient scheduling system will select a good process mix of CPUbound processes and I/O bound processes. • I/O-bound process – spends more time doing I/O than computations, many short CPU bursts • CPU-bound process – spends more time doing computations; few very long CPU bursts
swap in partially executed swap out swapped-out processes ready queue PU end 1/o 1/O waiting queues Figure 3.7-Addition of a medium-term scheduling to the queueing diagram
Figure 3.7 - Addition of a medium-term scheduling to the queueing diagram