Download presentation
Presentation is loading. Please wait.
1
Uniprocessor Scheduling Chapter 9
2
Aim of Scheduling The key to multiprogramming is scheduling Scheduling is done to meet the goals of –Response time –Throughput –Processor efficiency
3
Tanenbaum Models
5
Types of Scheduling
6
Three Types Long term scheduling: Degree of multiprogramming in the system Medium term scheduling: Disk to memory migration Short term scheduling: Ready to running migration
9
Long-Term Scheduling Determines which programs are admitted to the system for processing Controls the degree of multiprogramming More processes, smaller percentage of time each process is executed
10
Medium-Term Scheduling Part of the swapping function Disk to main memory (swap-in or swap- out) Based on the need to manage the degree of multiprogramming
11
Short-Term Scheduling Known as the dispatcher Executes most frequently Invoked when an event occurs –Clock interrupts –I/O interrupts –Operating system calls –Signals
12
Short-Tem Scheduling Criteria User-oriented –Response Time Elapsed time between the submission of a request until there is output. System-oriented –Effective and efficient utilization of the processor i.e. throughput –Not important on single-user system
13
Short-Term Scheduling Criteria Performance-related –Quantitative –Measurable such as response time and throughput Not performance related –Qualitative –Predictability (The system appears same to the users over a period of time)
14
Priorities Scheduler will always choose a process of higher priority over one of lower priority Have multiple ready queues to represent each level of priority Lower-priority may suffer starvation –allow a process to change its priority based on its age or execution history
16
Decision Mode Nonpreemptive –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 the Ready state by the operating system –More overhead but allows for better service since any one process cannot monopolize the processor for very long
17
Process Scheduling Example
18
First-Come-First-Served (FCFS) Each process joins the Ready queue When the current process ceases to execute, the oldest process in the Ready queue is selected 0 5 101520 A B C D E
19
First-Come-First-Served (FCFS) A short process may have to wait a very long time before it can execute Favors processor bound processes –I/O processes have to wait until processor bound process completes –Then the I/O bound process quickly runs its processor cycle and blocks again for I/O
20
Round-Robin 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 0 5 101520 A B C D E
21
Round-Robin Clock interrupt is 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 Known as time slicing; If slice is short, large overhead in switching tasks If each process runs to completion, RR changes into FCFS To avoid unfair treatment of I/O bound processes, VRR prefers older processes over newer ones
22
Shortest Process Next Nonpreemptive policy to prefer short processes Process with shortest expected processing time is selected next Short process jumps ahead of longer processes 0 5 101520 1 2 3 4 5 ABCDEABCDE
23
Shortest Process Next How to estimate the process length? EWMA is used to estimate duration. It gives more weight to recent burst times 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
24
Shortest Remaining Time Preemptive version of SPN policy Must estimate processing time Similar features as SPN but better turnaround because a short new process is preferred 0 5 101520 1 2 3 4 5 ABCDEABCDE
25
Highest Response Ratio Next (HRRN) Choose next process with the lowest ratio R where R is time spent waiting + expected service time expected service time 1 2 3 4 5 0 5 101520 ABCDEABCDE
26
HRRN When a process is new, waiting time is zero Thus the minimum value of R is 1.0 If the process is short, R is ________? If the process is waiting for long time, R becomes________? Always choose the process with largest R No starvation
27
Feedback Penalize jobs that have been running longer Don’t know remaining time process needs to execute but we know how long the process has executed Every time a process is preempted, it is placed in a lower priority queue 0 5 101520 1 2 3 4 5 ABCDEABCDE
29
Feedback Scheduling All queues run as FCFS except for the lowest priority queue The lowest priority queue runs as RR The feedback scheduling may punish long processes heavily so a variation is suggested that increases the time slice as a process goes down the lower priority queues
30
Fair-Share Scheduling User’s application runs as a collection of processes (threads) User is concerned about the performance of the application If Computer Science students are running a lot of jobs on the server, Math students should not see performance degradation for their jobs We need to make scheduling decisions based on process sets Each user or group is allocated a weight and this weight translates to fair share
32
Traditional UNIX Scheduling (Timeshared Interactive Model) Multilevel feedback using round robin within each of the priority queues Priorities are recomputed once per second (time slice = 1 second) Base priority divides all processes into fixed bands of priority levels Adjustment factor used to keep process in its assigned band
33
Bands Decreasing order of priority –Swapper –Block I/O device control –File manipulation –Character I/O device control –User processes (favoring I/O bound)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.