P ROCESSES S CHEDULING Prepared By: Dr. Vipul Vekariya.

Slides:



Advertisements
Similar presentations
OS, , Part II CPU Scheduling Department of Computer Engineering, PSUWannarat Suntiamorntut.
Advertisements

Chapter 9 Uniprocessor Scheduling
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 2 nd Edition Chapter 6a: CPU Scheduling.
 Basic Concepts  Scheduling Criteria  Scheduling Algorithms.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 5: CPU Scheduling.
Operating Systems CPU Scheduling. Agenda for Today What is Scheduler and its types Short-term scheduler Dispatcher Reasons for invoking scheduler Optimization.
Scheduling Algorithms
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,
Chapter 3: CPU Scheduling
Chapter 9 Uniprocessor Scheduling
CS 311 – Lecture 23 Outline Kernel – Process subsystem Process scheduling Scheduling algorithms User mode and kernel mode Lecture 231CS Operating.
Scheduling in Batch Systems
6/25/2015Page 1 Process Scheduling B.Ramamurthy. 6/25/2015Page 2 Introduction An important aspect of multiprogramming is scheduling. The resources that.
Chapter 5-CPU Scheduling
1 Uniprocessor Scheduling Chapter 9. 2 Aims of Scheduling Assign processes to be executed by the processor(s) Response time Throughput Processor efficiency.
A. Frank - P. Weisberg Operating Systems CPU Scheduling.
7/12/2015Page 1 Process Scheduling B.Ramamurthy. 7/12/2015Page 2 Introduction An important aspect of multiprogramming is scheduling. The resources that.
02/11/2004CSCI 315 Operating Systems Design1 CPU Scheduling Algorithms Notice: The slides for this lecture have been largely based on those accompanying.
1 Lecture 10: Uniprocessor Scheduling. 2 CPU Scheduling n The problem: scheduling the usage of a single processor among all the existing processes in.
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.
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.
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 6 CPU SCHEDULING.
CPU S CHEDULING Lecture: Operating System Concepts Lecturer: Pooja Sharma Computer Science Department, Punjabi University, Patiala.
Scheduling. Alternating Sequence of CPU And I/O Bursts.
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.
Uniprocessor Scheduling Chapter 9. Aim of Scheduling Minimize response time Maximize throughput Maximize processor efficiency.
Alternating Sequence of CPU And I/O Bursts. Histogram of CPU-burst Times.
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.
Course Title: “Operating System” Chapter No: 04 “Process Scheduling” Course Instructor: ILTAF MEHDI IT Lecturer, MIHE, Kart-i Parwan, Kabul.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Lecture 7: CPU Scheduling Chapter 5.
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
Chapter 5: Process Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Basic Concepts Maximum CPU utilization can be obtained.
Uniprocessor Scheduling Chapter 9. Aim of Scheduling Assign processes to be executed by the processor or processors: –Response time –Throughput –Processor.
Silberschatz and Galvin  Operating System Concepts Module 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor.
Lecture Topics: 11/15 CPU scheduling: –Scheduling goals and algorithms.
Purpose of Operating System Part 2 Monil Adhikari.
1 CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling.
Operating Systems Scheduling. Scheduling Short term scheduler (CPU Scheduler) –Whenever the CPU becomes idle, a process must be selected for execution.
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.
Chapter 9 Uniprocessor Scheduling Operating Systems: Internals and Design Principles, 6/E William Stallings Dave Bremer Otago Polytechnic, N.Z. ©2008,
Lecture 4 CPU scheduling. Basic Concepts Single Process  one process at a time Maximum CPU utilization obtained with multiprogramming CPU idle :waiting.
CPU scheduling.  Single Process  one process at a time  Maximum CPU utilization obtained with multiprogramming  CPU idle :waiting time is wasted 2.
1 Module 5: Scheduling CPU Scheduling Scheduling Algorithms Reading: Chapter
Basic Concepts Maximum CPU utilization obtained with multiprogramming
1 Lecture 5: CPU Scheduling Operating System Fall 2006.
Lecturer 5: Process Scheduling Process Scheduling  Criteria & Objectives Types of Scheduling  Long term  Medium term  Short term CPU Scheduling Algorithms.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 5: CPU Scheduling.
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.
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,
CPU SCHEDULING.
Uniprocessor Scheduling
Scheduling (Priority Based)
Operating Systems CPU Scheduling.
Chapter 6: CPU Scheduling
Operating System Concepts
Scheduling 21 May 2019.
Uniprocessor Scheduling
Presentation transcript:

P ROCESSES S CHEDULING Prepared By: Dr. Vipul Vekariya

S CHEDULING An OS must allocate resources amongst competing processes. The resource provided by a processor is execution time The resource is allocated by means of a schedule

S CHEDULING O BJECTIVES The scheduling function should Share time fairly among processes Prevent starvation of a process Use the processor efficiently Have low overhead Prioritise processes when necessary (e.g. real time deadlines)

T YPES OF SCHEDULING Long-Term Scheduling Medium-Term Scheduling Short-Term Scheduling 4

L ONG -T ERM S CHEDULING Determines which programs are admitted to the system for processing May be first-come-first-served Or according to criteria such as priority, I/O requirements or expected execution time Controls the degree of multiprogramming More processes, smaller percentage of time each process is executed

M EDIUM -T ERM S CHEDULING Part of the swapping function Swapping-in decisions are based on the need to manage the degree of multiprogramming

S HORT -T ERM S CHEDULING Known as the dispatcher Executes most frequently Invoked when an event occurs Clock interrupts I/O interrupts Operating system calls Signals

T YPES OF S CHEDULING

