70 likes | 154 Views
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: CPU Scheduling Today: CPU scheduling Next time CPU scheduling Process synchronization Reading assignments
E N D
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11:30 - 12:30 AM
Last time: CPU Scheduling Today: CPU scheduling Next time CPU scheduling Process synchronization Reading assignments Chapter 6 of the textbook Lecture 24 – Wednesday, March 13, 2013 Lecture 24
Comparison of FCFS, SJF, and RR • We have three processes A, B, and C. • Each process is characterized by • Release time (R) – the time the process arrives in the system • Start time (S) – the time the scheduler allows it to run • Wait time (W) – the time till it has to wait until it is started: W = S - R • Work (Wrk) – the amount of time it needs to use the CPU • Finish time (F) – the time the process finishes: F=S+Wrk • Time in system (T) – the time from when the process arrives until it finishes: T = F- R. • We compare • The average time in system • The average waiting time for three scheduling policies: FCFS, SJF, and RR. Lecture 24
Priority scheduling • Each thread/process has a priority and the one with the highest priority (smallest integer highest priority) is scheduled next. • Preemptive • Non-preemptive • SJF is a priority scheduling where priority is the predicted next CPU burst time • Problem Starvation – low priority threads/processes may never execute • Solution to starvation Aging – as time progresses increase the priority of the thread/process • Priority my be computed dynamically Lecture 24
Priority inversion • A lower priority thread/process prevents a higher priority one from running. • T3 has the highest priority, T1 has the lowest priority; T1 and T3 share a lock. • T1 acquires the lock, then it is suspended when T3 starts. • Eventually T3 requests the lock and it is suspended waiting for T1 to release the lock. • T2 has higher priority than T1 and runs; neither T3 nor T1 can run; T1 due to its low priority, T3 because it needs the lock help by T1. • Allow a low priority thread holding a lock to run with the higher priority of the thread which requests the lock • other types of software. Lecture 24