CPU scheduling 6. Schedulers, CPU Scheduling 6.1. Schedulers

Slides:



Advertisements
Similar presentations
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 5: CPU Scheduling.
Advertisements

Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 5: CPU Scheduling.
02/06/2008CSCI 315 Operating Systems Design1 CPU Scheduling Algorithms Notice: The slides for this lecture have been largely based on those accompanying.
02/04/2008CSCI 315 Operating Systems Design1 CPU Scheduling Algorithms Notice: The slides for this lecture have been largely based on those accompanying.
Chapter 5-CPU Scheduling
02/11/2004CSCI 315 Operating Systems Design1 CPU Scheduling Algorithms Notice: The slides for this lecture have been largely based on those accompanying.
Modified from Silberschatz, Galvin and Gagne ©2009 Lecture 8 Chapter 5: CPU Scheduling.
CPU-Scheduling Whenever the CPU becomes idle, the operating system must select one of the processes in the ready queue to be executed. The short term scheduler.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 5: CPU Scheduling.
Chapter 5 CPU Scheduling Bernard Chen Spring 2007.
1 Module 5: Scheduling CPU Scheduling Scheduling Algorithms Reading: Chapter
CPU Scheduling Algorithms CSSE 332 Operating Systems Rose-Hulman Institute of Technology.
Chapter 5: CPU Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 5: CPU Scheduling Basic Concepts Scheduling Criteria.
1 Chapter 5: CPU Scheduling. 2 Basic Concepts Scheduling Criteria Scheduling Algorithms.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
CPU Scheduling CSSE 332 Operating Systems Rose-Hulman Institute of Technology.
lecture 5: CPU Scheduling
CPU Scheduling CSSE 332 Operating Systems
CPU SCHEDULING.
Chapter 6: CPU Scheduling
Dan C. Marinescu Office: HEC 439 B. Office hours: M, Wd 3 – 4:30 PM.
Chapter 5a: CPU Scheduling
CPU Scheduling Algorithms
Operating Systems Processes Scheduling.
Process Scheduling B.Ramamurthy 9/16/2018.
Scheduling (Priority Based)
CPU Scheduling.
Chapter 6: CPU Scheduling
Chapter 6: CPU Scheduling
Process management Information maintained by OS for process management
ICS 143 Principles of Operating Systems
Chapter 5: CPU Scheduling
Process Scheduling B.Ramamurthy 11/18/2018.
CPU Scheduling Basic Concepts Scheduling Criteria
CPU Scheduling G.Anuradha
Chapter 6: CPU Scheduling
Module 5: CPU Scheduling
Chapter 5: CPU Scheduling
Operating Systems Lecture 15.
Operating System Concepts
So far…. Firmware identifies hardware devices present
3: CPU Scheduling Basic Concepts Scheduling Criteria
Process Scheduling B.Ramamurthy 12/5/2018.
Chapter5: CPU Scheduling
Chapter 5: CPU Scheduling
Chapter 6: CPU Scheduling
Chapter 5: CPU Scheduling
Chapter 6: CPU Scheduling
Chapter 5: CPU Scheduling
Lecture 2 Part 3 CPU Scheduling
Process Scheduling B.Ramamurthy 2/23/2019.
Process Scheduling B.Ramamurthy 2/23/2019.
Process Scheduling B.Ramamurthy 2/23/2019.
Process Scheduling B.Ramamurthy 4/11/2019.
Process Scheduling B.Ramamurthy 4/7/2019.
Operating System , Fall 2000 EA101 W 9:00-10:00 F 9:00-11:00
Process Scheduling B.Ramamurthy 4/19/2019.
Process Scheduling B.Ramamurthy 4/24/2019.
Chapter 6: CPU Scheduling
Chapter 5: CPU Scheduling
Module 5: CPU Scheduling
Process Scheduling B.Ramamurthy 5/7/2019.
CPU SCHEDULING CPU SCHEDULING.
CPU Scheduling: Basic Concepts
Chapter 6: CPU Scheduling
CPU Scheduling.
CPU Scheduling: Basic Concepts
Module 5: CPU Scheduling
Chapter 5: CPU Scheduling
Presentation transcript:

