ADDITION OF MEDIUM TERM SCHEDULING swap in partially executed swap out swapped-out processes ready queue CPU end VO waiting queues
ADDITION OF MEDIUM TERM SCHEDULING
SCHEDULERS (CONT.) Short-term scheduler is invoked very frequently (milliseconds)=(must be fast) o Long-term scheduler is invoked very infrequently (seconds,minutes)(may be slow) o The long-term scheduler controls the degree of multiprogramming o Processes can be described as either: 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
SCHEDULERS (CONT.) Short-term scheduler is invoked very frequently (milliseconds) (must be fast) Long-term scheduler is invoked very infrequently (seconds, minutes) (may be slow) The long-term scheduler controls the degree of multiprogramming Processes can be described as either: 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
CONTEXT SWITCH o When CPU switches to another process,the system must save the state of the old process and load the saved state for the new process o Context-switch time is overhead;the system does no useful work while switching o Time dependent on hardware support
CONTEXT SWITCH When CPU switches to another process, the system must save the state of the old process and load the saved state for the new process Context-switch time is overhead; the system does no useful work while switching Time dependent on hardware support
WHAT DOES IT TAKE TO CREATE A PROCESS? o Must construct new PCB ·Inexpensive o Must set up new page tables for address space ·More expensive o Copy data from parent process?(Unix fork () Semantics of Unix fork (are that the child process gets a complete copy of the parent memory and I/O state Originally very expensive ·Much less expensive with“copy on write” o Copy I/O state (file handles,etc) 。edium expense
WHAT DOES IT TAKE TO CREATE A PROCESS? Must construct new PCB Inexpensive Must set up new page tables for address space More expensive Copy data from parent process? (Unix fork() ) Semantics of Unix fork() are that the child process gets a complete copy of the parent memory and I/O state Originally very expensive Much less expensive with “copy on write” Copy I/O state (file handles, etc) Medium expense
A TREE OF PROCESSES ON A TYPICAL SOLARIS Sched pid=0 init pageout fsflush pid =1 pid=2 pid=3 inetd dtlogin pid =140 pid 251 telnetdaemon Xsession pid=7776 pid=294 Csh sdt shel pid=7778 pid 340 Csh pid=1400 Netscape emacs pid=7785 pid=8105 Is cat pid=2123 pid=2536
A TREE OF PROCESSES ON A TYPICAL SOLARIS