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
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.
6/25/2015Page 1 Process Scheduling B.Ramamurthy. 6/25/2015Page 2 Introduction An important aspect of multiprogramming is scheduling. The resources that.
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.
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,
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 6 CPU SCHEDULING.
Chapter 9 Uniprocessor Scheduling Seventh Edition By William Stallings Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice Hall Operating Systems: Internals.
Scheduling. Alternating Sequence of CPU And I/O Bursts.
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.
Fall 2000M.B. Ibáñez Lecture 11 Uniprocessor Scheduling.
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.
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.
Lecturer 5: Process Scheduling Process Scheduling  Criteria & Objectives Types of Scheduling  Long term  Medium term  Short term CPU 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
Chapter 2.2 : Process Scheduling
Operating Systems CPU Scheduling.
Chapter 6: CPU Scheduling
OverView of Scheduling
Uniprocessor 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
Presentation transcript:

Uniprocessor Scheduling Chapter 9

Aim of Processor Scheduling Aim: is to assign processes to be executed by the processor or processors over time to meet system objectives. System objectives: Low response time RT: Time elapse from the submission of a request to the beginning of the response. High Throughput Throughput: Number of processes completed per unit time Processor efficiency High processor utilization (min processor idle time)

Types of Scheduling Long-term scheduling Medium-term scheduling The decision to add to the pool of processes to be executed. Medium-term scheduling The decision to add to the number of processes that are partially or fully in main memory. Short-term scheduling The decision as to which available process will be executed by the processor. I/O scheduling The decision as to which process’s pending I/O request shall be handled by an available I/O device.

Types of Processor Scheduling

Long-Term Scheduling Determines which programs are admitted to the system for processing Controls the degree of multiprogramming If more processes are admitted, smaller percentage of time each process is executed, i.e more processes are competing for the same amount of processor time.

Long-Term Scheduling… The long term scheduler may limit the degree of multiprogramming to provide satisfactory service to the current set of processes. The decision as to which job to admit next can be on a simple first-come-first-serve basis or it can be a tool to manage system performance.

Long-Term Scheduling… The criteria used may include priority, expected execution time, and I/O requirements. For interactive programs in a time sharing system, a process request can be generated by the act of user attempting to connect to the system.

Long-Term Scheduling… OS will accept all authorized users until the system is saturated (used some predefined measure of saturation). At this point, a connection request is met with a message indicating that the system is full and the user should try again later.

Medium-Term Scheduling Part of the swapping function Based on the need to manage the degree of multiprogramming Done by memory management software.

Short-Term Scheduling Short term scheduler known as the dispatcher Executes most frequently and makes decision of which process to execute next. Short term scheduler is invoked when an event occurs that may lead to the suspension of the current process or preempt currently running process in favor of another.

Short-Term Scheduling… Examples of such event: Clock interrupts I/O interrupts Operating system calls Signals

Scheduling Algorithms Topic covered: Short-Term Scheduling Criteria The Use of Priorities Alternative Scheduling Policies

Short-Tem Scheduling Criteria Main objective  to allocate processor time to optimize one or more aspect on system behavior. A set of criteria is established against which various scheduling policies may be evaluated. The criteria can be categorized along two dimensions: User-oriented and System-oriented. Performance related and Not performance related.

Short-Tem Scheduling Criteria User-oriented Relate to the behavior of the system as perceived by individual user or process Examples: Response Time in an interactive system RT: Elapsed time between the submission of a request until the response begins to appear as output. Scheduling policy must provide a good service to the various users. For RT, a threshold maybe define e.g. 2 seconds, then the goal of the scheduling mechanism should be to maximize the number of users who experience and average response time of 2 second or less.

Short-Tem Scheduling Criteria System-oriented Effective and efficient utilization of the processor Example: Throughput Number of process completed per time.

Short-Term Scheduling Criteria Performance-related Quantitative and generally can be measured Measurable such as response time and throughput Not performance related Qualitative and do not lend to themselves readily to measurement and analysis An example is predictability #Table 9.2 summarizes key scheduling criteria.

Priorities Implemented by having a multiple ready queues to represent each level of priority (Figure 9.4) Scheduler will always choose a process of higher priority over one of lower priority Lower-priority may suffer starvation Then allow a process to change its priority based on its age or execution history

Alternative Scheduling Algorithms Table 9.3 summarize the information about the various scheduling algorithms. Selection function: determine which process among ready process (in Ready Queue) is selected for next execution. the function may be based on priority, resource requirements, or the execution characteristics of the process.

Alternative Scheduling Algorithms Decision mode: Specifies the instant in time at which the selection function is exercised Two general categories: Nonpreemptive Once a process is in the running state, it will continue until (a) it terminates or (b) blocks itself for I/O or request OS services. Preemptive Currently running process may be interrupted and moved to the Ready state by the OS.