CPU scheduling 6. Schedulers, CPU Scheduling 6.1. Schedulers Short term, Long term, Medium term schedulers. 6.2. CPU Scheduling 6.2.1. CPU- I/O burst cycle 6.2.2. CPU scheduler 6.2.3. Dispatcher 6.3. Scheduling Criteria 6.4. Scheduling Algorithms First Come First Served. Shortest Job First. Priority Scheduling. Round Robin. Multilevel queues, Multilevel feedback queues. Textbook Silberschatz, Chapter 6

Scheduling Criteria CPU utilization (maximize) – (0-100%) Throughput (maximize) - # of processes that complete their execution per time unit Turnaround time (minimize)– amount of time to execute a particular process (submission . . . completion). Waiting time (minimize) – amount of time a process has been waiting in the ready queue Response time (minimize the average or maximal response time)– amount of time it takes from when a request was submitted until the first response is produced, (not the whole output)

Scheduling Algorithms First-Come, First-Served Shortest-Job-First Shortest Remaining Time First Round Robin Priority Scheduling

First-Come, First-Served This non-preemptive scheduling algorithm follows the first-in, first-out (FIFO) policy. As each process becomes ready, it joins the ready queue – to the tail. When the current running process finishes execution, the oldest process in the ready queue is selected to run next – from the head of queue. Tail Head Ready Queue CPU P3 P2 P1 Head Ready Queue CPU P2 P3 P2 Tail I/O

FCFS Waiting Time Process CPU Burst Time (ms) P1 24 P2 3 P3 3 Suppose that the processes arrive at time 0 in the order: P1 , P2 , P3 The Gantt Chart for the CPU processing is: Waiting time for P1 = 0; P2 = 24; P3 = 27 Average waiting time: (0 + 24 + 27)/3 = 17 P1 P2 P3 24 27 30 Gantt chart - A Gantt Chart is a bar chart that depicts activities as blocks over time. The beginning and end of the block correspond to the beginning and end-date of the activity. A Gantt chart developed as a production control tool in 1917 by Henry L. Gantt, an American engineer. The average waiting time under the FCFS policy is often quite long.

FCFS Waiting Time not optimal Process CPU Burst Time (ms) P1 24 P2 3 P3 3 Suppose that the processes arrive in the order: P2 , P3 , P1 The Gantt chart for the schedule is: Waiting time for P1 = 6; P2 = 0; P3 = 3 Average waiting time: (6 + 0 + 3)/3 = 3 Much better than previous case P1 P3 P2 6 3 30

FCFS Convoy Effect Convoy effect - short CPU burst processes behind long process Consider one CPU-bound and many I/O-bound processes Advantages: The code for FCFS scheduling is simple to write and understand. Disadvantages: The average waiting time under the FCFS policy, however, is often quite long. As FCFS is nonpreemptive then once the CPU has been allocated to a process, that process keeps the CPU until it releases the CPU, either by terminating or by requesting I/O. Either the CPU is idle Or I/O devices are idle

Shortest Job First (SJF) or Shortest next CPU burst Associate with each process the length of its next CPU burst Use these lengths to schedule the process with the shortest time SJF is optimal – gives minimum average waiting time for a given set of processes The difficulty is knowing the length of the next CPU request

Shortest Job First (SJF) or Shortest next CPU burst Example Process Arrival Time Burst Time P1 0.0 6 P2 0.0 8 P3 0.0 7 P4 0.0 3 SJF scheduling chart Average waiting time = (3 + 16 + 9 + 0) / 4 = 7 P4 P3 P1 3 16 9 P2 24 If we were using the FCFS scheduling scheme, then the average waiting time would be 10.25 milliseconds. This is better than FCFS But may be not the best one

Shortest Job First (SJF) Preemptive - NonPreemptive

Why 9? Why 1?

Prediction of the Length of the Next CPU burst Can only estimate the length of burst – should be similar to the previous one of the same process Then pick process with shortest predicted next CPU burst Can be done by using the length of previous CPU bursts, using exponential averaging Commonly, α set to ½ τn+1 = αtn + (1- α) τn  =0 n+1 = n Recent history does not count  =1 n+1 =  tn Only the actual last CPU burst counts

Prediction of the Length of the Next CPU burst Figure below shows an exponential average with α = 1/2 and τo = 10.