0% found this document useful (0 votes)
11 views9 pages

Process Technical

Uploaded by

Mayank Devani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views9 pages

Process Technical

Uploaded by

Mayank Devani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Mdnaagen

2 20

Operating Systen
Operating System

2 . 9 Types
of
Scheduling
ming
multiprogramm i

eduler
concept.
selects one Process Fig. 2.9
is
m a x i m i z i n g
by
using
P r o c e s s o r
sched
process
utilization p r o c e s s .

CPU a
executing
not idle, it is
queue.
from the
ready
execution

Scheduling Queue of Header


is queue
queue
Scheduling i n p u t - o u t p u t First

processes
or
process
Waiting Waiting
When the
user
Last/ Tail
devices.
they put PCB No.
system, PCB
enters
into the
qurese No.
queue,
fob Open files
into the job of the
processes

consists of all Priority

system. maintains
system
Operating for
of queues
different types
The queue and d e v i c e queue
different purposes. 2.9.1 Ready
Fig.
device queue
queue,
are ready
etc. Fig. 2.9.1
shows ready
ko
queue
and device queue.
ready
and waiting to
execute are
kepti
The processes
which are
Linked list is Used
Ready queue : stored in
main memory.

Ready queue is used for this.


the ready queue.
Pointer field
of PCB is
representing ready queue. processes are waiin
tor which multiple
Device queue is a queue Long
Device queue : has maintained
its own device queue.
device. Each device
for a particular 1/O created
Newly processi
scheduling is represented by queueing diagram.
When
Process
for When CPU select the proce
proe
waits processor.
into the ready queue and
kept
happens
forexecuting, following things into the l/0
1. Process may
to
require I/O device perform operation. So it is put
queue.
termination.
2. Process may create child process and wait for child process

3. Because of interrupt, process preempted from CPU and put into the readyear
queue.

2.9.1 Scheduiers
Schedulers are used to handles process scheduling. It is one type of sys
software and selects the jobs from the system and decide which process to
Schedulers are of three types -
1. Long term scheduler 2. Short term scheduler 3.
Medium term scheduler
TECHNICAL PUBLICATIONS An up thrust for
knowledge
Operating System 2-21 Prouess Managament

Fig. 2.9.2 shows queueing diagram for process scheduling.


Long term scheduling

New processes Ready queue

Short term Central Exit/ End


processing
scheduling unit

Suspended
process

Time out

uA3 Sinooo Interrupt from


higher prioity
Waitingfor Event
wait
process an interrupt

Queue for Request for


completed VO

Child process fork()


Child
Terminate
perform its task system call -
Fig. 2.9.2 Process scheduling queueing diagram

Long term scheduler

term scheduler is also called job scheduler. It determines which process are
Long
Processes are selected from the queue and
admitted to the system for processing.
execution.
loads into the main memory for
controls the degree of muitiprogramming in multitasking
Long term scheduling
balanced mix of jobs, such as I/O bound and CPU bound.
systems. It provides a
time operating system. Time sharing
Long term scheduling is used in real
has no long term scheduler.
operating system
Medium term scheduler
Sometimes it the
part of swapping function.
removes
Medium term scheduler is
It also reduces the degree of multiprogramming.
process from memory.
and it is in memory then operating system takes
1/0 request
If process makes an
Once the process becomes suspended, it cannot
this process into suspended states. removed
In this situatiorn, the process is
make any progress towards completion. is
for other process. The suspended process
from memory and makes free space
is called
device i.e. hard disk. This process
stored in the secondary storage

swapping
thrust for knowledge
TECHNICAL PUBLICATIONS- An up
2- 22
Operating System rocess Ma
0
Short term scheduler
CPU scheduler. It sol cts
scheduler is also
called
the proce
Short term allocate the CPU for evo.

which are ready to execute


and
ion.
queue
is faster that long
term scheduler. This scheduler
Short term scheduler
decisions much
more frequently than
long-term of lemid
the
scheduling minimum have to be made m
decision will at a
schedulers. A scheduling after
time slice, and these are very short.

I t is also known as dispatcher.


and Medium Term
2.9.2 Difference between Long Term, Short Term
Scheduler

Sr. No. Long term Short term Medium term


wwww.
***
wwww wwwwwwer n
***

It is job scheduler. It is CPU scheduler. It is swapping.


*****aa AMA

2. Speed is less than short Speed is very fast. Speed is in between both
term scheduler.
*** aewwwavowevonwe

