Process Scheduling
Mrs. PVS Lakshmi Jagadamba
Associate Professor
Department of CSE
School of Engineering
GVP College For Degree & PG Courses (Technical Campus)
Rushikonda, Visakhapatnam.
Process Management
P.V.S. Lakshmi Jagadamba
Objectives
To introduce CPU scheduling, which is the basis for multi
programmed operating systems
To describe various CPU-scheduling algorithms
To discuss evaluation criteria for selecting a CPU-
scheduling algorithm for a particular system
Process Management
P.V.S. Lakshmi Jagadamba
Scheduling Concepts
Multiprogramming
A number of programs can be in memory
at the same time. Allows overlap of CPU
and I/O.
Jobs
(batch) are programs that run without
user interaction.
User
(time shared) are programs that may have
user interaction.
Process
is the common name for both.
CPU - I/O burst cycle
Characterizes process execution, which
alternates, between CPU and I/O activity.
CPU times are generally much shorter
than I/O times.
Preemptive Scheduling An interrupt causes currently running
process to give up the CPU and be
replaced by another process.
Process Management
P.V.S. Lakshmi Jagadamba
Scheduling Behavior
Most Processes Dont Use Up Their Scheduling Quantum!
CPU bursts tend to have a frequency curve similar to the exponential curve
shown above. It is characterized by a large number of short CPU bursts and a
small number of long CPU bursts. An I/O-bound program typically has many
short CPU bursts; a CPU-bound program might have a few long CPU bursts.
Process Management
P.V.S. Lakshmi Jagadamba
CPU Scheduler
The CPU scheduler selects from among the processes in memory that are ready to execute and
allocates the CPU to one of them
CPU scheduling is affected by the following set of circumstances:
1. (N) A process switches from running to waiting state
2. (P) A process switches from running to ready state
3. (P) A process switches from waiting to ready state
4. (N) A processes switches from running to terminated state
Circumstances 1 and 4 are non-preemptive; they offer no schedule choice
Circumstances 2 and 3 are pre-emptive; they can be scheduled
Process Management
P.V.S. Lakshmi Jagadamba
The Dispatcher
Dispatcher module gives control of the CPU to the process selected by the short-
term scheduler; this involves:
switching
context
switching
to user mode
jumping
to the proper location in the user program to restart that program
Dispatch latency time it takes for the dispatcher to stop one process and start
another running
Process Management
P.V.S. Lakshmi Jagadamba
Process Scheduling
Maximize CPU use, quickly switch processes onto CPU
for time sharing
Process scheduler selects among available processes for
next execution on CPU
Maintains scheduling queues of processes
Job queue set of all processes in the system
Ready queue set of all processes residing in main
memory, ready and waiting to execute
Device queues set of processes waiting for an I/O
device
Processes migrate among the various queues
Process Management
P.V.S. Lakshmi Jagadamba
Ready Queue And Various I/O Device Queues
Process Management
P.V.S. Lakshmi Jagadamba
Representation of Process Scheduling
Queueing diagram represents queues, resources, flows
Process Management
P.V.S. Lakshmi Jagadamba
Schedulers
Long-term scheduler (or job scheduler or scheduling in Batch Systems)
selects which processes should be brought into the ready queue
Short-term scheduler (or CPU scheduler or scheduling in Interactive
Systems) selects which process should be executed next and allocates CPU
Sometimes the only scheduler in a system
Short-term scheduler is invoked very frequently (milliseconds) (must be fast)
Long-term scheduler is invoked very infrequently (seconds, minutes) (may be
slow)
The long-term scheduler controls the degree of multiprogramming
Processes can be described as either:
I/O-bound process spends more time doing I/O than computations, many
short CPU bursts
CPU-bound process spends more time doing computations; few very long
CPU bursts
Long-term scheduler strives for good process mix
Process Management
P.V.S. Lakshmi Jagadamba
Addition of Medium Term Scheduling
Medium-term scheduler can be added if degree of multiple programming needs to decrease
Process Management
Remove process from memory, store on disk, bring back in from disk to continue execution:
swapping
P.V.S. Lakshmi Jagadamba
Classification of Scheduling Activity
Long-term: which process to admit?
Medium-term: which process to swap in or out?
Short-term: which ready process to execute next?
Process Management
P.V.S. Lakshmi Jagadamba
Queuing Diagram for Scheduling
Process Management
P.V.S. Lakshmi Jagadamba
Long-Term Scheduling
Determines which programs are admitted to the system for processing
Controls the degree of multiprogramming
Attempts to keep a balanced mix of processor-bound and I/O-bound
processes
CPU usage
System performance
Process Management
P.V.S. Lakshmi Jagadamba
Medium-Term Scheduling
Makes swapping decisions based on the current degree of
multiprogramming
Controls which remains resident in memory and which jobs
must be swapped out to reduce degree of multiprogramming
Process Management
P.V.S. Lakshmi Jagadamba
Short-Term Scheduling
Selects from among ready processes in memory which one is to execute next
The selected process is allocated the CPU
It is invoked on events that may lead to choose another process for execution:
Process Management
Clock interrupts
I/O interrupts
Operating system calls and traps
Signals
P.V.S. Lakshmi Jagadamba
Characterization of Scheduling Policies
The selection function determines which ready process is selected
next for execution
The decision mode specifies the instants in time the selection
function is exercised
Nonpreemptive
Once
a process is in the running state, it will continue until it
terminates or blocks for an I/O
Preemptive
Currently
running process may be interrupted and moved to the
Ready state by the OS
Prevents
Process Management
one process from monopolizing the processor
P.V.S. Lakshmi Jagadamba
Short-Tem Scheduling Criteria
User-oriented criteria
Response Time: Elapsed time between the submission of a
request and the receipt of a response
Turnaround Time: Elapsed time between the submission of a
process to its completion
System-oriented criteria
Processor utilization
Throughput: number of process completed per unit time
fairness
Process Management
P.V.S. Lakshmi Jagadamba
Scheduling Criteria
Different CPU scheduling algorithms have different properties
The choice of a particular algorithm may favor one class of processes over
another
In choosing which algorithm to use, the properties of the various algorithms
should be considered
Criteria for comparing CPU scheduling algorithms may include the following
CPU utilization percent of time that the CPU is busy executing a process
Throughput number of processes that are completed per time unit
Response time amount of time it takes from when a request was
submitted until the first response occurs (but not the time it takes to output
the entire response)
Waiting time the amount of time before a process starts after first
entering the ready queue (or the sum of the amount of time a process has
spent waiting in the ready queue)
Turnaround time amount of time to execute a particular process from
the time of submission through the time of completion
Process Management
P.V.S. Lakshmi Jagadamba
Optimization Criteria
It is desirable to
Maximize CPU utilization
Maximize throughput
Minimize turnaround time
Minimize start time
Minimize waiting time
Minimize response time
In most cases, we strive to optimize the average measure of each metric
In other cases, it is more important to optimize the minimum or
maximum values rather than the average
Process Management
P.V.S. Lakshmi Jagadamba
Scheduling: high-level goals
Interleave the execution of processes to maximize CPU
utilization while providing reasonable response time
The scheduler determines:
o
Who will run
When it will run
For how long
Process Management
P.V.S. Lakshmi Jagadamba
Criteria by system type
Process Management
P.V.S. Lakshmi Jagadamba
Categories of Scheduling Algorithms
Based on number of processes to be scheduled
Process Management
Batch Systems:
First Come First Served (FCFS)
Shortest Job First (SJF)
Shortest Remaining Time Next (SRTN)
Interactive Systems:
Round Robin (RR)
Priority
Multi level Queue
Multi level feedback queue
Shortest Process Next
Guaranteed Scheduling
Lottery Scheduling
Fair-Share Scheduling
P.V.S. Lakshmi Jagadamba
Categories of Scheduling Algorithms
Based on number of processors used
Single Processor Scheduling:
First Come First Served (FCFS)
Shortest Job First (SJF)
Shortest Remaining Time Next (SRTN)
Round Robin (RR)
Priority
Multi level Queue
Multi level feedback queue
Multiple processor scheduling:
Asymmetric
Symmetric
Process Management
P.V.S. Lakshmi Jagadamba
First Come, First Served (FCFS)
Scheduling
Process Management
P.V.S. Lakshmi Jagadamba
First-Come, First-Served (FCFS) Scheduling
Process
Burst Time
P1
24
P2
P3
Suppose that the processes arrive in the order: P1 , P2 , P3
The
Gantt
Chart
for
P1
the
P2
24
schedule
is:
P3
27
30
Waiting time for P1 = 0; P2 = 24; P3 = 27
Average waiting time: (0 + 24 + 27)/3 = 17
Average turn-around time:
Process Management
(24 + 27 + 30)/3 = 27
P.V.S. Lakshmi Jagadamba
FCFS Scheduling (Cont.)
Case #2: Suppose that the processes arrive in the order:
P2 , P3 , P1
The
Gantt
chart
P2
for
P3
the
schedule
P1
30
Waiting time for P1 = 6; P2 = 0; P3 = 3
Average waiting time: (6 + 0 + 3)/3 = 3
Average turn-around time:
Process Management
(3 + 6 + 30)/3 = 13
P.V.S. Lakshmi Jagadamba
is:
FCFS Scheduling (Cont.)
Case #1 is an example of the convoy effect; all the other processes wait for
one long-running process to finish using the CPU
This problem results in lower CPU and device utilization; Case #2 shows
that higher utilization might be possible if the short processes were
allowed to run first
The FCFS scheduling algorithm is non-preemptive
Once the CPU has been allocated to a process, that process keeps the
CPU until it releases it either by terminating or by requesting I/O
It is a troublesome algorithm for time-sharing systems
Process Management
P.V.S. Lakshmi Jagadamba
First Come First Served (FCFS)
Selection function: the process that has been waiting the longest in
the ready queue (hence, FCFS)
Decision mode: non-preemptive
Process Management
a process runs until it blocks for an I/O
P.V.S. Lakshmi Jagadamba
FCFS drawbacks
Favors CPU-bound processes
A CPU-bound process monopolizes the processor
I/O-bound processes have to wait until completion of CPUbound process
I/O-bound
processes may have to wait even after their I/Os are
completed (poor device utilization)
Process Management
Better I/O device utilization could be achieved if I/O bound
processes had higher priority
P.V.S. Lakshmi Jagadamba
Shortest Job First (SJF) Scheduling
Process Management
P.V.S. Lakshmi Jagadamba
Shortest-Job-First (SJF) Scheduling
The SJF algorithm associates with each process the length of its next CPU burst
When the CPU becomes available, it is assigned to the process that has the smallest
next CPU burst (in the case of matching bursts, FCFS is used)
SJF is optimal gives minimum average waiting time for a given set of processes
The difficulty is knowing the length of the next CPU request
Could ask the user
Two schemes:
Nonpreemptive once the CPU is given to the process, it cannot be preempted
until it completes its CPU burst
Preemptive if a new process arrives with a CPU burst length less than the
remaining time of the current executing process, preempt. This scheme is know as
the Shortest-Remaining-Time-Next (SRTN)
Process Management
P.V.S. Lakshmi Jagadamba
Non-Preemptive SJF (simultaneous arrival)
ProcessArrival Time
Burst Time
P1
0.0
P2
0.0
P3
0.0
P4
0.0
SJF (non-preemptive, simultaneous arrival)
P3
0 1
P2
P4
5
P1
10
16
Average waiting time = (0 + 1 + 5 + 10)/4 = 4
Average turn-around time = (1 + 5 + 10 + 16)/4 = 8
Process Management
P.V.S. Lakshmi Jagadamba
Non-Preemptive SJF (varied arrival times)
ProcessArrival Time
Burst Time
P1
0.0
P2
2.0
P3
4.0
P4
5.0
SJF (non-preemptive, varied arrival times)
P1
P3
P2
0
3
7
8
12
Average waiting time
= ( (0 0) + (8 2) + (7 4) + (12 5) )/4
= (0 + 6 + 3 + 7)/4 = 4
P4
16
Average turn-around time:
= ( (7 0) + (12 2) + (8 - 4) + (16 5))/4
= ( 7 + 10 + 4 + 11)/4 = 8
Waiting time : sum of time that a process has spent waiting in the ready queue
Process Management
P.V.S. Lakshmi Jagadamba
Preemptive SJF (Shortest-remaining-timeNext)
ProcessArrival Time
Burst Time
P1
0.0
P2
2.0
P3
4.0
P4
5.0
SJF (preemptive, varied arrival times)
P1
P2
P3
P2
P4
P1
16
0
11
2
4
5
7
Average waiting time
= ( [(0 0) + (11 - 2)] + [(2 2) + (5 4)] + (4 - 4) + (7 5) )/4
= 9 + 1 + 0 + 2)/4
=3
Average turn-around time = (16 + 7 + 5 + 11)/4 = 9.75
Waiting time : sum of time that a process has spent waiting in the ready queue
Process Management
P.V.S. Lakshmi Jagadamba
Priority Scheduling
Process Management
P.V.S. Lakshmi Jagadamba
Priority Scheduling
The SJF algorithm is a special case of the general priority scheduling algorithm
A priority number (integer) is associated with each process
The CPU is allocated to the process with the highest priority (smallest integer = highest
priority)
Priority scheduling can be either preemptive or non-preemptive
A preemptive approach will preempt the CPU if the priority of the newly-arrived
process is higher than the priority of the currently running process
A non-preemptive approach will simply put the new process (with the highest
priority) at the head of the ready queue
SJF is a priority scheduling algorithm where priority is the predicted next CPU burst
time
The main problem with priority scheduling is starvation, that is, low priority processes
may never execute
A solution is aging; as time progresses, the priority of a process in the ready queue is
increased
Process Management
P.V.S. Lakshmi Jagadamba
Example of Priority Scheduling
ProcessAarri Burst TimeT
Priority
P1
10
P2
P3
P4
P5
Priority scheduling Gantt Chart
P1
P5
P2
1
Average waiting time = 8.2 msec
P3
16
P4
18
19
Average Turn around time = 10 msec
Process Management
P.V.S. Lakshmi Jagadamba
Round Robin (RR) Scheduling
Process Management
P.V.S. Lakshmi Jagadamba
Round Robin (RR)
Each process gets a small unit of CPU time (time quantum q),
usually 10-100 milliseconds. After this time has elapsed, the
process is preempted and added to the end of the ready queue.
If there are n processes in the ready queue and the time quantum
is q, then each process gets 1/n of the CPU time in chunks of at
most q time units at once. No process waits more than (n-1)q
time units.
Timer interrupts every quantum to schedule next process
Performance
q large FIFO
q small q must be large with respect to context switch,
otherwise overhead is too high
Process Management
P.V.S. Lakshmi Jagadamba
Example of RR with Time Quantum = 20
Process
Burst Time
P1
53
P2
P3
17
68
P4
24
The Gantt chart is:
P1
0
20
P2
37
P3
57
P4
P1
77
P3
97
117
P4
P1
P3
P3
121 134 154 162
Typically, higher average turnaround than SJF, but better response time
Average waiting time
= ( [(0 0) + (77 - 20) + (121 97)] + (20 0) + [(37 0) + (97 - 57) + (134 117)]
+ [(57 0) + (117 77)] ) / 4
= (0 + 57 + 24) + 20 + (37 + 40 + 17) + (57 + 40) ) / 4
= (81 + 20 + 94 + 97)/4
= 292 / 4 = 73
Average turn-around time = 134 + 37 + 162 + 121) / 4 = 113.5
Process Management
P.V.S. Lakshmi Jagadamba
Round Robin SCHEDULING
EXAMPLE DATA:
Process
Arrival
Time
1
2
3
4
0
1
2
3
Note:
Example violates rules for quantum
size since most processes dont
finish in one quantum.
Service
Time
8
4
9
5
Round Robin, quantum = 4, no priority-based preemption
P1
P2
P3
P4
12
P1
16
P3
20
P4
24
P3
25
Average wait = ( (20-0) + (8-1) + (26-2) + (25-3) )/4 = 74/4 = 18.5
Process Management
P.V.S. Lakshmi Jagadamba
26
Time Quantum and Context Switch Time
Process Management
P.V.S. Lakshmi Jagadamba
Turnaround Time Varies With
The Time Quantum
80% of CPU bursts should
be shorter than q
Process Management
P.V.S. Lakshmi Jagadamba
Multi-level Queue Scheduling
Process Management
P.V.S. Lakshmi Jagadamba
Multi-level Queue Scheduling
Multi-level queue scheduling is used when processes can be classified into groups
For example, foreground (interactive) processes and background (batch) processes
The two types of processes have different response-time requirements and so may have
different scheduling needs
Also, foreground processes may have priority (externally defined) over background processes
A multi-level queue scheduling algorithm partitions the ready queue into several separate queues
The processes are permanently assigned to one queue, generally based on some property of the
process such as memory size, process priority, or process type
Each queue has its own scheduling algorithm
The foreground queue might be scheduled using an RR algorithm
The background queue might be scheduled using an FCFS algorithm
In addition, there needs to be scheduling among the queues, which is commonly implemented as
fixed-priority pre-emptive scheduling
The foreground queue may have absolute priority over the background queue
Process Management
P.V.S. Lakshmi Jagadamba
Multi-level Queue Scheduling
One example of a multi-level queue are the five queues shown below
Each queue has absolute priority over lower priority queues
For example, no process in the batch queue can run unless the queues above it are empty
However, this can result in starvation for the processes in the lower priority queues
Process Management
P.V.S. Lakshmi Jagadamba
Multilevel Queue Scheduling
Another possibility is to time slice among the queues
Each queue gets a certain portion of the CPU time, which it can then schedule among
its various processes
The foreground queue can be given 80% of the CPU time for RR scheduling
The background queue can be given 20% of the CPU time for FCFS scheduling
Process Management
P.V.S. Lakshmi Jagadamba
Multi-level Feedback Queue Scheduling
Process Management
P.V.S. Lakshmi Jagadamba
Multilevel Feedback Queue
A process can move between the various queues; aging can be
implemented this way
Multilevel-feedback-queue scheduler defined by the following
parameters:
number of queues
scheduling algorithms for each queue
method used to determine when to upgrade a process
method used to determine when to demote a process
method used to determine which queue a process will enter
when that process needs service
Process Management
P.V.S. Lakshmi Jagadamba
Example of Multilevel Feedback Queue
Three queues:
Q0 RR with time quantum 8 milliseconds
Q1 RR time quantum 16 milliseconds
Q2 FCFS
Scheduling
A new job enters queue Q0 which is served
FCFS
When it gains CPU, job receives 8
milliseconds
If it does not finish in 8 milliseconds, job is
moved to queue Q1
At Q1 job is again served FCFS and receives 16
additional milliseconds
If it still does not complete, it is preempted
and moved to queue Q2
Process Management
P.V.S. Lakshmi Jagadamba
Guaranteed Scheduling
Process Management
P.V.S. Lakshmi Jagadamba
Guaranteed Scheduling
To achieve guaranteed 1/n of cpu time (for n
processes/users logged on):
Monitor the total amount of CPU time per process and
the total logged on time
Calculate the ratio of allocated cpu time to the amount
of CPU time each process is entitled to
Run the process with the lowest ratio
Switch to another process when the ratio of the
running process has passed its goal ratio
Process Management
P.V.S. Lakshmi Jagadamba
Guaranteed scheduling example
0
0
1
Process 1
0
0
0
1
Process 2
0
0
Process 3
0
0
Guaranteed scheduling example
1
0
1
0
1
Process 1
Process 2
Process 3
1
1/ 3
0
1/ 3
0
1/ 3
Guaranteed scheduling example
2
0
1
0
1
Process 1
Process 2
Process 3
1
2/3
1
2/3
0
2/3
Guaranteed scheduling example
3
0
1
0
1
Process 1
Process 2
Process 3
1
3/3
1
3/3
1
3/3
Guaranteed scheduling example
4
0
1
0
1
Process 1
Process 2
Process 3
2
4/3
1
4/3
1
4/3
Guaranteed scheduling example
5
0
1
0
1
Process 1
Process 3
2
5/3
2
5/3
Guaranteed scheduling example
6
0
1
0
1
Process 1
Process 2
Process 3
3
6/3
1
6/3
2
6/3
Guaranteed scheduling example
7
0
1
0
1
Process 1
Process 2
Process 3
3
7/3
2
7/3
2
7/3
Guaranteed scheduling example
8
0
1
0
1
Process 1
Process 2
Process 3
3
8/3
3
8/3
2
8/3
Guaranteed scheduling example
9
0
1
0
1
Process 1
Process 2
Process 3
3
9/3
3
9/3
3
9/3
Fair Share Scheduling
Process Management
P.V.S. Lakshmi Jagadamba
Fair Share Scheduling
FSS controls users access to system resources
Some user groups more important than others
Ensures that less important groups cannot monopolize resources
Unused resources distributed according to the proportion of
resources each group has been allocated
Groups not meeting resource-utilization goals get higher priority
Process Management
P.V.S. Lakshmi Jagadamba
Fair Share Scheduling
Standard UNIX process scheduler. The scheduler grants the processor
to users, each of whom may have many processes. (Property of AT&T Archives.
Reprinted with permission of AT&T.)
Process Management
P.V.S. Lakshmi Jagadamba
Fair Share Scheduling
Fair share scheduler. The fair share scheduler divides system resource
capacity into portions, which are then allocated by process schedulers assigned to
various fair share groups. (Property of AT&T Archives. Reprinted with permission of
AT&T.)
Process Management
P.V.S. Lakshmi Jagadamba
Deadline Scheduling
Deadline scheduling
Process must complete by specific time
Used when results would be useless if not delivered on-time
Difficult to implement
Must
plan resource requirements in advance
Incurs
significant overhead
Service
Process Management
provided to other processes can degrade
P.V.S. Lakshmi Jagadamba
Real-Time Scheduling
Real-time scheduling
Related to deadline scheduling
Processes have timing constraints
Also encompasses tasks that execute periodically
Two categories
Soft real-time scheduling
Does
For
example, multimedia playback
Hard real-time scheduling
Timing
constraints will always be met
Failure
to meet deadline might have catastrophic results
For
Process Management
not guarantee that timing constraints will be met
example, air traffic control
P.V.S. Lakshmi Jagadamba
Real-Time Scheduling
Static real-time scheduling
Does not adjust priorities over time
Low overhead
Suitable for systems where conditions rarely change
Hard
real-time schedulers
Rate-monotonic (RM) scheduling
Process
priority increases monotonically with the frequency
with which it must execute
Deadline RM scheduling
Useful
for a process that has a deadline that is not equal to its
period
Process Management
P.V.S. Lakshmi Jagadamba
Real-Time Scheduling
Dynamic real-time scheduling
Adjusts priorities in response to changing conditions
Can incur significant overhead, but must ensure that the overhead
does not result in increased missed deadlines
Priorities are usually based on processes deadlines
Earliest-deadline-first
(EDF)
Preemptive, always dispatch the process with the earliest
deadline
Minimum-laxity-first
Process Management
Similar to EDF, but bases priority on laxity, which is based
on the processs deadline and its remaining run-time-tocompletion
P.V.S. Lakshmi Jagadamba
Java Thread Scheduling
Operating systems provide varying thread scheduling support
User-level threads
Implemented
Operating
by each program independently
system unaware of threads
Kernel-level threads
Implemented
at kernel level
Scheduler
must consider how to allocate processor time to a
processs threads
Process Management
P.V.S. Lakshmi Jagadamba
Java Thread Scheduling
Java threading scheduler
Uses kernel-level threads if available
User-mode threads implement timeslicing
Each
thread is allowed to execute for at most one quantum
before preemption
Threads can yield to others of equal priority
Only
necessary on nontimesliced systems
Threads
Process Management
waiting to run are called waiting, sleeping or blocked
P.V.S. Lakshmi Jagadamba
Java Thread Scheduling
Figure 8.7 Java thread priority scheduling.
Process Management
P.V.S. Lakshmi Jagadamba
Choosing a Scheduling Policy
Scheduling policy depends on the nature of operations.
An OS policy may be chosen to suit situations with specific
requirements.
Within a computer system, we need policies to schedule access
to processor, memory, disc, IO and shared resource (e.g.
printers).
Policy Selection 1:
A scheduling policy is often determined by a machines
configuration and its pattern of usage. Scheduling is considered
in the following context:
We have only one processor in they system
We have a multi-programming system more than one
ready-to-run program in memory.
Process Management
P.V.S. Lakshmi Jagadamba
Choosing a Scheduling Policy
Policy Selection 2: Study the effect on the following quality
parameters:
Response time to users
Turn around time
Processor utilization
Throughput of the system
Fairness of allocation
Effect on other resources.
We see that measures for response time and turn around are
user centred parameters.
Process Management
P.V.S. Lakshmi Jagadamba
Choosing a Scheduling Policy
Policy Selection 3:
Process utilization and throughput are system centered
considerations.
Fairness of allocation and effect on other resources affect
both the system and users.
An OS performance can be tuned by choosing an
appropriate scheduling policy.
Process Management
P.V.S. Lakshmi Jagadamba
Comparison of Policies
Let us consider 5 processes P1 through P5.
Assumptions:
The jobs have to run to completion.
No new jobs arrive till these jobs are processed.
Time required for each job is known appropriately.
During the run of jobs there is no suspension for IO
operation.
Process Management
P.V.S. Lakshmi Jagadamba
Comparison of Three Non-Preemptive
Scheduling Policies
Process Management
P.V.S. Lakshmi Jagadamba
Summary of Results
Case B : Average time to complete - 50 (case of FCFS)
Case C: Average time to complete - 52 (case of prioritized)
Case D: Average time to complete 35 (case of SJF)
Clearly it would seem that shortest job first is the best policy. In
fact theoretically also this can be proved
Process Management
P.V.S. Lakshmi Jagadamba
Preemptive Policies - 1
Process Management
P.V.S. Lakshmi Jagadamba
Summary of Results
In the figure, we compare four cases:
Round-robin allocation with time slice = 5 units (CASE B)
Round-robin allocation with time slice = 10 units (CASE C)
Shortest Job First within the Round-robin; time slice = 5 units
(CASE D)
Shortest Job First within the Round-robin; time slice = 10 units.
(CASE E)
Case B Average time to complete - 52
Case C Average time to complete - 53
Case D Average time to complete - 45
Case E Average time to complete - 41
Clearly it would seem that shortest job first is the best policy. In fact
theoretically also this can be proved
Process Management
P.V.S. Lakshmi Jagadamba
End of Chapter 3
Process Management
P.V.S. Lakshmi Jagadamba