You are on page 1of 28

OPERATING SYSTEMS

9
Uniprocessor Scheduling
Types of Processor Scheduling
1. Long-Term Scheduling
2. Medium-Term Scheduling
3. Short-Term Scheduling
Scheduling Algorithms
1. Short-Term Scheduling Criteria
2. The Use of Priorities
3. Alternative Scheduling Policies
4. Performance Comparison
5. Fair-Share Scheduling
scheduling
scheduling
• The aim of processor scheduling is to assign processes to be
executed by the processor or processors over time, in a way
that meets system objectives, such as:

1. Response time
2. Throughput
3. processor efficiency.

• In many systems, this scheduling activity is broken down into


three separate functions: long-, medium-, and short-term
scheduling
Types of Processor Scheduling
1. Long-term scheduling
• Long-term scheduling is performed when a new process is
created. This is a decision whether to add a new process to
the set of processes that are currently active.
Types of Processor Scheduling
2. medium-term scheduling
• Medium-term scheduling is a part of the swapping function.
This is a decision whether to add a process to those that are
at least partially in main memory and therefore available for
execution.
Types of Processor Scheduling
3. short-term scheduling
• Short-term scheduling is the actual decision of which ready
process to execute next.
Types of Processor Scheduling
Types of Processor Scheduling
Scheduling queuing diagram
Types of Processor Scheduling
Scheduling criteria
Types of Processor Scheduling
Scheduling criteria
Types of Processor Scheduling
Use of 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

• Lower-priority may suffer starvation.

• Allow a process to change its priority based on its age or


execution history
Types of Processor Scheduling
Use of priority
Types of Processor Scheduling
Alternative Scheduling Policies
• The selection function determines which process, among
ready processes, is selected next for execution.
• The function may be based on priority, resource
requirements, or the execution characteristics of the process.
1. First-Come First Serve (FCFS)
2. Round Robin
3. Shortest Process Next (SPN)
4. Shortest Remaining Time (SRT)
5. Highest Response Ratio Next (HRRN)
6. Feedback
Types of Processor Scheduling
1. First-Come First Serve (FCFS)
• Selection Function: max(waiting time, w)
• Decision Mode: Non-preemptive
• Response Time: May be high, especially if there is a large
variance in process execution times.
• Throughput: Not emphasized

• Starvation: No

• Effect on Processes: Penalizes short processes;


penalizes I/O-bound processes
Types of Processor Scheduling
2. Round robin
• Selection Function: constant
• Decision Mode: Preemptive (at time quantum)
• Response Time: Provides good response time for short
processes.
• Throughput: May be low if quantum is too small

• Starvation: No

• Effect on Processes: Fair treatment


Types of Processor Scheduling
3. Shortest Process Next (SPN)
• Selection Function: min[total service time, s]
• Decision Mode: Non-preemptive
• Response Time: Provides good response time for short
processes.
• Throughput: High

• Starvation: Possible

• Effect on Processes: Penalizes long processes


min[ s−e ]
Types of Processor Scheduling
4. Shortest Remaining Time (SRT)
• Selection Function: min[total service time, s- time spent
in execution so far, s]- min(s-e)
• Decision Mode: Preemptive (at arrival)
• Response Time: Provides good response time.
• Throughput: High

• Starvation: Possible

• Effect on Processes: Penalizes long processes


Types of Processor Scheduling
5. Highest Response Ratio Next (HRRN)
• Selection Function: max (w+ss)
• Decision Mode: Non-preemptive
• Response Time: Provides good response time
• Throughput: High

• Starvation: Possible

• Effect on Processes: Good balance


Types of Processor Scheduling
Process Scheduling Example
Types of Processor Scheduling
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
Types of Processor Scheduling

Round-robin q=1(rr)

• 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
Types of Processor Scheduling

Shortest process next (spn)

• Non-preemptive policy
• Process with shortest expected processing time is selected
next
• Short process jumps ahead of longer processes
Types of Processor Scheduling

Shortest remaining time (srt)

• Preemptive version of shortest process next policy


• Must estimate processing time
Types of Processor Scheduling

Highest Response Ratio Next (HRRN)


Types of Processor Scheduling

Feedback (fb)

• Penalize jobs that have been running longer


• Don’t know remaining time process needs to
execute
Types of Processor Scheduling

Feedback (fb)

You might also like