Presentation is loading. Please wait.

Presentation is loading. Please wait.

CMT603 Lecture 3 Scheduling. Contents Intro to scheduling Preemption Scheduling Algorithms –?–? –?–? –?–?

Similar presentations


Presentation on theme: "CMT603 Lecture 3 Scheduling. Contents Intro to scheduling Preemption Scheduling Algorithms –?–? –?–? –?–?"— Presentation transcript:

1 CMT603 Lecture 3 Scheduling

2 Contents Intro to scheduling Preemption Scheduling Algorithms –?–? –?–? –?–?

3 Three Types of Scheduling Job scheduling –Selects processes from the process pool (usually on disk) and loads them into memory Also known as long-term scheduler Process scheduling –Selects processes from the ready queue. Short term scheduler Thread scheduling –Schedules threads from within a process

4 Why schedule processes? - Increase Efficiency The reason scheduling works is because of the CPU-I/O burst cycle. When processes run, it has been observed that: –CPU has a burst of activity –Then it waits for I/O The Durations of the CPU burst have been measured extensively

5 CPU Burst Durations Frequency Burst Duration (ms) [Silberschatz2005]

6 Reminder- How Operating Systems work Interrupts Dual Mode. Timers

7 Preemption Non-preemptive Scheduling: Once the system has assigned a CPU to a process, the system cannot remove that CPU from that process Preemptive Scheduling: The system can remove the running process from the CPU

8 Scheduling Criteria What do we want from a scheduling algorithm?

9 Scheduling Criteria It is desirable to maximize CPU utilization and throughput, and to minimize turnaround time, waiting time and response time. CPU Utilization – use of the CPU. Throughput – number of processes completed per time unit.

10 Scheduling Criteria Turnaround time – interval from submission to completion of a process. Waiting time – time spent ready to run but not running. Response time – the time from submission of a request until the first response is produced. –normally used for measuring an interactive system.

11 Scheduling Algorithms Question….. –Think of some different ways in which we could chose which process to execute next?

12 Scheduling Algorithms First come First Served SJF non preemptive / preemptive Priority Round robin

13 First come First Served ProcessBurst Time (ms) P130 P24 P32 Processes arrive at time 0 In the order P1, P2, P3 Uses a FIFO queue Non preemptive An Example FCFS

14 ProcessBurst Time (ms) P130 P24 P32 P1 0 P3P Average wait time = ( )/3 = Turnaround time = ( )/3 = Gant chart Example FCFS

15 Exercise (5 minutes) ProcessBurst Time (ms) P32 P24 P130 P1P3P Average wait time = (0+2+6)/3 = 2.67 Turnaround time = (2+6+36)/3 = 14.67

16 Analysis of FCFS Average wait time is very variable –If the burst times vary greatly Convoy effect Low device utilisation –If a CPU bound process is active for long periods, other devices are not being used

17 Shortest job first Assign CPU to the process that has the smallest next CPU-burst time Non Preemptive or Preemptive ProcessArrival Time (ms) Burst Time (ms) P108 P205 P327 P422

18 ProcessArrival Time (ms) Burst Time (ms) P108 P205 P327 P422 Example: SJF Non Preemptive P2P P1P3 Average Wait Time = ( )/4 = 5.5

19 Exercise ProcessArrival Time (ms) Burst Time (ms) P108 P205 P327 P422 Using SJF Preemptive What is the average wait time? P2P P1P3 2 P2 Average wait time = ( )/3 = 5.25

20 Analysis of SJF Optimal with respect to average waiting time How does scheduler know the length of the next CPU-burst time?

21 Summary (2) Intro to scheduling Preemption Scheduling Algorithms –FCFS –SJF

22 Exercise sheets


Download ppt "CMT603 Lecture 3 Scheduling. Contents Intro to scheduling Preemption Scheduling Algorithms –?–? –?–? –?–?"

Similar presentations


Ads by Google