18 Silberschatz Galvin and Gagne 2013 Operating System Concepts 9 th Edition

18 silberschatz galvin and gagne 2013 operating

This preview shows page 18 - 26 out of 69 pages.

Silberschatz, Galvin and Gagne ©2013Operating System Concepts – 9thEditionExample of Shortest-remaining-time-firstNow we add the concepts of varying arrival times and preemption to the analysisProcessAarri Arrival TimeTBurst TimeP108P2 14P329P435Preemptive SJF Gantt ChartAverage waiting time = [(10-1)+(1-1)+(17-2)+5-3)]/4 = 26/4 = 6.5 msecP40126P1P210P3P1517
Background image
6.19Silberschatz, Galvin and Gagne ©2013Operating System Concepts – 9thEditionPriority SchedulingA priority number (integer) is associated with each processThe CPU is allocated to the process with the highest priority (smallest integer highest priority)PreemptiveNonpreemptiveSJF is priority scheduling where priority is the inverse of predicted next CPU burst timeProblem Starvation – low priority processes may never executeSolution Aging – as time progresses increase the priority of the process
Background image
6.20Silberschatz, Galvin and Gagne ©2013Operating System Concepts – 9thEditionExample of Priority SchedulingProcessAarri Burst TimeTPriorityP1103P2 11P324P415P552Priority scheduling Gantt ChartAverage waiting time = 8.2 msec
Background image
6.21Silberschatz, Galvin and Gagne ©2013Operating System Concepts – 9thEditionRound Robin (RR)Each process gets a small unit of CPU time (time quantum q), usually 10-100 milliseconds. After this time has elapsed, the process is preempted and added to the end of the ready queue.If there are nprocesses in the ready queue and the time quantum is q, then each process gets 1/nof the CPU time in chunks of at most qtime units at once. No process waits more than (n-1)q time units.Timer interrupts every quantum to schedule next processPerformanceqlarge FIFOq small q must be large with respect to context switch, otherwise overhead is too high
Background image
6.22Silberschatz, Galvin and Gagne ©2013Operating System Concepts – 9thEditionExample of RR with Time Quantum = 4ProcessBurst TimeP124P23P33The Gantt chart is: Typically, higher average turnaround than SJF, but better responseq should be large compared to context switch timeq usually 10ms to 100ms, context switch < 10 usecPPP111018302614471022P2P3P1P1P1
Background image
6.23Silberschatz, Galvin and Gagne ©2013Operating System Concepts – 9thEditionTime Quantum and Context Switch Time
Background image
6.24Silberschatz, Galvin and Gagne ©2013Operating System Concepts – 9thEditionTurnaround Time Varies With The Time Quantum80% of CPU bursts should be shorter than q
Background image
6.25Silberschatz, Galvin and Gagne ©2013Operating System Concepts – 9thEditionMultilevel QueueReady queue is partitioned into separate queues, eg:foreground(interactive)background(batch)Process permanently in a given queueEach queue has its own scheduling algorithm:foreground – RRbackground – FCFSScheduling must be done between the queues:Fixed priority scheduling; (i.e., serve all from foreground then from background). Possibility of starvation.
Background image
Image of page 26

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture