Uniprocessor Scheduling II

Slides:



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

Chapter 9 Uniprocessor Scheduling Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College, Venice,
Chapter 9 Uniprocessor Scheduling
Scheduling Criteria CPU utilization – keep the CPU as busy as possible (from 0% to 100%) Throughput – # of processes that complete their execution per.
CH 5. CPU Scheduling Basic Concepts F CPU Scheduling  context switching u CPU switching for another process u saving old PCB and loading.
1 Uniprocessor Scheduling Types of scheduling –The aim of processor scheduling is to assign processes to be executed by the processor so as to optimize.
Chapter 9 Uniprocessor Scheduling
A. Frank - P. Weisberg Operating Systems Advanced CPU Scheduling.
Operating Systems Chapter 6
Chapter 9 Uniprocessor Scheduling Operating Systems: Internals and Design Principles, 6/E William Stallings Dave Bremer Otago Polytechnic, N.Z. ©2008,
Chapter 9 Uniprocessor Scheduling Operating Systems: Internals and Design Principles, 6/E William Stallings Dave Bremer Otago Polytechnic, N.Z. ©2008,
Ceng Operating Systems Chapter 2.2 : Process Scheduling Process concept  Process scheduling Interprocess communication Deadlocks Threads.
Day 25 Uniprocessor scheduling. Algorithm: Selection function Selection function – which process among ready processes to select. w – time spent in system,
Chapter 9 Uniprocessor Scheduling
Uniprocessor Scheduling Chapter 9. Aim of Scheduling The key to multiprogramming is scheduling Scheduling is done to meet the goals of –Response time.
Uniprocessor Scheduling III CPSC 410 Operating Systems Department of Physics, Computer Science and Engineering Christopher Newport University.
Chapter 9 Uniprocessor Scheduling
1 Uniprocessor Scheduling Chapter 9. 2 Aims of Scheduling Assign processes to be executed by the processor(s) Response time Throughput Processor efficiency.
1 Lecture 10: Uniprocessor Scheduling. 2 CPU Scheduling n The problem: scheduling the usage of a single processor among all the existing processes in.
Chapter 9 Uniprocessor Scheduling Seventh Edition By William Stallings Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice Hall Operating Systems: Internals.
1 Uniprocessor Scheduling Chapter 9. 2 Aim of Scheduling Main Job: Assign processes to be executed by the processor(s) and processes to be loaded in main.
Chapter 9 Uniprocessor Scheduling Seventh Edition By William Stallings Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice Hall Operating Systems: Internals.
Uniprocessor Scheduling
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.
CPU Scheduling Introduction to Operating Systems: Module 13.
Chapter 9 Uniprocessor Scheduling Spring, 2011 School of Computer Science & Engineering Chung-Ang University.
Chapter 9 Uniprocessor Scheduling Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College, Venice,
Chapter 9 Uniprocessor Scheduling Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College, Venice,
Chapter 9 Uniprocessor Scheduling Seventh Edition By William Stallings Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice Hall Operating Systems: Internals.
Scheduling Chap 2. Scheduling Introduction to Scheduling (1) Bursts of CPU usage alternate with periods of I/O wait –a CPU-bound process –an I/O bound.
IT320 OPERATING SYSTEM CONCEPTS Unit 6: Processor Scheduling September 2012 Kaplan University 1.
Scheduling Strategies Operating Systems Spring 2004 Class #10.
Classification of scheduling policies Preemptive methods (typical representative: RR) Non-preemptive methods (typical representative: FCFS) Preemption.
Operating System Chapter 9. Uniprocessor Scheduling
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)
Uniprocessor Scheduling Chapter 9. Aim of Scheduling Minimize response time Maximize throughput Maximize processor efficiency.
1 Our focus  scheduling a single CPU among all the processes in the system  Key Criteria: Maximize CPU utilization Maximize throughput Minimize waiting.
Alternating Sequence of CPU And I/O Bursts. Histogram of CPU-burst Times.
CPU Scheduling Algorithms Simulation using Java Kaushal Sinha CSC 4320 Spring 2007.
Lecture 7: Scheduling preemptive/non-preemptive scheduler CPU bursts
1 Uniprocessor Scheduling Chapter 9. 2 Aim of Scheduling Response time Throughput Processor efficiency.
Uniprocessor Scheduling Chapter 9. Aim of Scheduling Response time Throughput Processor efficiency.
Uniprocessor Scheduling
Operating System 9 UNIPROCESSOR SCHEDULING. TYPES OF PROCESSOR SCHEDULING.
Uniprocessor Scheduling Chapter 9. Processor Scheduling Processor scheduling determines the assignment of processes to be executed by the processor over.
Uniprocessor Scheduling Chapter 9. Aim of Scheduling Assign processes to be executed by the processor or processors: –Response time –Throughput –Processor.
Lecture Topics: 11/15 CPU scheduling: –Scheduling goals and algorithms.
CPU Scheduling Operating Systems CS 550. Last Time Deadlock Detection and Recovery Methods to handle deadlock – Ignore it! – Detect and Recover – Avoidance.
1 Uniprocessor Scheduling Chapter 3. 2 Alternating Sequence of CPU And I/O Bursts.
Chapter 9 Uniprocessor Scheduling Operating Systems: Internals and Design Principles, 6/E William Stallings Dave Bremer Otago Polytechnic, N.Z. ©2008,
1 Chapter 5: CPU Scheduling. 2 Basic Concepts Scheduling Criteria Scheduling Algorithms.
1 Uniprocessor Scheduling Chapter 9. 2 Aim of Scheduling Assign processes to be executed by the processor(s) Response time Throughput Processor efficiency.
Uniprocessor Scheduling Chapter 9 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College, Venice,
Uniprocessor Scheduling
Uniprocessor Scheduling
Uniprocessor Scheduling
Chapter 2.2 : Process Scheduling
Day 25 Uniprocessor scheduling
Scheduling (Priority Based)
פרק שלישי – תזמון תהליכים
Chapter 6: CPU Scheduling
Operating System Chapter 9. Uniprocessor Scheduling
Chapter 9 Uniprocessor Scheduling
Operating System 9 UNIPROCESSOR SCHEDULING
Chapter 9 Uniprocessor Scheduling
Uniprocessor scheduling
Uniprocessor Scheduling
Uniprocessor Scheduling
Chapter 5: CPU Scheduling
Presentation transcript:

Uniprocessor Scheduling II Chapter 9

Shortest Process Next Nonpreemptive policy 5 10 15 20 1 2 3 4 Nonpreemptive policy Process with shortest expected processing time is selected next Short process jumps ahead of longer processes P3: 4 time units P4: 5 time units P5 2 time units

Shortest Process Next Predictability of longer processes is reduced If estimated time for process not correct, the operating system may abort it Possibility of starvation for longer processes

Shortest Remaining Time 5 10 15 20 1 2 3 4 SRT is a preemptive version of shortest process next (SPN) policy Must estimate processing time P2 Remaining 5 time units P4 Remaining 5 time units P5 Remaining 2 time units P2 Remaining 5 time units P3 Remaining 4 time units

Highest Response Ratio Next (HRRN) 5 10 15 20 Choose next process with the greatest value of RR No Preemptive P5 RR =3.5 1 P4 RR = 2.4 2 3 P3 RR=2.25 P4 RR = 1.6 P5 RR = 1.5 4 5 RR =(w+s)/s =time spent waiting+expected service time expected service time P5 RR=( (13-8) + 2)/2 = 3.5 // P5 has been chosen at 13 P4 RR=( (13-6) + 5)/5 = 2.4

Feedback Scheduling is done on a preemptive basis, and a dynamic priority mechanisms is used. When s process first enters the system, it is placed in RQ0. After its first execution, when it returns to the Ready state, it is placed in RQ1.

Feedback (q = 1) 5 10 15 20 1 2 3 4 Penalize jobs that have been running longer. Focus on the time spent in execution so far. Don’t know remaining time process needs to execute 1 RQ5 3 4 5 2 1 3 2 1 3 4 2 RQ4 1 1 RQ2 RQ3 RQ0 RQ1

Feedback q=2i 5 10 15 20 When a process first enters the system, it is placed in RQ0. After its first execution, when it returns to the Ready state, it is placed in RQ1 …… In general, a process scheduled from RQi is allowed to execute 2 i time units (1, 2, 4, 8, …...) before preemption. RQ2, 4 time units 1 RQ1,2 time units 1 1(2) 2 2(4) 1(2) 3 2 1(2) 4 2 1 5

Question - Case Study (1) Consider the following set of processes: Process Name Arrival Time Processing Time 1 0 3 2 1 5 3 3 2 4 9 5 5 12 5 Perform the analysis of a comparison of scheduling policies(FCFS, RR(q=1), RR(q=4), SPN, SRT, HRRN, Feedback(q=1), and Feedback(q=2 i) )

Solution of Question (2) 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 FCFS 1 1 1 2 2 2 2 2 3 3 4 4 4 4 4 5 5 5 5 5 RR 1 2 1 2 3 1 2 3 2 4 2 4 5 4 5 4 5 4 5 5 q=1 RR 1 1 1 2 2 2 2 3 3 2 4 4 4 4 5 5 5 5 4 5 q=4 SPN 1 1 1 3 3 2 2 2 2 2 4 4 4 4 4 5 5 5 5 5 SRT 1 1 1 3 3 2 2 2 2 2 4 4 4 4 4 5 5 5 5 5 HRRN 1 1 1 2 2 2 2 2 3 3 4 4 4 4 4 5 5 5 5 5 FB 1 2 1 3 2 3 1 2 2 4 2 4 5 4 5 4 5 4 5 5 FB 1 2 1 1 3 2 2 3 2 2 4 4 5 4 4 5 5 4 5 5 q=2i * Each square represents one time unit. The number refers to the running process

Solution of Question - FCFS (3) 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 FCFS 1 1 1 2 2 2 2 2 3 3 4 4 4 4 4 5 5 5 5 5 * Each square represents one time unit. The number refers to the running process First Come First Served (FCFS) Process Pi 1 2 3 4 5 Average Arrival Time Ta 0 1 3 9 12 Service Time Ts 3 5 2 5 5 Finish Time Tf 3 8 10 15 20 Turnaround Time Tq 3.0 7.0 7.0 6.0 8.0 6.20 Tq = Tf - Ta Normalized Tq/Ts 1.0 1.4 3.5 1.2 1.6 1.74 Turnaround Time

Solution of Question Round Robin q=1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 P1 P2 P3 P4 P5 1 2 1 2 3 1 2 3 2 4 2 4 5 4 5 4 5 4 5 5 Ready Time 1 3 2 4 7 1 9 3 5 10 12 14 9 16 13 15 12 17

Solution of Question - RR (q=1) (4) 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 RR 1 2 1 2 3 1 2 3 2 4 2 4 5 4 5 4 5 4 5 5 q=1 * Each square represents one time unit. The number refers to the running process Round Robin (RR q=1) Process Pi 1 2 3 4 5 Average Arrival Time Ta 0 1 3 9 12 Service Time Ts 3 5 2 5 5 Finish Time Tf 6 11 8 18 20 Turnaround Time Tq 6 10 5 9 8 7.6 Tq = Tf - Ta Normalized Tq/Ts 2.0 2.0 2.5 1.8 1.6 1.98 Turnaround Time

Solution of Question Round Robin q=4 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 P1 P2 P3 P4 P5 1 1 1 2 2 2 2 3 3 2 4 4 4 4 5 5 5 5 4 5 Ready Time 1 7 3 9 14 12 18

Solution of Question - RR (q=4) (5) 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 RR 1 1 1 2 2 2 2 3 3 2 4 4 4 4 5 5 5 5 4 5 q=4 * Each square represents one time unit. The number refers to the running process Round Robin (RR q=4) Process Pi 1 2 3 4 5 Average Arrival Time Ta 0 1 3 9 12 Service Time Ts 3 5 2 5 5 Finish Time Tf 3 10 9 19 20 Turnaround Time Tq 3 9 6 10 8 7.20 Tq = Tf - Ta Normalized Tq/Ts 1.0 1.8 3.0 2.0 1.6 1.88 Turnaround Time

Solution of Question - SPN (6) 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 SPN 1 1 1 3 3 2 2 2 2 2 4 4 4 4 4 5 5 5 5 5 * Each square represents one time unit. The number refers to the running process Shortest Process Next (SPN) Process Pi 1 2 3 4 5 Average Arrival Time Ta 0 1 3 9 12 Service Time Ts 3 5 2 5 5 Finish Time Tf 3 10 5 15 20 Turnaround Time Tq 3 9 2 6 8 5.60 Tq = Tf - Ta Normalized Tq/Ts 1.0 1.8 1.0 1.2 1.6 1.32 Turnaround Time

Solution of Question - SRT (7) 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 SRT 1 1 1 3 3 2 2 2 2 2 4 4 4 4 4 5 5 5 5 5 * Each square represents one time unit. The number refers to the running process Shortest Remaining Time (SRT) Process Pi 1 2 3 4 5 Average Arrival Time Ta 0 1 3 9 12 Service Time Ts 3 5 2 5 5 Finish Time Tf 3 10 5 15 20 Turnaround Time Tq 3 9 2 6 8 5.60 Tq = Tf - Ta Normalized Tq/Ts 1.0 1.8 1.0 1.2 1.6 1.32 Turnaround Time

Solution of Question - HRRN (8) 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 HRRN 1 1 1 2 2 2 2 2 3 3 4 4 4 4 4 5 5 5 5 5 * Each square represents one time unit. The number refers to the running process Highest Response Ratio Next (HRRN) Process Pi 1 2 3 4 5 Average Arrival Time Ta 0 1 3 9 12 Service Time Ts 3 5 2 5 5 Finish Time Tf 3 8 10 15 20 Turnaround Time Tq 3 7 7 6 8 6.20 Tq = Tf - Ta Normalized Tq/Ts 1.0 1.4 3.5 1.2 1.6 1.74 Turnaround Time * At time 3: P2 RR (2+5)/5 = 1.4; P3 RR= (0+2)/2 = 1. So Choose P2

Solution of Question Feedback q=1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 P1 P2 P3 P4 P5 1 2 1 3 2 3 1 2 2 4 4 4 5 5 5 2 4 5 4 5 RQ1 RQ2 1 2 1 2 3 RQ3 1 3 4 1 2 RQ4 RQ0 4 1 2 3

Solution of Question - FB q=1 (9) 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 FB 1 2 1 3 2 3 1 2 2 4 4 4 5 5 5 2 4 5 4 5 q=1 * Each square represents one time unit. The number refers to the running process Feedback (FB q=1) Process Pi 1 2 3 4 5 Average Arrival Time Ta 0 1 3 9 12 Service Time Ts 3 5 2 5 5 Finish Time Tf 7 16 6 19 20 Turnaround Time Tq 7 15 3 10 8 8.6 Tq = Tf - Ta Normalized Tq/Ts 2.3 3.0 1.5 2.0 1.6 2.08 Turnaround Time

Solution of Question Feedback q= 2i 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 P1 P2 P3 P4 P5 1 2 1 1 3 2 2 3 2 2 4 4 5 4 4 5 5 4 5 5 RQ1 1 RQ2 1 2 1 1 2 RQ0 1 2

Solution of Question - FB q= 2i (10) 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 FB 1 2 1 1 3 2 2 3 2 2 4 4 5 4 4 5 5 4 5 5 q=2i * Each square represents one time unit. The number refers to the running process Feedback (FB q = 2i) Process Pi 1 2 3 4 5 Average Arrival Time Ta 0 1 3 9 12 Service Time Ts 3 5 2 5 5 Finish Time Tf 4 10 8 18 20 Turnaround Time Tq 4 9 5 9 8 7.00 Tq = Tf - Ta Normalized Tq/Ts 1.3 1.8 2.5 1.8 1.6 1.81 Turnaround Time

Question 1 - Exercise/Home Work (1) Consider the following set of processes: Process Name Arrival Time Processing Time 1 0 1 2 1 9 3 2 1 4 3 9 Perform the analysis of a comparison of scheduling policies(FCFS, RR(q=1), RR(q=4), SPN, SRT, HRRN, Feedback(q=1), and Feedback(q=2 i) )