INTRO TO PROCESS SCHEDULING Module 2.4 COP4600 – Operating Systems Richard Newman.

Slides:



Advertisements
Similar presentations
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.
Advertisements

Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 5: CPU Scheduling.
Chapter 5 CPU Scheduling. CPU Scheduling Topics: Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling.
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
Operating Systems 1 K. Salah Module 2.1: CPU Scheduling Scheduling Types Scheduling Criteria Scheduling Algorithms Performance Evaluation.
CS444/CS544 Operating Systems Scheduling 1/31/2007 Prof. Searleman
Scheduling in Batch Systems
CS 3013 & CS 502 Summer 2006 Scheduling1 The art and science of allocating the CPU and other resources to processes.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
Chapter 2 Processes and Threads Scheduling Classical Problems.
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
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.
Uniprocessor Scheduling
CPU Scheduling Chapter 6 Chapter 6.
Chapter 6: CPU Scheduling
Lecture 5: Uniprocessor Scheduling
Chapter 6 CPU SCHEDULING.
More Scheduling cs550 Operating Systems David Monismith.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
Scheduling. Alternating Sequence of CPU And I/O Bursts.
CPU Scheduling CSCI 444/544 Operating Systems Fall 2008.
Silberschatz and Galvin  Operating System Concepts Module 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor.
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.
Process A program in execution. But, What does it mean to be “in execution”?
2.5 Scheduling Given a multiprogramming system. Given a multiprogramming system. Many times when more than 1 process is waiting for the CPU (in the ready.
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: CPU Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 5: CPU Scheduling Basic Concepts Scheduling Criteria.
Uniprocessor Scheduling Chapter 9. Processor Scheduling Processor scheduling determines the assignment of processes to be executed by the processor over.
Chapter 5: Process Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Basic Concepts Maximum CPU utilization can be obtained.
Operating Systems 1 K. Salah Module 2.2: CPU Scheduling Scheduling Types Scheduling Criteria Scheduling Algorithms Performance Evaluation.
1 11/29/2015 Chapter 6: CPU Scheduling l Basic Concepts l Scheduling Criteria l Scheduling Algorithms l Multiple-Processor Scheduling l Real-Time Scheduling.
ITFN 2601 Introduction to Operating Systems Lecture 4 Scheduling.
2.5 Scheduling. Given a multiprogramming system, there are many times when more than 1 process is waiting for the CPU (in the ready queue). Given a multiprogramming.
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.
6.1 CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation.
CSC 322 Operating Systems Concepts Lecture - 10: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
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.
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.
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.
Chapter 2 Scheduling.
Scheduling in Interactive Systems
Batch Scheduling Algorithms
Chapter 6: CPU Scheduling
Uniprocessor scheduling
Scheduling 21 May 2019.
CPU Scheduling.
CPU Scheduling: Basic Concepts
Chapter 5: CPU Scheduling
Presentation transcript:

INTRO TO PROCESS SCHEDULING Module 2.4 COP4600 – Operating Systems Richard Newman

Tanenbaum & Bos, Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved. NEED FOR PROCESS SCHEDULING Figure Bursts of CPU usage alternate with periods of waiting for I/O. (a) A CPU-bound process. (b) An I/O-bound process. For good resource utilization, want to overlap I/O of on process with CPU burst of another process Recall process behavior...

MULTIPROGRAMMING For good resource utilization, want to overlap I/O of on process with CPU burst of another process

Assume jobs independent Probability of p a process is doing I/O Degree of multiprogramming is n (# processes) Probability of p n all n processes are doing I/O Probability that CPU is idle is p n CPU utilization is 1 - p n QUICK AND DIRTY MODEL

Figure 2-6. CPU utilization as a function of the number of processes in memory. Tanenbaum & Bos, Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved. MODELING MULTIPROGRAMMING

QUICK AND DIRTY MODEL Are we overestimating or underestimating CPU utilization?

Figure Three-level scheduling. Long-term Short-term Medium-term THREE LEVEL SCHEDULING Tanenbaum & Bos, Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved. Do we have room for another? Processes in RAM contending for CPU Who gets CPU next? Is RAM over-subscribed?

Long-term (admission) scheduler: Has list of jobs waiting to be scheduled Decides whether to run a job on system Medium-term (memory) scheduler: Has set of currently running jobs and set of jobs that have been swapped out of memory Decides whether to swap a job in or out Short-term (CPU) scheduler: Has set of currently ready/running processes Decides which ready process to run next THREE TYPES OF SCHEDULER

Main goal for long-term (admission) scheduler: Get good mix of jobs in RAM Main goal for medium-term (memory) scheduler: Prevent thrashing (more on this later) Main goals for short-term (CPU) scheduler: Be efficient and fair All share goals of: Maximizing resource utilization Giving best service to clients Enforcing system policies THREE LEVEL SCHEDULING

Goal: Get good mix of jobs in RAM Need to predict job needs and behavior User-supplied (in job control information) Learned (same job run many times) Constraints: Memory – is there room to run the job? CPU cycles – what is CPU utilization? Other resources – does job need devices? More on these in memory management… ADMISSION SCHEDULER

Goal: Prevent thrashing (memory oversubscribed) Deals with demand paging/segmentation systems Detects problem by I/O vs. CPU utilization Constraints: Memory allocations to processes More on these in memory management… MEMORY SCHEDULER

Goals: Depend on type of system Information Externally provided info (e.g., priority) History of process kept by system Constraints: Any ready process may be selected But CPU scheduler runs often, so must be fast! CPU SCHEDULER

CPU scheduling is absolutely required: 1. When a process exits. 2. When a process blocks on I/O, or a semaphore. i.e. - when the running process can no longer run! CPU scheduling usually done (though not absolutely required): 1. When a new process is created. 2. When an I/O interrupt occurs. 3. When a clock interrupt occurs. i.e., when another process has higher priority WHEN TO SCHEDULE CPU Tanenbaum & Bos, Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.

CATEGORIES OF SCHEDULING ALGORITHMS By job type, hence goals 1.Batch 2.Interactive 3.Real time Tanenbaum & Bos, Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved. By when run 1.Non-Preemptive 2.Preemptive

Figure Some goals of the scheduling algorithm under different circumstances. Tanenbaum & Bos, Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved. SCHEDULING ALGORITHM GOALS

Criteria for deciding which process to choose: How long has it been since the process was swapped in or out? How much CPU time has the process had recently? How big is the process? (Small ones do not get in the way.) How important is the process? SCHEDULING DECISION CRITERIA Tanenbaum & Bos, Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.

Turn-around time = Finish time – arrival time includes time spent waiting for CPU Mean Turn-around Time (MTT) Average TT over all jobs Fairness – various measures, including maximum difference in fraction of time each job got CPU over some period Makespan = Finish time of last job – start time for set of jobs Used for multiprocessor scheduling Realtime deadlines met – (prob) for RTS systems SCHEDULING ALGORITHM MEASURES

A B C A takes 9 units of time if run by itself B takes 4 units of time if run by itself C takes 3 units of time if run by itself A B C A arrives at time 0 B arrives at time 1 C arrives at time 2 A running TT(A) = A arrives at time 0 A gets CPU CPU time Arrival time Schedule A B C B waiting C waiting B arrives at time 1 B must wait C arrives at time 2 C must wait B running C runs A finishes at time 9 Now B or C can run C finishes at time 12 Now B can run B finishes at time 16 All done! TT(B) =9 – 0 =9TT(C) =16 – 1 =1512 – 2 = ( )/3=MTT= 10 34/3 TURN-AROUND TIME

Non-preemptive algorithms: Running job must give up CPU/system voluntarily (system retains right/ability to terminate) First-Come First-Serve (FCFS): Jobs run in order of arrival Shortest Job First (SJF): Ready job that will finish first is run first Priority Ready job with highest priority is run first Optimal (Crystal Ball) Uses future knowledge of arrivals to optimize SCHEDULING ALGORITHMS

Preemptive algorithms: Running job may be forced to give up CPU/system involuntarily Round Robin (RR): Jobs run in order of arrival, with maximum quantum (go to end of queue if preempted) Shortest Remaining Time First (SRTF): Ready job that will finish first is run first Preemptive Priority: Ready job with highest priority is run first CTSS: Attempts to approximate SRTF SCHEDULING ALGORITHMS

Need for scheduling Keep resources utilized, meet timing goals, etc. Three-level scheduling Long-term admission scheduler Medium-term memory scheduler Short-term CPU scheduler Scheduling algorithm types & goals By job type: batch, interactive, real-time By when run: preemptive, non-preemptive Schedule metrics SUMMARY