3. It controls the degree of Less control over degree of Reduce the degree
multiprogramming. multiprogramming. multiprogramming.
wwwwwwwwwwwwww.ww.wv
*****
Absent or minimal in Minimal in
time sharing system.
time sharing Time sharing system us
system. mediumn term scheduler.
5. It select processes trom t select rom
* **
****

among the Process


pool and load them into processes that are ready to can
memory for execution. execute. reintroduced into memnor-
and its
continued.execution
can bb
6. Process state is Process state is wwowkocecoe
(New to Ready). (Ready to Running)
wwowwnww wwe

7 Select a good processS, Select a new process


mix of I/O bound and tor a
ww.

CPU bound.
CPU quite frequently. vwwnv wwwwwwwwww

wwwWww gcoc

******

293 Cantoxt fuui


the to

operating system assigns priorities a b o t h e s a m e

mechanism should favor the higher priority pr es.

differ.
Th

8.
Predictability: A
given pro
y s should run

parameters.
policy
m a y
Fairness

of time under similar system loads scheduling


the centered
Depending upon the nature of operations
CPU utilization and throughput are the syste
m G T U R W I n t e r - 1 3 ,S u m m e r - 1 3 , 1
14
attect by user and system
scheduling

2.11 Scheduling Algorithms first

Shortest
job
are as
follows scheduling

CPU scheduling algorithms 2.


r o b i n

scheduling
1. First In First Out (FIFO) R o u n d

4.

3. Priority scheduling
The processe:
Th a
Schedulin9 m e t h o d .

First Come First Serve ready queue. FIFO


2.11.1 s e r v e d
s c h e d u l i n g

the
come
first at
is also called first
time
FIFO arrival

dispatched according
to their
This
1nis
algorithm is
algorithm is fi
algorithm.
CPU scheduling F
FIlF
FOO queue
queue.

useful in schedu.
in scheduli-
non-preemptive us
u se
ess
aa useful
e it
it not
n ot
be
b ec
caau
usse
FIFO
is
FIFO is simple to implement
systems. responseti
time.
operating short
batch
for most of the guarantee
block is linked to
tot
cannot
interactiveprocesses because it control

its process
system,
front of
the queue.
into the
process
nters
from the
When new
and it is
removed
Average waiting ti
end of the ready queue
FIFO algorithm.
with the tickets.
unpredictable
time is is buying
Real life analogy
Turnaround

is often quite long.


of the FCFS Burst time
set of Process
Consider the following
Example 2.11.1 with the
that arrive at time O, 4
process
burst given in P1
CPU
length of
the average waiting 7
milliseconds. Calculate P2
arrive in the
time when the processes
3
following order
P3
a. Py Pz Pz, P Ps 3
PA
the same.
Provide the Gantt chart for
5
P5

TECHNICAL PUBLICATIONS- An up thrust for knowledge


Operating >ystel

Solution
Gantt chart:

P P2 P P Ps
4 11 14 17 22

Such diagram is called Gantt charts, showing when each process burst uses the CPU.

Waiting time:
ProcesS Waiting time

P1 0 -0 =0

P2 4- 0 = 4

P3 11 - 0 = 11

P4 14 0 = 14
anaaarasuammannsournmsna

Ps 17 0 = 17
owwwww.cewwwwwwwarmumaenaaannaaunnnaieammm.

Average waiting time = 0+4+11+14 +17= = 9.2


5

Turnaround time: Turnaround time = Waiting time + Burst time

ProcesSS Turnaround time

P1 0+4 = 4

P2 ww.ww
4 +7 = 11

P3 11 + 3 = 14

P4 14+3 = 17

P5 17 +5 2 2

Average turnaround time = 4+11+14+17


5
+22=8 =
13.60
Convey effect : To reduce I/0 device utilization, all I/O bound processes will be
vaiting excessively long for processor bound ones. This is called as convey effect.
I f one
process monopolizes the system, the extent of its overall effect of system
performance depends on the scheduling policy and whether the process is
processor bound or I/O bound.
TECHNICAL PUBLICATIONS An up thrust for knowledge
2-28
Operating System

Shortest Job First Scheduling


PrOces Mant
2.11.2
is also known
Shortest job first scheduling algorithm
acCu

scheduling algorithm. It handles the process based on length o orteofst Job NNen
time. It reduces average waiting time over FIFO algorithm.
length heir C
CP
SJF is anon-preemptive CPU scheduling algorithm.
I t does not work in interactive system because users do not estis.
the CPU time required to run their processes. adv
SJF scheduling algorithm is used frequently in long term scheduling

Example 2.11.2 Calculate the average toaiting time and average turnaround time. Promi
Gantt chart for the same.

Process Burst time

P1 5

P2 2

Pa

Solution

Gantt chart

P 2
P Pa
11
Waiting time 17

Process
Waiting time
P1 6-0 6

P2 0 -0 0
3 11 -0 11
P4 2-0 2

Average waiting time = 6+0+11+2 19


4 4.75
Turnaround time : Turnaround time =

Waiting time + Burst time

TECHNICAL PUBLICATIONS An up thrust for knowledge


Operating System 2 29
Process Management

Process Turnaround time


6+5 = 11

0+2 2
P3 11 +6 17

P4 2+4 6

Average turnaround time 11+2+17+6


4
_
369
4
. The SJF scheduling algorithm is optimal
only when all of the processes are
available at the same time and the CPU estimates are
available.
.SJF scheduling algorithm may be preemptive or
non-preemptive.
2.11.3 Priority Scheduling
Priority CPU scheduling algorithm is preemptive and non-preemptive algorithm. It
is one of the most common
scheduling algorithm in batch system. Priority can be
assigned by a system admin using characteristics of the process.
I n this scheduling algorithm, CPU
select higher priority process first. If the priority
of two process is same then FCFS
scheduling algorithm is applied for solving the
problem.
Example 2.11.3 Consider the following set of process
that arrive at time 0, with the
length of
CPU burst given in milliseconds. Calculate the
average waiting time and average
turnaround time. Provide the Gantt chart for the same. (Time slice = 2)

Process Burst time Priority


P1 www.wirwm

P2 2

P3 6
wwww*

PA
Solution : For non-preemptive priority scheduling
Gantt chart

Pa P4 P P2
10 15 17

TECHNICAL PUBLICATIONS- An up thrust for knowledge


Opereting System
2-30
rocess Mana.

Waiting time:
Waiting time
Process
10 0 10
P 15 0 15

P2 '0-0 0
Pa 6-0 = 6
PA

time =
10+15+0+6 -= 7.75
Average waiting 4

time + Burst time


Turnaround time Turnaround time =
Waiting

Turnaround time
Process
10+ 5 = 15
P1
15 +2 17
P2
0 + 6 = 6
Pa
6 +4 10
P4

Average turnarournd time 15+17+6+10 48


4
Problem with Priority Scheduling
Waiting time is more for lower priority process even if there required CPU
time is less.
Priority scheduling algorithm faces the starvation problem. Starva
problem be solved by using aging
can
techniques.
I n aging, the
priority of the process will increase which is waiting for long tim
the ready queue.

2.11 Round Robin Scheduling


Round robin is a
preemptive scheduling algorithm.
It is used in
Here process are given a limited interactive sys
amount of time of
slice or time quantum. If a processor time called ab
process does not before its complete
the
system preempts it and gives the quantum expi
processor to the next waiting proces.
system then places the preempted process at the back
of the ready queue.
Processes are
placed in the
ready queue using a FIFO scheme. With the
algorithm, the principle design issue is the
length of the time
For short time slice, processes will move quantum
to be

increases the through the system


relatively quick)-
processing overheads.
TECHNICAL PUBLICATIONS- An up thrust for
knowledge
2-31 Process Management
Operating System

EYample 2.11.4 Consider the following set of process that arrive at time 0, with the length of
CPU burst given in milliseconds. Calculate the average waiting time and average
turnaround time. Provide the Gantt chart for the same. (Time slice = 2)

Process Burst time

P1
P2
P3
P4

Solution

Gantt chart
PA P1 Pa
Pa PPP|
0 10 12 14 15

Waiting time
Process Waiting time

0 -0 8-2+.14 - 10 10
P
2-0 2
P2
4 0 10 -6+ 15- 12 11
P' +

6-0+ 12 8 10
P4

Average waiting time = 10+2+11+1033


4 4
-8.25
Turnaround time Turnaround time = Waiting time + Burst time

Process Turnaround time

10 +5 15

2+2 =4

11 +6 17
Pa
10 +4 14
P4
coaveswwwwwww.w ***
wwwwww.coenocoaoweowaw

Average turnaround time 15+4+17 +140 - 12.5


4

TECHNICAL PUBLICATIONS - An up thrust for knowledge

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy