N 4
N 4
f Cl-l-r.r ' ~ f
' • 0 C,
A CJ-u ft cu
C S' e__ w C% ._,, ~' C(, f'W"~
~ ~q ,
I '~
.e n:~J <:)
5 U,hdC1,t
CJu~ UA_-1 s t{_;ff ~
(O ntl_w f) f~
(\)M.f ch 10 II
ft ➔ I/
Rr ct ) Px 4 ,~ 1I ( ,,;y,ro""iIP~
a :: Qf / ~ .Nt r e co ndj h~
w{ ~ )
• 1
)villCUV\.D~
I
I • .•.~ • ....._ '
l ••-•':••.'• J
PooRNIM A
;poon.NIMA.i
l "1IU'l',l; l\'f.\f.l\'lt1ll~\' ~
1-- --- . .i
-
•'j· ')j
~ '. I
~
'
i :_: , I•
COLLEGE OF ENGINEERING
DETAILED LECTURE NOTES l'Mi f: NO .......... .
,: ~ ~ ·
0 H ~M £H ~~-·<W) uvv--i"(Y'\~ ~~
. . A ~ 1½~ 0°1~0'-n..,,.i §~ ~ Sjy,-,-,
~·· ·. . · !
(j . 'J.t µ \H ~ ~ ~ }Lu u-±v r:rvJ_ I
✓~~
• d) ~ .
I . @ ~ r,M¥ (s)
' @ f~~~
(J) -it~ ~'
crf~'j 7 ~ [/) ~Lf ~ [9l1Htfe>r1 {
rk4
DI
- --
...... ...... . l) :111· ( I l\'\ . \: ...... ...... ...... ......
l 11il ~11. / I r1 p1 l : ... JJ1:... ........... Lt'l I '\ 11 · .•.
,, ti\ k t,iu~ht 1n 1hi, lcrturl') 110111!-, tit ,· 111<1111 l11p 1 ' •.I, I
.<;l,oJ-tt uote
'Dea c/Ln us C,~ C<b CA I try
" 0
W-1 vv\
Ao1ru S ch1 d M LID , Sb r,··;t f .t ½ Vv1 ,
Definition
sPlection of
~'he process scheduling is t~1e activity _of the process manager that hnntlles the removal of the runnin g process from the CPU and th e
,mother process on tl,e basis of a p;nl1cular strnter~v.
lo be loaded
:roccss scheduling is an essentiai part of a Multir,:1>gramming uperuling systems. Such operating systems allow more than one procc~s
mto the executable memory at a time and the loaded !)l'OCl!S ~ shnres the CPU usi ng lime multi plex ini.;.
• Ready q u ~ ~ e keeps a s,it of all processes re~g in main memory, ready and waiting to execute. A new pror.e.ss
is alwa:,·s put
in this queue.
• De\1ic,~ queues - Tht'. processe:.: which are block-!d due to unavailabili!v of an J/ O device constitute this q11e1,;c.
) 1•· ¥1'' ',-.. U t,,,"~• "t-- '\"•°t •·,.i•"f ~~- ;c~'of..' "I:'!' 'f' """' i 1 <(.•'f.f~ ' ;'
i
I
I
I
; I
i 1·
t
J,:,l;Queue
""~· Se~ci,j~:.z~ue . r··-·
f-··-•··•- i,{
••·,,'v•,
bit
~~=c..:..~J [.,.~L:.·~:it~~~I
Th,; OS can use different policies to manage each queue F IPO , RmmdRubin, Pi·iurity, etc .. Th~ch~~"!,0fr ,kt~rrnines
__hov. to nic-ve pro,:-cs:;l'''
merg('d w11 ii
bctw~u1 th~ ready ;:r!d nm ~~~ll_~ whi\;b~n 9.n)yJrnw.o_n_e_~l!!Q'. Per pr,oce..~s?r c<_n:~ p_n the syster:1; 1:1 th ~ aliow d1ai;rarn , 1t b " beer,
the CPU.
Runni ng
When a new process is creatGd, it enters into the system as in the runnin g :; late.
Noi:Runuin g
Proces~~s that ,tre not running Jl't- kept in queu e, wailing for 1heir turn t·o ei;ecule. fa, ch enl1 y in the riue11e is a poiata to ,, particul.ir
process. Queue is implemented liy using linked list. UsP. of dispatcher is as follows. Wht!ll a pr xess is i11l.r1Tt1plt-t!, lhal :·Jl'ocess is
1
transferred in the wa iting queni:!. If the process has completed or aborted, t!1e process is disrardetl. III C'. ith er case, the dispatcher then
selects a process frcm the queue to execute.
Schedulers
·J/ i
I_ J .
I<!
' . ~ ~
.\:51
-
-
~ ~~~"'
n . ·-~
-
~ ,.-.-.,.-. . i
jr ,
C.OLLEGE
NEI~]tlr~J OF ENGI
DETAILED -
LECTURE NOTES
Ca m p u s: .. ..
...... .. ...... C o u rs
N a m e o f fa e : ........ .. .. ..
c u \t y : ... .... . . Class/S ec ti
.......... ........ o n : ..... .. ......
.... ... ... .. ... . ... .. ..... .... .....
N am e of S u b je ..
ct : ...... ........ ...... D a te : .. ....
... .........
........ .. ......... .
Code : ........
........ .......... .
C
---vu\\,_-/ -1~
~
~-½ \\
, ~ l{1 <J 1~
---i:U w o-c L k1 ~~k~
~ TI W~~\
---cu. u
/.~ l!Lk9 4 _IP,~ ( -1,ip /
c~ ----~ ~Q\QY)
<J:j i-56 'i',,1\-~
-
-{Url-
~\-1'- U
") t~
l,~ w_ ia 1 g t ~
_s ~--i~, . ~ 1)~h,,
( ,'-z. u h i '6-) -f ~1 ' \ j~~
~WI
( l f 4, -1 .'1 , i ( 5
~_,/' ?J ht it\~
l 1 ~ci ~ \ \ 8
-zuw i-s- ~~l 1i~
lL{W { l 9 '\ i ·l ~~
o{-5 ~W( ~tq~\ ~
1hl~
(\.
v f _l 1 i
- i l f w s-~'°
-4 ~
cJ,( H { ~l~~ y \Lc\ ~ ~~
-i. ~1l i-06 ~~, l ~\l~i
❖
o'- ~
\;·':I
_,~~-. .s ~""' '4 _ I 1'N
'\❖'' - ~~'"' ('\ ~ /) v~ l q ~ ~rl) ~
~~).~":) 4 11',/, \.l .. '-f_;,
U1 \ t
.L- ~
'- r
Page No.:
----
,,.__
Operating System - Process Scheduling
~
6l '~- task is to select the jobs to be submitted i11to
process schedu li ng in various ways. 111eir main
.,chr~du·i~rs are specia l system software which handle
1 .e. ~yste1!1 and to decide which process to nm. Schedulers arc of three types -
CPU
I
I
I
J
t
I'
l'
,!.
i;av<'. tl ,::1(: re!;ic:·ed. Tc: ..voici t ·1e a·,1;,;;unt of context
1
Cont~:t s,•:i'.::hes ue l'Omput:;tJm;:,l1y i,:lem,M! :;im:e re~ste , and memory state mus··. ;>e is switched, t~,;; foi!...:,,:r: g ir.i'ormation is
:~g.i;;:t1: ·s. '.'Vhe:; r'.1e process
switching tin:c, sc,mc !·.ardware s~1sttm ~ ~n,;iloy two or more set~ uf proc.~sc!'
st;,:-ed 1.:,r late~ use.
• Sched•.iling information
• Ba~e ~,nd limit register value
• Curreutly u:;cd rci;i:;tcr
Chan:;ed Stai e
t~ • I/ O State information
• Accounting informaticn
~ Opsrr.11:,g System Scheduling algorith11 1s
' 1
7r~~\
>
~
r
·,-t1 ps .;
1
""''1
OPERATING SYSTEM SCHEDULING ALGORITHMS
lull11 rn l'l]>om1,,,,11, ·,,111•ratin1· " ' 'l 'lllot>'
11 ,.,,.,,, ,, 1r,.,J ,,J,nr, .,J~n, ithm• hll•,
A Process Sched_uler sch~dulcs dif:erent processes to be assigned to the CPU based on particu lar schedu ling algorithms. There arc six popular
process scheduhng nl!\onth ms which we are going to discuss in this rhaptr r -
• First-Come, First-Se,ved FCFS Schrd nling
• Shortcst-.Tob-Next SJ N Schednli n~
Priority Schedulin g
• Shortest Remaining Time
• Rmmd RobinRR Schr tiuling
Multiple-Lev!'! Qnc:ncs Schedu ling
These algorithms are either non-preemptive or 1>1·eemplhe. Non-preerr,1,!ive algorithm ~are designed so that once a proress ~nters the ru nning
state, it cannot be pre~mpted un til it completes its allotted time, whereas lhe preemptive scllecl uling is based 011 priority where a scheclu ler m~y
preempt a low priority runn ing µrocess anytime when a high ptiority process enters into a ready state.
5 a
5
i s 8
I_
PO Pl P2
............ . .
(; s
I
3
P/J (I - 0 ·= ()
s . I '-' ·I
f'2 H- ~ = 6
P3 16 - 3 " 13
h ttn..: ·//v,H ~" "' 11 it n ri~ k nnin t r f .YJ/rni - hin/nrintn ~ n ,:, rni
Operating System Scheduling algorithms
Easy to implement in Batch systems where requi red CPU time is known in adva nce.
• Impossible to implement in internctive systems where requirrd CPU timr is not known .
• The processer should know in advance how much time process will takr.
0 8 16 22
Po :J - 0 =3
P1 0-0 :: 0
P2 16-2 = 14
P3
• Each process is assigned a priority. Process with highest priority is to be executed first and so on.
Processes with same priority are executed on first come first served basis.
~ • Priority can be decided based on memory requirements, time requirements or any other resource requirement.
P2 2 14
P3 3 6 0
-·-
PO P2
0
I
14 22
Po
9- O = 9
P1
6- I = 5
P2
14 - 2 = 12
o - o ., 0
• The processor is allocated to the job closest to completion but it can be preempted by a newer ready job with shorter time to co1npletion.
• Impossible to implement in· int~roctive systems where required CPU time is not b 1own.
• It is often used in batcll environments where short jobs need to give preference.
(1 ::antum "'3
f1(l P1
I !
I I I_
6 17 20 22
iJ 3
Multiple-Leve] Queues Scheduling . . .· t' lgorithms to grnuµ and sched ule jobs with
. I 'th They make use of othe1 cx1s ing a .
•d d t scheduhng a gon m.
Multiple-level que~es_ are not an 111 epen en
mmon charactenstics. . .
co 'th common charactensllcs.
- • · d for processes WI
• Multiple queues are mamtame
• Each queue can have its own schedulii:ig algorithms.
• Priorities are assigned to each queue. II 1/0-boundjobs in another queue. The Proce,s Scheduler tlien alternately
I CPU-bound jobs can be scheduled inhon~i~e:aes:~~~ the algorithm assigned to the queue.
For examp e, h queue and assigns them tot e
selects jobs from eac
OEGO RENNGIINEM A
COLL E ERING
OF
DETAILED LECTURE NOTES
Class/Section·................................... Date· . ........................... .
Campus: .................. Course: .................... . ...........................
Name of Faculty:.....................................
Name of SubJ'ect· ............................... Code·
~r { o'1 v-t,., ~ « .
t f1 I h-- ]
!1
§J
.
a I
.t1 1-S
(j ·~
_J
r J ~1
f1 P:11L PJ );c ~ 2
(a-¥}' ~t ,j )irt,:J l~r1J ~: ) ;l~Jt10 Ji'M
-t vv4 bu AM 6-f- v--~ J1 ~ t, ,---q :q ~ h) ~
2
s-
~ l dt L1HJ t l )1..-,--'L) +L1 - '3) t{g ~s) ))r
~ 1'1}s 2-- 6~1-M
"'( ~ ,P., l •~"\>T"I
A
if\f;
J•OOH.N.li\lfl\1,';
r~·
RENNG·IINM
'W!Jt•'
O
J\ \ll~ l {
O
ll (
·f_
r: .
CO LLEGE EERING OF
DETAILED LECTURE NO TES
.... Date: ........................... .
.................... Class/Section: ..............................
Campus: .............. .... Course: ............ Code: .......................... .
................... Name of Subject : ..................
Name of Faculty : ..................
-r1'1"'{_ ::: ~, ~ ~ ,t j~
&1) · T~
" lM,l XM ~ (v v } s eSJ;
i
?- c~H)) -t Ltr -o) tl I g.-LJ i-
l Rr'.:l) .
I O '1 . I._ Il I~ ~I J,
~ ~1i~ ~ ·M
I
fil ~ t J .~ v--z t7 fJ 1~ 2- ~ t_. .
I 6 ~- fl--k-rJ j-Jb}-:~ ~ J1
Page No .:
.
T filir T ::-- fJw 7 T [,, tr} ~ t.,-J,j'o,, Jtr-i ;j
~ f-r0l!,vt.
rn 0)
I 01 ~ P.. ~s t Cb-1 <2t rtJJ
F
..r -,,;,
,, .s~~:i:~.)·<~~if,: •.J~
pOiJllNTh1A~
foi,Jlf·' '-?r:rx~1,,1:1rrm:u_1
I
1"·,
.;.:~
'
OORNIMA
-·~- COLLEGE ENGINEERING
. . '
.
.;,7
:t. .~·
.,
,·
OF
DETAILED LECTURE NOTES
Campus: .................. Course: .................... Class/Section: .................................. Date: ........................... .
Name of Faculty: ..................................... Name of Subject: .............................. Code: ...........................
[-- -~~---~
lo ) ._, ,--¼
r, Jo
'1-- J - ~-
- -- -
'
~ lo
J
A_
~
l --
' ~
1
1
P1 pl- f2
~
P2 f1
- -
)
e) l. ) . I ~ · g l?-
)~~ / .~ C:fAJ N.j' 11 .b { ~~ ~
r fN u
th ~
LtA1 v-t-J:,ci
~ ~ \ , {NW!
t¼ Lf 1) kljl J- J:jM .
i~Lv
~~ j-f~J •-f:-,G 7.,/Y'( ~ r~ ~ ·W,j
1•
I
II
I
I I
® i (g- 1)
I -+ ~ ~, J
•I
I
cJ-2-
S~1(
~ l
8 0 0 1 ))--
(
1 ) C r-
f3 1 1,
Jr )J 1-fo
s J
s 2 Io
~ ~ ,)' \~ ~
-----
[ fir"j_r _. --r'-~w,IJ~ f ~J ~ Jl:,,,-fJ- J
\_
0 ) ~,
~ ~~j ~~\ul~] t
~ r t ,:
(_ H )
T l 1 r~~)
+ \'~~ 1 ) )
~-=-- £x;
W ( lu,.,- ~ tr\"'{ :;;
; I1- i l r-- 1) t l ~ ~ 2-J
+ C10-JJ .
'1 7_ lJ
\
> -
OORNIMA
COLLEGE OF ENGINEERING
DETAILED LECTURE NOTES
PAGE NO . ..........
{µ~ &,l) .k
,--muM ft-w-1-bj~ ~ ;VrrJ-10 ~ ~ Cf1J _
JJ.-t-H. ~ fa 1,,-e_ F µ, )--OU, aJ- tt ~ //4~
Rs qVL ~ ,l;) q ~ ls>. ~ ~ 1--t-J ev_J_
ou7
~ -}_µ r'l.lM,,U ~ ('.g,,,~ . , ~ ~ Jj~
qV'UfaV f r Ji~,,_,, ~
}?Yeo.±
7-f o ql/W-,(_:::;) ~ tk ~ ),j ~ ) rr~
J-) o ~l>YJ j_g ~ / ~ U- r ~ ·j)_
71 ° 1vt)lv't.
J\)~ q~ ~ Pr ~ ~ ) ~ 1'}!,rn
f'/ w J11rr Jd~ ~ v_._ rut
9~' fj I
fn:«-H ~~ ~ I