Chapter 9 Uniprocessor Scheduling

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
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
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 3: CPU Scheduling
Uniprocessor Scheduling Chapter 9. Aim of Scheduling The key to multiprogramming is scheduling Scheduling is done to meet the goals of –Response time.
6/25/2015Page 1 Process Scheduling B.Ramamurthy. 6/25/2015Page 2 Introduction An important aspect of multiprogramming is scheduling. The resources that.
1 Uniprocessor Scheduling Module CPU Scheduling n We concentrate on the problem of scheduling the usage of a single processor among all the existing.
5: CPU-Scheduling1 Jerry Breecher OPERATING SYSTEMS SCHEDULING.
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.
Informationsteknologi Tuesday, October 9, 2007Computer Systems/Operating Systems - Class 141 Today’s class Scheduling.
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.
1 Lecture 10: Uniprocessor Scheduling. 2 CPU Scheduling n The problem: scheduling the usage of a single processor among all the existing processes in.
1Chapter 05, Fall 2008 CPU Scheduling The CPU scheduler (sometimes called the dispatcher or short-term scheduler): Selects a process from the ready queue.
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
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.
10CSE CPU Scheduling Copyrights Lecture Slides adapted from “ Advanced Operating Systems ”, Lecture Notes by Prof. Prof. Daniel Mosse, University Of Pittsburgh,
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Lecture 5 Operating Systems.
Lecture 5: Uniprocessor Scheduling
1 Uniprocessor Scheduling Chapter 9. 2 CPU Scheduling We concentrate on the problem of scheduling the usage of a single processor among all the existing.
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.
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.
1 Uniprocessor Scheduling Chapter 9. 2 CPU Scheduling n We concentrate on the problem of scheduling the usage of a single processor among all the existing.
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.
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.
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 Lecture 5: CPU Scheduling Operating System Fall 2006.
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
CPU Scheduling Chapter 5.
Uniprocessor Scheduling
Uniprocessor scheduling
Operating System Chapter 9. Uniprocessor Scheduling
Chapter 9 Uniprocessor Scheduling
Operating System 9 UNIPROCESSOR SCHEDULING
Chapter 9 Uniprocessor Scheduling
Process Scheduling B.Ramamurthy 2/23/2019.
Process Scheduling B.Ramamurthy 4/11/2019.
Process Scheduling B.Ramamurthy 4/7/2019.
Uniprocessor scheduling
Uniprocessor Scheduling
Uniprocessor Scheduling
Operating Systems Concepts
Presentation transcript:

Chapter 9 Uniprocessor Scheduling Types of Processor Scheduling Scheduling Algorithms

Scheduling An OS must allocate resources amongst competing processes. The resource is allocated by means of scheduling - determines which processes will wait and which will progress. The resource provided by a processor is execution time.

Overall Aim of Scheduling The aim of processor scheduling is to assign processes to be executed by the processor over time, in a way that meets system objectives, such as response time, throughput, and processor efficiency.

Scheduling Objectives 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)

Types of Scheduling

Scheduling and Process State Transitions Long-term scheduling is performed when a new process is created. Medium-term scheduling is a part of the swapping function. Short-term scheduling is the actual decision of which ready process to execute next. Focus of this chapter

Nesting of Scheduling Functions

Queuing Diagram Scheduling is a matter of managing queues to minimize queuing delay and to optimize performance.

Long-Term Scheduling Determines which programs are admitted to the system for processing May be first-come-first-served 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

Medium-Term Scheduling Part of the swapping function Swapping-in decisions are based on the need to manage the degree of multiprogramming the memory requirements of the swapped-out processes

Short-Term Scheduling Short-term scheduler is known as the dispatcher. Executes most frequently to decide which process to execute next Invoked when an event occurs Clock interrupts I/O interrupts Operating system calls

Roadmap Types of Processor Scheduling Scheduling Algorithms

Aim of Short Term Scheduling Main objective is to allocate processor time to optimize certain aspects of system behaviour. A set of criteria is needed to evaluate the scheduling policy.

Short-Term Scheduling Criteria: User vs. System User-oriented Behavior of the system as perceived by individual user or process Example: response time (in an interactive system) Elapsed time between the submission of a request until there is output System-oriented Effective and efficient utilization of the processor Example: throughput Process completion rate

Short-Term Scheduling Criteria: Performance Performance-related Quantitative Easily measured Example: response time and throughput Non-performance related Qualitative Hard to measure Example: predictability

Interdependent Scheduling Criteria More scheduling criteria can be found in Table 9.2. Impossible to optimize all criteria simultaneously. Example: response time vs. throughput Design of a scheduling policy involves compromising among competing requirements.

Priorities In many systems, each process is assigned a priority. Scheduler will always choose a process of higher priority over one of lower priority. Have multiple ready queues to represent each level of priority.

Priority Queuing priority[RQi] > priority[RQj] for i<j; larger priority values represent lower priority processes. The scheduler will start at the highest-priority ready queue.

Starvation Problem Solution Lower-priority processes may suffer starvation if there is a steady supply of high priority processes. Solution Allow a process to change its priority based on its age or execution history.

Alternative Scheduling Policies

Selection Function Determines which process is selected for execution. If based on execution characteristics then important quantities are: w = time spent in system so far, waiting e = time spent in execution so far s = total service time required by the process, including e

Decision Mode Specifies the instants in time at which the selection function is exercised. Two categories: Non-preemptive Preemptive

Non-preemptive vs. Preemptive Once a process is in the running state, it will continue until it terminates or blocks itself for I/O or OS service. 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.

Process Scheduling Example Example set of processes, consider each a batch job Service time (Ts) represents total execution time

First-Come- First-Served (FCFS) Each ready process joins the ready queue. When the current process ceases to execute, the process in the ready queue the longest is selected.

FCFS  A short process may have to wait a very long time before it can execute.  Favors CPU-bound processes (mostly use processor) over I/O-bound processes. I/O processes have to wait until CPU-bound process completes may result in inefficient use of both the processor and the I/O devices

Round Robin (RR)  Reduce penalty that short jobs suffer with FCFS by using clock interrupts generated at periodic intervals. When an interrupt occurs, the currently running process is placed in the ready queue and the next ready job is selected on a FCFS basis. Also known as time slicing because each process is given a slice of time before being preempted.

RR

Effect of Size of Preemption Time Quantum  There is processing over-head involved in handling the clock interrupt and performing the scheduling and dispatching function. The time quantum should be slightly greater than the time required for a typical interaction.

RR  Generally, I/O-bound process has a shorter processor burst (amount of time spent executing between I/O operations) than a CPU-bound process results in poor performance, inefficient use of I/O devices, and an increase in the variance of response time.

Virtual Round Robin A fair approach: similar to RR except processes in the auxiliary queue get preference over those in the main ready queue.

Shortest Process Next (SPN) Non-preemptive policy Process with shortest expected processing time is selected next.  Reduce the bias in favor of long processes in FCFS by allowing short processes jump ahead of longer processes.

SPN  Predictability of longer processes is reduced.  Need to know or estimate the required processing time for each process. Programmers may be required to supply an estimate for batch jobs. Statistics may be gathered for repeating jobs. If estimated processing time is not correct, OS may abort it.

Calculating ‘Burst’ for interactive processes A running average of each “burst” for each process Ti = processor execution time for the ith instance of this process Si = predicted value for the ith instance S1 = predicted value for first instance; not calculated

Exponential Averaging Recent bursts more likely reflect future behavior. A common technique for predicting a future value on the basis of a time series of past values is exponential averaging. where 0 <  < 1

Exponential Smoothing Coefficients The larger the value of , the greater the weight given to the more recent observations.

Use Of Exponential Averaging Exponential averaging tracks changes faster than simple averaging. The larger value of  results in a more rapid reaction to the change.

Shortest Remaining Time (SRT) Preemptive version of SPN: chooses the process with the shortest expected remaining processing time.

SRT  SRT does not have the bias in favor of long processes found in FCFS.  Unlike round robin, no additional interrupts are generated, reducing overhead.  SRT should give superior turnaround time performance to SPN, because a short job is given immediate preference to a running longer job.  Must estimate processing time and record elapsed service time.  A risk of starvation of longer processes.

Highest Response Ratio Next (HRRN) Choose next process with the greatest response ratio, trying to minimize the normalized turnaround time.

HRRN  Shorter jobs are favored (a smaller denominator yields a larger ratio).  Longer processes will eventually get past competing shorter jobs (aging without service also increases the ratio).  As with SRT and SPN, the expected service time must be estimated.

Feedback Scheduling (FB) Penalize jobs that have been running longer by demoting to the next lower-priority queue. Scheduling with preemptive and dynamic priority mechanism.

FB Performance Variations exist, simple version preempts periodically, similar to round robin longer processes may suffer starvation if new jobs are entering the system frequently

Normalized Turnaround Time It is impossible to make definitive comparisons because relative performance will depend on a variety of factors. short processes long processes

Fair-Share Scheduling User’s application runs as a collection of processes (threads). User is concerned about the performance of the application. Fair-share scheduling: Make scheduling decisions based on process sets. The concept can be extended to groups of users.

Fair-Share Scheduling Each user is assigned a weighting that defines that user’s share of system resources. Objective: To give fewer resources to users who have had more than their fair share and more to those who have had less than their fair share.

Fair-Share Scheduler The user community is divided into a set of fair-share groups and a fraction of the processor resource is allocated to each group. For process j in group k, we have CPUj(i)=measure of CPU utilization by process j through interval i GCPUk(i)=measure of CPU utilization of group k through interval i Pj(i)=priority of process j at beginning of interval i; lower values equal higher priorities Basej=base priority of process j Wk=weighting assigned to group k (share of resources) 47

Fair-Share Scheduler Given: W1=W2=0.5 Base1=Base2=Base3=60 The CPU count is incremented 60 times per second Priorities are recalculated once per second