Uniprocessor Scheduling Schemes
Uniprocessor Scheduling Schemes
New
Long-term Long-term
scheduling scheduling
Blocked/
Blocked
Suspend
Medium-term
scheduling
Scheduling Criteria
1. User Oriented scheduling criteria
• Turnaround time This is the interval of time between the
submission of a process and its completion. It includes actual
execution time plus time spent waiting for resources, including
the processor.
Turnaround Time = Finish Time – Arrival time
• Response time This is the time from the submission of a
request until the response begins to be received.
• Waiting time: is the sum of the periods spent waiting in the
ready queue.
2. System Oriented scheduling criteria
• Throughput This is the number of processes completed per unit
of time. It is influenced the average length of a process and the
scheduling policy.
• Processor utilization This is the percentage of time that the
processor is busy.
• Enforcing priorities When processes are assigned priorities,
processes with higher priorities are executed before those with
lower priorities.
Decision modes
The decision mode specifies the time instants at
which the selection function is exercised. There are
two general categories:
– Nonpreemptive: In this case, once a process is
in the Running state, it continues to execute until
(a) it terminates or
(b) it blocks itself to wait for I/O or to request
some operating system service.
– Preemptive: Here, the currently running
process may be interrupted and moved to the
Ready state by the operating system. The
decision to preempt may be performed when a
new process arrives; when an interrupt occurs
that places a blocked process in the Ready state;
or periodically, based on a clock interrupt.
Scheduling Algorithms
Example:
Suppose 5 processes A, B, C, D and E arrive at the times
indicated, and each of them is executed for the amount of time
specified in the table below:
Process Arrival Time Service Time (Ts)
A 0 3
B 2 6
C 4 4
D 6 5
E 8 2
For each of the scheduling schemes we shall cover in this
lecture, we shall determine the following:
(i). the finish time for each process.
(ii). the turnaround time for each process.
(iii). the normalized turnaround time for each process.
(iv). the mean turnaround time for all processes.
(v). the mean normalized turnaround time for all
processes.
Scheduling schemes that we will cover are:
1. First-Come-First-Served (FCFS): A simple
queuing scheme. Also referred to as first-in-
first-out (FIFO).
2. Round-Robin (RR): Scheduling is done on a
preemptive-time-quantum basis.
3. Shortest Process Next (SPN): A non-
preemptive scheme in which the process with
the shortest expected processing time is
selected next.
4. Shortest Remaining Time (SRT): A
preemptive scheme in which the process that
has the shortest expected remaining processing
time is executed next.
5. Highest Response Ratio Next (HRRN): Uses
a response ratio formula to determine the nest
process to execute.
1. First-Come-First-Served (FCFS):
[Also known as first-in-first-out (FIFO) ]
As each process becomes ready, it joins the ready queue. When
the currently running process ceases to execute, the process tha
has been in the ready queue the longest is selected for running.
Example: : Process A B C D E
Arrival Time 0 2 4 6 8
Service Time (Ts) 3 6 4 5 2
First-come-first-served (FCFS)
Process A B C D E Mean
(i). Finish Time 3 9 13 18 20
(ii) & (iv).Turnaround Time (Tr) 3 7 9 12 12 8.60
Round-Robin (RR) q = 4
Process A B C D E Mean
(i). Finish Time 3 17 11 20 19
(ii) & (iv). Turnaround Time (Tr) 3 15 7 14 11 10.00
(iii) & (v). Normalized turnaround time (Tr/Ts):
1.00 2.5 1.75 2.80 5.50 2.71
3. Shortest Process (time) Next (SPN):
This scheduling scheme/algorithm is a non- preemptive policy in
which the process with the shortest expected processing time is
selected next. Thus, a short process will jump to the head of the
queue past longer jobs.
Example: : Process A B C D E
Arrival Time 0 2 4 6 8
Service Time (Ts) 3 6 4 5 2
Example: : Process A B C D E
Arrival Time 0 2 4 6 8
Service Time (Ts) 3 6 4 5 2
SRT
Process A B C D E
Mean
(i). Finish Time 3 15 8 20 10
(ii) & (iv). Turnaround Time (Tr) 3 13 4 14 2
7.20
(iii) & (v). Normalized turnaround time Tr/Ts:
1.00 2.17 1.00 2.80 1.00
5. Highest Response Ratio Next (HRRN):
This scheduling scheme uses the following algorithm: When the
current process completes or is blocked, choose the ready
process with the greatest value of R from the formula:
R = (w + s)/ s
where
R = response ratio
w = time spent waiting for the processor
s = expected service time
Example: : Process A B C D E
Arrival Time 0 2 4 6 8
Service Time (Ts) 3 6 4 5 2