Presentation is loading. Please wait.

Presentation is loading. Please wait.

CGS 3763 Operating Systems Concepts Spring 2013

Similar presentations


Presentation on theme: "CGS 3763 Operating Systems Concepts Spring 2013"— Presentation transcript:

1 CGS 3763 Operating Systems Concepts Spring 2013
Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM

2 Lecture 23 – Monday, March 11, 2013 Last time: Today: Next time
Answers from week 7 questions CPU Scheduling Today: CPU scheduling Next time Process synchronization Reading assignments Chapter 6 of the textbook Lecture 23

3 Example of Shortest-Remaining-Time-First (SRTF) (Preemptive SJF)
Thread Release time Burst time P P P P Shortest-Remaining-Time-First Average waiting time = ( )/4 = 3 P1 P3 P2 4 2 11 P4 5 7 16 Lecture 23 3

4 Determining length of next CPU Burst
Needed by the SJF algorithm. Can be predicted by using: The past history, the length of previous CPU bursts. Exponential averaging based on the past lengths of the CPU bursts Lecture 23

5 Prediction of the Length of the Next CPU Burst
Lecture 23

6 Exponential Averaging
 =0 n+1 = n Recent history does not count  =1 n+1 =  tn Only the actual last CPU burst counts If we expand the formula, we get: n+1 =  tn+(1 - ) tn -1 + … +(1 -  )j  tn -j + … +(1 -  )n +1 0 Since both  and (1 - ) are less than or equal to 1, each successive term has less weight than its predecessor Lecture 23

7 Round Robin (RR) Each process gets a small unit of CPU time (time quantum), usually milliseconds. After this time has elapsed, the thread/process is preempted and added to the end of the ready queue. If there are n threads/processes in the ready queue and the time quantum is q, then each thread/process gets 1/n of the processor time in chunks of at most q time units at once. No thread/process waits more than (n-1)q time units. Performance q large  FIFO q small  q must be large with respect to context switch, otherwise overhead is too high Lecture 23 7

8 RR with time slice q = 20 Thread Burst Time P1 53 P2 17 P3 68 P4 24
Typically, higher average turnaround than SJF, but better response P1 P2 P3 P4 20 37 57 77 97 117 121 134 154 162 Lecture 23 8

9 Time slice (quantum) and context switch time software.
Lecture 23 9


Download ppt "CGS 3763 Operating Systems Concepts Spring 2013"

Similar presentations


Ads by Google