Scheduling Algorithms Types of scheduling algorithms: First Come First Serve (FCFS) Shortest Process Next (SPN) Shortest Remaining Time (SRT) Round Robin Highest Response Ratio Next Feedback Draw the diagram Calculate the waiting time (WT) and average waiting time (AWT).

Process Scheduling Example Arrival Time Service Time A 3 B 2 6 C 4 D 5 E 8

First-Come-First-Served (FCFS) Each process arrive will join the Ready queue Selection Function: the process that has been waiting the longest in the ready queue, i.e the oldest process in the Ready queue is selected 5 10 15 20 A B C D E

First-Come-First-Served (FCFS) Decision Mode: Non-preemptive A short process may have to wait a very long time before it can execute. A process that does not perform any I/O will monopolize the processor Favors CPU-bound processes I/O processes have to wait until CPU-bound process completes

First-Come-First-Served (FCFS) Waiting time = start execution time – arrival time Process A  0 – 0 = 0 Process B  3 – 2 = 1 Process C  9 – 4 = 5 Process D  13 – 6 = 7 Process E  18 – 8 = 10 Average Waiting Time = Total waiting time Number of processes = 0+1+5+7+10 5 = 4.6ms

Shortest Process Next Selection function: the process with the shortest expected CPU burst time. Decision Mode: Nonpreemptive 5 10 15 20 A B C D E

Shortest Process Next Process with shortest expected processing time is selected next Short process jumps ahead of longer processes 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 Process Next Calculate the WT and AWT!!

Shortest Remaining Time Selection function: the process with the shortest remaining time. Decision Mode: Preemptive version of shortest process next policy 5 10 15 20 A B C D E

Shortest Remaining Time Higher overhead than SPN Must estimate processing time Small processes will run almost immediately but longer jobs have an even longer waiting time and variant of waiting time that in SPN.

Shortest Remaining Time Calculate the WT and AWT!!

Round-Robin Selection function: same as FCFS Decision Mode: Preemptive 5 10 15 20 A B C D E Time quantum = 1 unit Selection function: same as FCFS Decision Mode: Preemptive Uses preemption based on a clock An amount of time is determined that allows each process to use the processor for that length of time

Round-Robin Clock interrupt is generated at periodic intervals When an interrupt occurs, the currently running process is placed in the ready queue Next ready job is selected Known as time slicing

Round-Robin Calculate the WT and AWT!!

Highest Response Ratio Next (HRRN) Selection Function: Choose next process with the highest ratio. Ratio = 5 10 15 20 A B C D E time spent waiting + expected service time expected service time

Highest Response Ratio Next (HRRN) Decision mode: Non-Preemptive This approach is attractive because it accounts the age of the process. While shorter jobs are favored, aging without service increases the ratio so that a longer process will eventually get past competing shorter jobs. Expected service time must be estimated to use HRRN.

Highest Response Ratio Next (HRRN) Calculate the WT and AWT!!

Feedback Decision mode: Preemptive (time quantum basis) Used dynamic priority mechanism. 5 10 15 20 A B C D E Time quantum = 1 unit for all Ready Queue

Feedback When a process first enters the system, it is placed in RQ0 (Figure 9.4). After its first execution, when it returns to the Ready state, it is placed in RQ1. Each subsequent time that it is preempted, it demoted to the next lower-priority queue. Penalize jobs that have been running longer Don’t know remaining time process needs to execute

Feedback A shorter process will complete quickly, without migrating very far down the hierarchy process. A longer process will gradually drift downward. Newer shorter processes are favored over older, longer processes. Within each queue, except the lowest priority queue, a simple FCFS mechanism is used.

Feedback In lowest priority queue, a process cannot go lower, but it is returned to this queue repeatedly until it completes execution, it will treated in round robin fashion. Figure 9.10 illustrates the feedback scheduling mechanism by showing the path that a process will follow through the various queues

Feedback Calculate the WT and AWT!!

Scheduling Criteria Different scheduling algorithm have different properties and may favor one class of processes over another. Many criteria have been suggested for comparing Short-Term scheduling algorithms. The characteristics used for comparison can make substantial difference in the determination of the best algorithm.

Scheduling Criteria The criteria are: CPU utilization – keep CPU as busy as possible. Throughput – number of processes that complete their execution per time unit. Turnaround time – amount of time to execute a particular process. Waiting time – amount of time a process has been waiting in the ready queue Response time – amount of time it takes from when a request was submitted until the first response is produced, not output (for time-sharing environment)

Optimization Criteria Max CPU utilization Max throughput Min turnaround time Min waiting time Min response time