S CHEDULING AND P ROCESS S TATE T RANSITIONS

Q UEUING D IAGRAM

Bursts of CPU usage alternate with periods of waiting for I/O. (a) A CPU-bound process. (b) An I/O-bound process. Scheduling – Process Behavior

N ONPREEMPTIVE VS P REMEPTIVE Non-preemptive Once a process is in the running state, it will continue until it terminates or blocks itself for I/O Preemptive Currently running process may be interrupted and moved to ready state by the OS Preemption may occur when new process arrives, on an interrupt, or periodically.

C RITERIA FOR S CHEDULING Fairness : this goal is important under all circumstance. A scheduler makes sure that each process gets its fair share of CPU. Efficiency : scheduler should keep the system, busy all time, when possible. Response time : this measure is the time from the submission of the request till the first response is produced. Waiting time : Amount of time a process spends waiting in ready queue. The waiting time should be minimum. Turnaround time : the interval from the time of submission of the process to the time of completion of the process is the turnaround time. Throughput : is the measure of the work done by the CPU. CPU utilization : CPU utilization can have value in the range of 0 to 100%. 13

P ROCESS S CHEDULING E XAMPLE Example set of processes, consider each a batch job – Service time represents total execution time

F IRST -C OME - F IRST -S ERVED Process are assigned to CPU in the order they came or submitted.

FIFO Also known as F irst C ome, F irst S erved (FCFS), its the simplest scheduling algorithm, FIFO simply queues processes in the order that they arrive in the ready queue.FIFO Since context switches only occur upon process termination, and no reorganization of the process queue is required, scheduling overhead is minimal. Throughput can be low, because long processes can hold the CPU Turnaround time, waiting time and response time can be low for the same reasons above No prioritization occurs, thus this system has trouble meeting process deadlines. The lack of prioritization does permit every process to eventually complete, hence no starvation. 16

G ANTT C HART. ABCDE Waiting timeProcess 0A 3 – 2 = 1B 9 – 4 = 5C 13 – 6 = 7D 18 – 8 = 10E Average waiting time Average waiting time = = 4.6ms

SJF(S HORTEST JOB FIRST ) Also known as S hortest J ob F irst (SJF). With this strategy the scheduler arranges processes with the least estimated processing time remaining to be next in the queue If a shorter process arrives during another process' execution, the currently running process may be interrupted, dividing that process into two separate computing blocks. This creates excess overhead through additional context switching. This algorithm is designed for maximum throughput in most scenarios. Overall waiting time is smaller than FIFO, however since no process has to wait for the termination of the longest process. No particular attention is given to deadlines. Starvation is possible, especially in a busy system with many small processes being run. 18

S HORTEST JOB FIRST It is non preemptive or preemptive kind of algorithm in which waiting job with the smallest estimated runtime to completion run next. 19 Waiting timeProcess 0A 3 – 2=1B 11 – 4 =7C 15 – 6 = 11D 9 – 8 = 1E Average waiting time = /5 = 4ms ABECD

SJF WITH PREEMPTIVE ( SHORTEST R EMAINING NEXT ) 20 Waiting timeProcess 0A 10 – (1+2) =7B 4 – 4 =0C 15 – 6 = 11D 8 – 8 = 0E Average waiting time = /5 = 3.6ms ABCEBD

SJF WITH PREEMPTIVE ( SHORTEST R EMAINING NEXT ) ProcessArrival timeBurst time P108 P214 P329 P Waiting timeprocess (10 -1) =9P1 (1-1)=0P2 (17-2) =15P3 (5-3) =2P4 Average waiting time = /4 = 6.5ms

P RIORITY SCHEDULING ( PREEMPTIVE ) Overhead is not minimal, nor is it significant. It has no particular advantage in terms of throughput over FIFO scheduling. Waiting time and response time depend on the priority of the process. Higher priority processes have smaller waiting and response times. Deadlines can be met by giving processes with deadlines a higher priority. Starvation of lower priority processes is possible with large amounts of high priority processes queuing for CPU time. 22

P RIORITY SCHEDULING. 23 ProcessBurst timePriority P1103 P211 P323 P414 P552 Waiting timeprocess 6P1 0P2 16P3 18P4 1P5 Average waiting time = /5 = 8.2ms

R OUND R OBIN S CHEDULING Specially for time sharing system. A small unit called time slice is defined. It is also called Quantum. The ready queue treated as a circular queue. 24 ProcessBurst time P124 P23 P33

RR S CHEDULE If there is n process in the ready queue and time slice is q, then each process gets of the CPU time in chunks at most q times units. Each process must wait no longer than (n-1)*q times until its next time slice. Context switch is the main problem with this algorithm. Conclusion can be formulated as follows: Setting quantum too short causes too many process switches and lower the CPU efficiency. Setting large quantum may cause poor response to short request. A quantum around msec is good for algorithm 25

R OUND R OBIN SCHEDULE RR scheduling involves extensive overhead, especially with a small time unit. Balanced throughput between FCFS and SJF, shorter jobs are completed faster than in FCFS and longer processes are completed faster than in SJF. Fastest average response time, waiting time is dependent on number of processes. Because of high waiting times, deadlines are rarely met in a pure RR system. Starvation can never occur, since no priority is given. 26

C OMPARISON OF SCHEDULING ALGORITHM 27 Scheduling algorithm CPUCPUUtiliz ation Throughp ut Turnaroun d time Response time DeadlineDeadlineh andling StarvationStarvation free First In First Out Low HighLowNoYes Shortest Job First MediumHighMedium No priority pre- emptive scheduling MediumLowHigh YesNo Round- robin scheduling HighMedium HighNoYes