3.process Scheduling
3.process Scheduling
Systems
.J
Process Scheduling
piterencebetween Pre-emptive and Non-preemptive Scheduling:
Preemptive
Scheduling Non-preemptive
Sr.
NO. the preemptive schedule, the Scheduling
In non-preemptive
processes with higher priorities are
scheduling,
CPU has been allocated once the
to a process, the
executedfirst. process keeps the CPU until it releases
the CPU either by terminating or by
switching to the waiting state.
The CPU utilization is high in this type The CPU utilization is less efficient.
ofscheduling.
8.Vaiting and response time of Waiting and response time of the non
preemptive schedling is less. preemptive Scheduling method is higher.
allocated to
this process, the CPU is In this process, CPU is allocated to the
4. the prOcesses for a specific time process until it terminates or switches to
period. the waiting state.
5 only the processes having higher Processes having any priority can get
priority are scheduled. scheduled.
tdoes not treat all processes as egual. It treats all process as equal.
7. It has the overhead of switching the It has no such overhead of switching the
process from the ready state to the process from running into the ready
running state. state.
efficiently. efficiently.
S5 Dispatcher vvìe d e f l s h [April16, 18, 19 Oct. 16]
DSPatcher is a component which involves in the CPU scheduling. When the scheduler
completes its job of selecting a process, it is the dispatcher which takes that process to
the desired state/queue.
(The dispatcher is the module that actually gives control of the CPU to the process
ected by the short termscheduler) den
ne module of the operating system that performs the function of setting up the
execution of the selected procesS on the CPU is known as dispatcher.
CPU scheduler onlv selectsa process tobe executed next on the CPU but it cannot
aSsign CPUto the selected
process.
3.7
eact scheduling cart algo
scheduling Algorithms Priority
In RR
3. Throughputin RRScheduling
Scheduling RR Scheduling
various
4
Comparison of v
FCFSSCheduling
sJFScheduling
Algorithm
Algorithm Algorithm
SI. Thisscheduling This scheduling
Algorithm
No. Thisscheduling algorithm is also algorithm is also
1. Phis scheduling algorithm ispre pre-emptive. pre-emptive.
algorithm is emptive. Contd,
non-pre-emptive.
3.22
ating
Systems
Process Scheduling
Thisissimplest Thisalgorithm is This algorithm is In this scheduling
scheduling difficult to also difficult to
understand and understand.
algorithm
algorithm.
code. performance
heavily depends
upon the size of
time quantum.
rthis scheduling In this schedulingThis scheduling In this scheduling
algorithmit algorithm CPU is algorithm is based algorithm the pre
allocates the CPU allocated to the on priority the emption take
inthe order in process with least higher priority job place after afixéd
which the CPUburst time. can run first. interval of time.
processes arrives.
4 This scheduling Thisscheduling This scheduling This scheduling
algorithm is good algorithm is also algorithm is also algorithm is good
good for non good for non for interactive
for non
interactive interactive interactive system.
system. system. system.
5. this scheduling In this scheduling In this scheduling In this scheduling
algorithm thealgorithm the algorithm the
algorithm the Average waiting Average waiting
Average waiting Average waiting
time is small as time issmall as time is large as
time is large. compare to FCFS Compare to all the
Compare to FCFS
scheduling three scheduling
scheduling algorithm.
algorithm. algorithm.
Inthis scheduling This scheduling In this scheduling
6.
This scheduling algorithm is the algorithm if the
algorithm is never algorithm the sometime
quantum size is
recommended problem is to large then this
know the length becomes the
algorithm become
whenever
performance is a of time for which
biggest cause of
same as FCFS
starvation.
major issue. the CPU is needed algorithm and its
bythe process. performance
degrade.
This scheduling This scheduling
This scheduling
This scheduling
algorithm is also algorithm isbased algorithm is
suitable for time
algorithm is suitable for Batch upon priority.
sharing system.
suitable for Batch
system. system.
uling Algorithm
system.
Amultilevel queue scheduling algorithm paritions the ready queue Proces Shedul
queues.
In a multlevel queue scheduling processes are permanentiy assigned to nv
depending upon their properties such as the size of the memory or
the
process or priority of the process, So each queue follows a separate type of the
algorithm.
multilevel queue scheduling alyorithm scheduling the processes are
different groups such as System processes, Interactive processes,
sclas ctfhieeddtlnlyutg
processes,Batch processes, User processes etc., as shown in Fig, 3.9, Interactive edltng
The interactiveprocesses are known as foreground processes and the
batch Drote.
are known as background processes. These two
types of processes have processes
response-time requlrements and so may have different scheduling needs.
In addition, foreground processes may have
priority (externally defined) ovee
diferent
background processes. OVer
A multilevel queue
scheduling algorithm partitions the ready queue in several
separate queues.
In Fig. 3.9 each queue has absolute
the batch queue, for example, could priority over lower-priority queues. No process in
run
interactive processes, and interactive editingunless the queues for system processes,
processes were all empty.
Highest prlorlty
System procoss
Interactive proces8
diorom
Interactlve editing processes
Batch processes
Algorithm:
Advantages MLQ Scheduling permanently assigned to their respective queues and do
1. In MLQ, the processes are resultsin low scheduling overhead.
not move between queues. This algorithms to different processes.
scheduling
2. In MLQone can apply different are not able to put them in the one single
which we
3. There are many processes Scheduling as we can now put them in
different
queue which is solved by MLQ
queues.
Algorithm:
Disadvantages MLQ Schedulingpriority CPUin case
queues may have to starve for
1. The processes in lower arriving in higher priority queues.
are continuously
processes
not move from one queue to another queue.
2. In MLQ the process does Algorithm
FeedbackQueue (MLFQ) Scheduling
3.2.6 Multi-Level scheduling is an enhancement
of MLQ. The MLFO
Multi-level feedback gueue adaptive scheduling is an improved version of
multilevel
scheduling also known as algorithm.
other
multilevel queue scheduling processes cannot move from one queue to
scheduling, background nature.
In multilevel queue their foreground or
because processes do no0t
chrange
processes are not permanently assigned
feedback gueue scheduling, [Oct. 17
But in muülevel system. processes
to a queue on entry to the between queues. The idea is to separate
move it will be
Instead, they are allowed to
characteristics. If a uses too much CPU time,
process
with different CPUburst to a
moved to a lower priority queue. long in a low priority queue will be moved
to0
Similarly, a process that waits
form of aging prevents starvation.
higher priority gueue. This following parameters:
queue scheduler is defined by the
A multilevel feedback
I. The number of queues.
queue.
2. The scheduling algorithm for eachwhen to upgrade a process to a higher priority
determine
3. The method used to
queue.
3.25
Fig. 3.11 shows multilevel feedback queue. For example,
consider aa mutleve
feedback queue scheduler with three queues, numbered from Qo Q to O,.
The scheduler first executes all processes in Queue 0. Only
when Queue 0isjs emn.
it execute processes in Queue 1.
empty wil
Similarly, processes in Queue 2 will only be executed if Queues 0 and 1
process that arrives for Queue 1 will preempt a process in are y. A
Queue Z. Aprocess inempt
One
1will in turn be preempted by a process arriving for queue 0. Queue
Aprocess entering the ready queue is put in
time quantum of4 milliseconds. Ifit does not Queue 0. A process in Queue 0 is given a
tail of Queue 1. finish within this time, it is moved to the
If Queue 0 is empty, the process at the
head of Queue 1is given a quantum of 8
milliseconds. does not complete, it is preempted and is put into Queue 2.
If it
Processes in Queue 2 are run on an FCFS basis but are run only
are empty. This scheduling algorithm gives when Queues0 and 1
highest priority to any process with a CPU
burst of 4 milliseconds or less. Such a process
burst, and go off to its next I/0 burst. will guickly get the CP, finish its CPU
Queue 0 Qo
Quantum =4
diagram
Queue 1 Q4
Quantum =8
Queue 2 Q
FCFS
Fig. 3.11: Multilevel Feedback
Queue
Queue Scheduling Algorithm: execution.
Advantages of Multilevel
scheduling speeds up the flow of task
feedback queue a higher priority
1. The multilevel priority process to
It prevents starvation by moving a lower
2. for too long. long
queue ifit has been waiting processes as these processes need not wait to0
bound (short)
3. It is fair to IO
and are executed quickly.
performance of the system.
4. It improves the overall Scheduling Algorithm:
Disadvantages of Multilevel Queue
turnaround time for long processes may increase significantly.
1. The
scheduling algorithm.
2. 0t is the most complex between queues causes a number of
2 algorithm, moving the processes
Scheduing Alyarithm
EES nonP
pre
Aon-pe
her-Pk.
Roahd Robin pe