1 / 9

CGS 3763 Operating Systems Concepts Spring 2013

CGS 3763 Operating Systems Concepts Spring 2013. Dan C. Marinescu Office: HEC 304 Office hours: M- Wd 11:30 - 12:30 A M. Last time: Answers from week 7 questions CPU Scheduling Today: CPU scheduling Next time CPU scheduling Process synchronization

myron
Download Presentation

CGS 3763 Operating Systems Concepts Spring 2013

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

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

  3. Example of Shortest-Remaining-Time-First (SRTF) (Preemptive SJF) P1 P2 P3 P2 P4 P1 11 16 0 2 4 5 7 Thread Release timeBurst time P1 0.0 7 P2 2.0 4 P3 4.0 1 P4 5.0 4 Shortest-Remaining-Time-First Average waiting time = (9 + 1 + 0 +2)/4 = 3 Lecture 23

  4. Determining length of next CPU Burst • Needed by the SJF algorithm. • Can be predictedby 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 10-100 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

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

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

More Related