1 5.4.3 Round Robin Scheduling A preemptive scheduling designed for Time Sharing Systems The Ready Queue is treated as a circular queue A small execution.

Slides:



Advertisements
Similar presentations
Chapter 9 Uniprocessor Scheduling Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College, Venice,
Advertisements

Scheduling Criteria CPU utilization – keep the CPU as busy as possible (from 0% to 100%) Throughput – # of processes that complete their execution per.
Rensselaer Polytechnic Institute CSCI-4210 – Operating Systems David Goldschmidt, Ph.D.
CPU Scheduling Questions answered in this lecture: What is scheduling vs. allocation? What is preemptive vs. non-preemptive scheduling? What are FCFS,
Rensselaer Polytechnic Institute CSCI-4210 – Operating Systems David Goldschmidt, Ph.D.
Operating Systems CPU Scheduling. Agenda for Today What is Scheduler and its types Short-term scheduler Dispatcher Reasons for invoking scheduler Optimization.
Day 25 Uniprocessor scheduling. Algorithm: Selection function Selection function – which process among ready processes to select. w – time spent in system,
Chapter 3: CPU Scheduling
Operating Systems 1 K. Salah Module 2.1: CPU Scheduling Scheduling Types Scheduling Criteria Scheduling Algorithms Performance Evaluation.
Scheduling in Batch Systems
1Chapter 05, Fall 2008 CPU Scheduling The CPU scheduler (sometimes called the dispatcher or short-term scheduler): Selects a process from the ready queue.
Uniprocessor 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.
CPU Scheduling Chapter 6 Chapter 6.
Chapter 6: CPU Scheduling
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-3 CPU Scheduling Department of Computer Science and Software Engineering.
Uniprocessor Scheduling
CS3530 OPERATING SYSTEMS Summer 2014 Processor Scheduling Chapter 5.
COT 4600 Operating Systems Spring 2011 Dan C. Marinescu Office: HEC 304 Office hours: Tu-Th 5:00-6:00 PM.
Chapter 6 CPU SCHEDULING.
More Scheduling cs550 Operating Systems David Monismith.
Fair Resource Access & Allocation  OS Scheduling
Chapter 7 Scheduling Chien-Chung Shen CIS, UD
Chapter 6 Scheduling. Basic concepts Goal is maximum utilization –what does this mean? –cpu pegged at 100% ?? Most programs are I/O bound Thus some other.
Uniprocessor Scheduling Chapter 9. Aim of Scheduling To improve: Response time: time it takes a system to react to a given input Turnaround Time (TAT)
CPU Scheduling CSCI 444/544 Operating Systems Fall 2008.
1 Our focus  scheduling a single CPU among all the processes in the system  Key Criteria: Maximize CPU utilization Maximize throughput Minimize waiting.
CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor Scheduling Operating Systems Examples Algorithm.
Chapter 5 CPU Scheduling Bernard Chen Spring 2007.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Lecture 7: CPU Scheduling Chapter 5.
Lecture 7: Scheduling preemptive/non-preemptive scheduler CPU bursts
Chapter 5 Processor Scheduling Introduction Processor (CPU) scheduling is the sharing of the processor(s) among the processes in the ready queue.
Scheduling Policies and File Systems Operating Systems CS 550.
Operating Systems 1 K. Salah Module 2.2: CPU Scheduling Scheduling Types Scheduling Criteria Scheduling Algorithms Performance Evaluation.
ITFN 2601 Introduction to Operating Systems Lecture 4 Scheduling.
Silberschatz and Galvin  Operating System Concepts Module 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor.
Processor Scheduling Hank Levy. 22/4/2016 Goals for Multiprogramming In a multiprogramming system, we try to increase utilization and thruput by overlapping.
Lecture Topics: 11/15 CPU scheduling: –Scheduling goals and algorithms.
Operating Systems CPU Scheduling Algorithms
1 CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling.
CPU Scheduling Operating Systems CS 550. Last Time Deadlock Detection and Recovery Methods to handle deadlock – Ignore it! – Detect and Recover – Avoidance.
Process Scheduling Schedulers and Scheduling Methods.
1 Uniprocessor Scheduling Chapter 3. 2 Alternating Sequence of CPU And I/O Bursts.
Chapter 4 CPU Scheduling. 2 Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation.
Basic Concepts Maximum CPU utilization obtained with multiprogramming
Chapter 7 Scheduling Chien-Chung Shen CIS/UD
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 5: CPU Scheduling.
OPERATING SYSTEMS CS 3502 Fall 2017
Chapter 5a: CPU Scheduling
Priority Scheduling Example
Chapter 2 Scheduling.
Chapter 2.2 : Process Scheduling
Process Scheduling B.Ramamurthy 9/16/2018.
Scheduling (Priority Based)
CPU Scheduling.
Chapter 6: CPU Scheduling
Chapter 6: CPU Scheduling
Lecture 23: Process Scheduling for Interactive Systems
CPU Scheduling Basic Concepts Scheduling Criteria
Chapter 6: CPU Scheduling
Chapter 5: CPU Scheduling
Operating System Concepts
TDC 311 Process Scheduling.
COT 4600 Operating Systems Spring 2011
CGS 3763 Operating Systems Concepts Spring 2013
Processor Scheduling Hank Levy 1.
Uniprocessor scheduling
CPU SCHEDULING CPU SCHEDULING.
Chapter 6: Scheduling Algorithms Dr. Amjad Ali
CPU Scheduling CSE 2431: Introduction to Operating Systems
Presentation transcript:

Round Robin Scheduling A preemptive scheduling designed for Time Sharing Systems The Ready Queue is treated as a circular queue A small execution time interval is defined as the Time Quantum, or time slice

2 Interrupts in Round Robin When the executing interval of a process reaches the time quantum, the timer will cause the OS to interrupt the process The OS carries out a context switch to the next selected process from the ready queue.

3 Length of the Time Quantum Time quantum that is too short will generate many context switching and results in lower CPU efficiency. Time quantum that is too long may result in poor performance time.

4 RR Scheduling (cont’d) Example: Five processes arrive at time 0, in the order: P1, P2, P3, P4, P5. Their CPU burst time are shown in the following table. Using RR with Quantum =40 msec, find the average turnaround time and average waiting time ProcessCPU burst (Unit: ms) P1135 P2102 P356 P4148 P5125

5 First round (First turn): 0 to 200 ms Execution time of each ProcessRemaining time P140 (run from 0 to 40) 135 – 40 = 95 P240 (run from 40 to 80) 102 – 40 = 62 P340 (run from 80 to 120) 56 – 40 = 16 P440 (run from 120 to 160) 148 – 40 = 108 P540 (run from 160 to 200) 125 – 40 = 85

6 Second round (Second turn): 200 to 376 ms Execution time of each ProcessRemaining time P140 (run from 200 to 240) 95 – 40 = 55 P240 (run from 240 to 280) 62 – 40 = 22 P316 (run from 280 to 296) P3 runs to completion Ta(P3) = 296 P440 (run from 296 to 336) 108 – 40 = 68 P540 (run from 236 to 376) 85 – 40 = 45

7 Third round (third turn): 376 to 518 ms Execution time of each ProcessRemaining time P140 (run from 376 to 416) 55 – 40 = 15 P222 (run from 416 to 438) P2 runs to completion Ta(P2) = 438 P440 (run from 438 to 478) 68 – 40 = 28 P540 (run from 478 to 518) 45 – 40 = 5

8 Fourth round (fourth turn): 518 to 566 ms Execution time of each ProcessRemaining time P115 (run from 518 to 533) P1 runs to completion Ta(P1) = 533 P428 (run from 533 to 561) P4 runs to completion Ta(P4) = 561 P55 (run from 561 to 566) P5 runs to completion Ta(P5) = 566 Average Turnaround Time = (Ta(P3)+Ta(P2) +Ta(P1)+Ta(P4)+Ta(P5)) / 5 = ( ) / 5 = ms

9 Example with Round Robin The chart for Round-Robin, with Quantum =40 msec., is:

10 Wait Time: Wait time P1533 – 135 = 398 P2438 – 102 = 336 P3296 – 56 = 240 P4561 – 148 = 413 P5566 – 125 = 441 Average Wait Time = (Tw(P1)+Tw(P2) +Tw(P3)+Tw(P4)+Tw(P5)) / 5 = ( ) / 5 = ms

Shortest Remaining Time First Shortest remaining time (SRTF) is a preemptive version of SPN scheduling. With this scheduling policy, a new process that arrives will cause the scheduler to interrupt the currently executing process if the CPU burst of the newly arrived process is less than the remaining service period of the process currently executing. There is then a context switch and the new process is started immediately.

12 SRTF Scheduling When there are no arrivals, the scheduler selects from the ready queue the process with the shortest CPU service period (burst). As with SPN, this scheduling policy can be considered multi-class because the scheduler gives preference to the group of processes with the shortest remaining service time and processes with the shortest CPU burst.

13 SRTF Example Process Arrival time CPU burst P10135 P20102 P3056 P40148 P50125 P620065

14 Gantt Chart for SRTF Example Turnaround Time: Ta(p3)=56, Ta(p2)=56+102=158 At time 200, P5 has executed during 42 msec and has remaining service time of 83 microseconds, which is greater than the CPU burst of P6 (i.e., 65 ms). Ta(p6) = 65, Ta(P5)= =348 Ta(P1) = = 483 Ta(P4) = = 631

15 Results of Example Using SRT ProcessStartCompletionWaitTurnaroundNtat P P P P P P The average wait period = ( )/6=185.0 microsec. The average turnaround time = ( ) = microsec.

Dynamic Priority Scheduling Processes that request I/O service will typically start with CPU service; for a short time; request another I/O operation; and release the CPU. If these processes are given higher priority, they can keep the I/O devices busy without using a significant amount of CPU time. This will tend to maximize I/O utilization while using a relatively small amount of CPU time. The remaining CPU capacity will be available for processes that are requesting CPU bursts.

17 Dynamic Priority Scheduling (2) The CPU scheduler dynamically adjusts the priority of a process as the process executes. The typical approach is to adjust the priority based on the level of expectation that the process will carry out a system call (typically an I/O request). However, this requires the CPU scheduler to predict future process requests.

Other Scheduling Policies Longest Process Next  Not attractive

Real-Time Systems A system that maintains an on-going interaction with its environment One of the requirements of the system is its strict timing constraints The system depends on priorities and preemption

20 Real-Time Scheduling Policies One of the goals of real-time scheduling is to guarantee fast response of the high-priority real-time processes. The second general goal is to guarantee the processes van be scheduled in some manner to meet their individual deadline.

21 Real-time Processes The real-time processes, each with its own service demand, priority and deadline, compete for the CPU. Real-time processes must complete their service before their deadlines expire. The performance of the system is based on this guarantee.

22 Real-time Processes (2) The real-time processes can be: – Periodic processes need to be executed every specific interval (known as the period) – Sporadic processes can be started by external random events. The operating system uses a real-time scheduling policy based on priorities and preemption.

Multiple Processors For multiple-processor systems, there are several ways a system is configured. More advanced configurations and techniques for example, parallel computing, are outside the scope of this book.

24 Single Queue-Multiple Processors

25 Multiple Queues-Multiple Processors

Summary FCFS SJF RR SRT