| CPU Schadling '
The mpenating Syatenn must seloet ene of Ho processes Um
the Aeody queue to be exceution. The Selection process
us Cavried Out by the CPU Schoclulee. The Sehoolulor
Seloets O process ko Tha processes um “the memory. tho,
Oxo. Arady obo -excente and aWlocates Hie He ceu to
Bask process.
Poocess 3 A Progereu becomes a process when a execu
ke 4 us Lyacleol into memory. Tivo Common Teehwrgues
for Loacluig executeble files are oleuble- Checkin an
eon sapscsonding Ha executable file aad enter, the ame
6 He exccntable file on fe Command 42L
Qi- Process Acdvess space t—
Process memory Lis devided! dno for Sections Steck
“The tect Section Compsises the combiled Program [———y |
Code, foad dn from non = Voilati le Storage When [
The Program us taunchod. heap
+ The date Secton Stores global and static Vortables,
collocated and umitiabized prior ato Sxeestisy ae data
+The heab we wed tev Aynarire, memory allocation [jet |
and tin managod Via cally oy new, delete, malloc , free ete.
+The Aleck 0 “used fee Socal Vorstables Stace on tha aleck o
Xerewed fpr Jecat Vwelables when Hay are Meee re
Us frend ub Whon The Vouables ge owt of! Scobe. , Note. al Ae
Steck, th also used bp function Pein Valuax aud the oxact
a se tonguare é cer fec
0,Process states : a
Each process mney be un bur op We potewing tates i >
New > The Process us being Created.
Running i- Instuctons ae being erceuten|.
Waiting '- Tho prowss us wailtg $e Aome event MW occba,
(Such 08 anI/o Completion 07 rap reeception of a &¢gnal)
Realy. The proroas us wothing tp be assignecl Py «procera
“Texminotesl \- The process has finshed ercention. |
|
freemptive Schedubup ¢—
CPU- Schecluling decitious moy take prec Unde Ho
free Circumstomnces —
Ir When a process Awthches tpn the Runntng atake Ho
the Ui Alate. (ms Soaudt of To Aap or ay Thvocation
Of wait for the Seromtusstion Aone of Ho child processes)
2 When a procwas Autiches fre jounning sbate do Ready
Shale (bor Crauple, When an mberubh occurs)3B. When a process Guitcher fyom the Wait state ds Ready
stale ( fpr Example ok complehon of Go)
4 when @ proces terminates -
° HK Ygeiowds Tens Related bine Ge
Schedubing Cribesice 4 Process. ;
CPU Utiligation i~ we wank to keep the CPU as busy as porible
, CPU litigation Con Lange fem 0 Fb 100 Percent
Im va Asal Aystew, ik Should Aauge from 40 Poeun C po a
Aig hey Loodled Syslem) tp 20 Percent ( for a haavidy use ysl
c.
Theoughput s- I] the cPu ds busy -excenting processes,
Thon work as being done. One mensure of, the Work. Ub the
umber, processes Ahab ove Completed Per. time unit
Called “Theog hp.
“Twmorytound dime Twmanound ime cs thas Sie ofthe
“Fetods spent waiting. ao get uito memory, usaiti
an He
ng
Aoacly quem, executing en HO CPU Land ololug To,
Whiting dime 2 Watling dime is Ha Sun of He periods Apenab
Waiting uin He ‘eadly quence
Reshowse dime i- A precosg can brocuce Some Ott bt fairey
and Con Continue Computing Nets ResuDks While Beret
Previows sosults are berrg output Tl tho Unser. Thus arcthee,
Mesure os dine feo the Subimission ot OO Koqusat uxt)
she tivst Aesbonre Us procluced, They Meadrure, is called
Pesspome Pesporse time. & Response ive! a5, Iter eld nid
Lakes te start ruporseng not He time af dake Us He eufpet
The Atspense . ®aking! si ftock, P28,
For each brocss thors us a process Combine ie a
wokizh stoves He fellow tng ( ctyber f J precise ~< pool bre dnporuesion
4. “Process. Stale- “te Stale Moy be neu, Aeady , Running
te and So on.
2. Process ID, end Parent Process ID- “aig .
: s- These need Bau
3. cpu mpistees cand pagron Canle’ in and out of Hie CPU
Dal sustoved when secapping processes wn
4, cPpu- Scheduling Information i GA Such as -patority Inf
mation ana poimters to scheduling queues.
5. Memoxy - Mamajenest Trformration i Eg. Fage tables or Segment
ctaloles .
6. Recounting Information - usec and Kernel CPU dime Consun
Aceounk numbers Limits, ete.
4 Ilo Status coforwostton tH Bevicas allocated, oben file
Fables, ete.
AK Combexk Swtlch vis the machimiany ay Store P|
And Kustove Ve ane = ae Bes pu | Process number,
pia meee Poe ey ete)
potak ak o. Loker dime, ustag thie techniny sogcaters
a Colext Suitchee -enaloles mutt ple byocenes ;
he .Ahavre Song le ceu. memory Linctls
Loken the Scheduler stotichos the CPU fom | Lit of open fles|
exccutinp ome proceming Ue -exeente another. fee ol
Process StateStadio + ae Li Lis a process 6 sea tobs
procs wl! exon. me fe Te te baal detecrnied waned F
Tbe | Slactaleting schacliling 1 i
a Schedule - Lang chem Sehudulitgs cleftemunt which Prowse *
on Re Anacly FULit-«
Shoot Tem Sehadulor s- The short quem Schedubee ov CPU Scheduler,
Aeloeks He Ha processes Hat care Avacy excels
Sere nee co one og them
Molina Teem Scheduler :— The meditan Fuen sehoduler, swaps
prrcesses un cand oxt memory ¢ ts optineze cpu usoge
and manege memeyy allscaton. by dlotug Ao, at adjuts the. degree
4 Beet cand pene Lb menary Ad neooled Soepping
ablows the dyslem pause and Lali resume a process aparing
overall, Ayslom offen
Tapes of Achedluling <— alee Ly
d ia Ui se Rats,
Stag Reet Ronin
Pa aan
Two ore 4 Sehecluling Pixs do non reenplive and preewplive
Non - pve empHve - under non- preemptive Achecluling, Gree
tha CPU Ros heen allacated to a process, the process Reops
the cpu until Be it keh Selltoses tha CPU aa
Pr process well release chu outy
IY whon a process Completes wt enocution ( Texminadion §
ay whon a prows wauts Ad pegom Some t/o operatcage S~ und pre-enipitve Aehudlyns , Hee Oucefhe cou
en, Heiproces&, A precess wi e He chu
aks Horcod’-buh So Benes itaenv
Ww.
Preemptive i- 94 a mew process onto uh the Heady
Atabs (me, walling) un Case of Augh pur priority
Whom voces dultches pemm Aunning to Aeadly diate becouse
of time pos expire.
purpose schedluling Abyatih ¢-
1) Matémum ery utilization
2) fare ablocation of cho
3y Maxtaqum Thvceag pat
4» Hininusm waits time
Terminology i= on, Viscious Tina RKebaked Jo the process
Arvival _\e— wothing cline aie Boel Hin ample
tu caxound dime —
Aeciyal dime i The dime ab whech the proces enkrs into
The, peacly quava vd Calla ave Lime,
Bust tine $- The dime amount of Lime Aepulrec] by We chy
tp cxocute tha process us Called burl time
This aean't include voattng dine.
©é Completion Lime The dime at When He process completes a
-exceutton vis called Completion Taine »
Faun aound Times- The vampunt of Hime spent by fAv press
fem als aorlbval to its Ce teatuee
Tit = Cie oe
Turn paound Time
TAT = wT+ BT
cee The olispodcher, vis the module thd gives
Dispatithes :
Controt, of tha CPU co process solocted! by the Shoxt Lem
Achoduber :
This von nvvobves AAL follereng : Auitching Context, seth
Fo User mode, Jumping A tha proper Lecation Un the User
hh sustort tot paren
. The olispatchor bhovld be as pest as possible, inte. Tf vio
Unvorked luring 2venp iris gate Aha Hime at takes for
“fa dispatches, do Stoppandl Larch anothon KG bao
as the olapetch batency
Threads amd. Hiei. Manogemont
Threool is on undlepende rt ‘eroeubion unib wither a process. Eat
Thread um a dyztem has a thread md, Poogrom obi ek
‘Soe x
» hawe multi
process to
ils oun Aagister Sets ancl tack . A process cov
“ple Hiveods but sthaad hos only one conloimer,
Which uk belongs. The trads hove code ection, data seche
Aechion, fle lescriptows cand othe Ayslem resources wi th the
Ole Bxeads Um + Some. process Thus threads Can excoutes
pax with owe thawacls, belonging do Same Pancers. One
important thing da that a thread ds not a psocus by self
So ut Cannot aun 6n dds own, means thewad exeeution hoa
a be sinthialized by the, provus din which uf us Created
Each procs un a Computer system has a. unique adlelrcass spree
sand al He Hscads cxanted by a. particubar. process the
Ha -addbass spore of that proces and also executes
i wh othe Heads witedn He prown addeess
, flo Likt prowess, Hreads aloo Rave dfate aud aiff
eee eee 2D, dupe
given Unitanee & time. A dyskem thah supports hss
mnrdul. ju duns os Mabtiixccled Ayshem. 7 thecad vis
also Calter! a. Light weight prec.
Single theeaded process and Multitwuaded process 3—
when a preeiss dba oxcenti ng ak ads as a maim thread,
the Game fiug.
Meows His matytiyead and proens ave
Tk ARs Ipovens [ov Moin tovad) doer nob Create Howaols peehoriug
ug, Hark. ak a tit aud waiks wutil a tase vs ini before
tating amolan one. than Sin in Stugle Dread Schon -
®Tt athe brocess ( Main thread ) creates more Hyreads (and each
Hscsad may creake yet more Poewads as 22974 wed) So that
vaeiouss tales tashs of 2 process vis ecb divided aniens..PAsoads
uspewith 0ack thread alocug ls Lak, etudbepouclen cane Stud
Faneously woth ofkoe Hheads then Ahir mublith stag Ayslow
Single -thrcead| Process Mubti-thxoad - process
sto, He Modeun
provided dp He
ene -Psocess wdth Re Righoe poloxity.
Troe vd No gonuel agreomout on whobhor 0 us tae lighstor
Upoosk priestly, dt Can Vary tem Aystaroste system: ©
process whlArvivel Time O
‘Poiovity Algorithm ( Non--pse-embHive) method
ee Joka Waik:
Fg Sat ity ge Be
fi lo 3 16 6
Po. I d- 4: 0
Ps 2 4 18 16
A 5 19 18
Ps 5 2 G |
Average Coe OZ
Po. | Pes P1 Pa | Py |
od 6 16 8 17
The Average wabk ctime is 8:2 vmillizecond .
x - ep,
Papas AT Br Priva ky Cerplehiow voattf ug?
fo 4 4 5 L
fi, 2 2 5 IT 15
Po, 2 3 % i ‘10
ane 5 ala) I) 5
fy 1 5 18 LT
ow 2 6 15 13
Z Po P3,
eo aed 10 1) oRfawily av wr Prlawtly = Complete woaitfeg Thor’
ae 40
Pe 1 Ws us 14
Pi 2 2 5 14 12 3
ee lo 7 :
fe 3 5 3 ® 3
BE Se 15 14
ee 2, 6 15 13 H
eee ae
63/6 210s
Wy e\n | % fh lee [a[a]e |
oO 1 2
| 3 8 Jo Oe! eels iB
| Advontige - Gives a facilily sspectolly to Aiplem procs
Aloo vs do Aun Umpostart pres even if Ut aa a user
-Povcess
Disadvantage s- Hee poveess wth Ha smalloe Ppitortty mag bho
for He cPu
No uiclea. of Aasponse Line oy waithig Hine
ound Robin sekedubing s—
HeRownd Robin Schodubing algorithuy tiv deiqned expecially fpe dime
Shactug Ayton. Buk b Hey as added ty enakle Wu syplem Je
Suite wy bvoteas 0s. A Bwoll ctime unit of Hime catoad
O Aine quantum os dime slic. A atime quoatom os genoa
Jo A Joo will) sSeeonds un foug th whe Roady Quene dn Teoaded as
R Cretan Grout:The CPO Sefleduler goes around cba zondy quane, u
the cpu do cack process for a dime ntowal of
up dp 1 Ams quanta
we cpu beheduler piths te Pisst press fron the.
eee Alls te times 1d dnlerupt afer 1 Aina
Qua cana) olispelches His proces .
one f chino Het wey Reppen then happen. The prrcs
have a cpu buat of bev thaw a Hine g woulunn .
Im this Core, fhe process atself wel) rodeace He < PU
Vetuntarily- the Schadubor Wolf Hen process! to tho
nent process ein the peady GULue.
I The cru burst of He currently Aung procus
we donger qhan 1 tims quanta. TRe Himee scl Go
offs ond warl cause an Undovupt to Ha oporatrg
few. A Context 2ustteh wel) he -exceuteel. and
oe earase itd be, fe at Masel os HA Gs |
Guanes The cpu Schodulor will ton beboet Ho next
peocess ins Hie Anat Ques
Rourt Robin Algor! Ho (nbn pseemblion ) MeHod
my
Procons Asdtvad Quut Cobley ~Tivan Proauel Watt
No Time Thme “Tine er ual
tt g HAE 6 c
Po. ; 18
x ;
Ps, 2 a 4\ Z . :
fy 3 | q f
es 4 g ch 2] a:
% 6 7 19 : ie ODAA Ii Ps pa Pa Bs BS BE Re
[n]ele [es [tm fes[e [me [=] ]*] Pe]
Om HO B= Sg I IG aUtS call AURA IT ed
Advautages— best cm deems of Average Aespowoe =
“I caer Wil) Un ren dime- Shoring
Systems, Ciend Seaver archlectors aud Unlecacttve Lyslem
Kd of STE Tmplemert=sion
“Disadvantages pees :
Long process wy starve. performance dlependa heavily
on ime, Gusicteom, aes Volo. of Ro Gana, qusitun ur al
dow 4Ron ct will give Lower average ALsponse Hime. (Jeof! ¢
but tolel no of Cmlext Switehos WW be more, So cre utili
Bakton writ he Lew), if dime Troudem eto Lage + Rave
overage Aespose dime Wall be more bad, but ‘mo of ean tesct
Svstfehes wal) be. Lex, So ceo Wlization WEL he i
No seo of priority, d
mE Muti loved Quour eOheaala od
Multi devel Quoue SeReckuDing Rad
he BR Wy Oo eee ato ale eR procera
inloractt Me ode a
day ve’) Pooeesses ang hackground (Batch) eer bee ou
These. choo
Boch ed pentose tae
A Multilevel que Sedtcbing ate Cau en
Arad quous ic. Several Bepdrat® queues. Re Bee
Ove speemanentty owmrigmed 35 one. qunus, Gomalhy based on: Lt se, Each
Such ad meuiory, Sige, PROTSS sioxtty, oy preceso Fyjp -
ae
i |
Se rea
sada Fre
Aotsest pretty :
cies eG)
Multi tevel feod back queue Seka clubing Algorithms -» i
Mui tue quan soheaubing HH DB wed pweorses ove peenareetdy
Gusngned Bo A quis when Hoy endo He Gussmn System. 25 ies Oe
Ssposcte ques fps foreground and background processes, 4% Exonple
Fpooesser do uct move Pam ome que do the auother, Srna. proces
oo not Chouge, Roe fore ground aud background nabure this settup
has Ho advantage of to aebedubiip overkaad,
Tn Multi nah feedback Quane Sehadubinp algortitin alles a process
wwe helwens uous, Eq & prreers Urea eo much cpu dint,
AL wal be moved do a Lower —pravihy queue. Tha scheane Leave 2/0
bod and anterodlire Procewses Un Yo Righo, ~Prtort ba queens
Arporcers at woatks ahs tony de a owerprlotly quens moy be moved
de a Righenr - Prterity quence, This fru af agen prevats StarvationDoD DAB Dipti tata ans a Sr cana "
ut Un quis 0. A prererd
A ing ts. ueie is -
Unt oe the ee 8 msec Be pee
not finish wotlivy Hin time , ak din moved cto the toll af queued:
Be quiur 0 Us empty, Ha preuss ak te Rood af queue 4 wo ©
given a quantum ed 16 rwllideconds 24 dt cles mot complete,
GH Lis preemted and ds put dnb queue 2, they pwr
Uv queue 2 Wt Aun on An FCFS baris dub axe Aun
Orly ten quents O Aud 4 doce omply,
~ Multibovel feedback queue —
A Mubliloval fead back quowe ¢ ee mp |
percmecdors i “Te? eames sey te fbb,
5 TH Mumbo ¢ quence.
Se algerittun tor each Gud
ee used 2B elon. ;
Reels mint: chew 3 sbirade. @. Proce 5 a,
~ “Re melted used ob 1
Few dover pitty gees oe ‘okt ab dernole @ brorets
- Thy method Used do dolomere whith
We Fee © bre wot
eutoe,
fon Stet Process Meads Semnicg .
ae @“Deadtock.
Whon A process Pa ws Rotdling the, Ra %uesowrer cand Acgucsbs
a2 bee Ro, Asbrcea. Ld Complete rho excadttour byt flo Ro.
2.
boo The pave Anolhwe spacers Pr, when
i doy a +
AUUBEIML is felch 4)
b 3 Py cabo requeals bo We Resowern RK} ker exooheen
oocess Fy ? (
Thien Conctiteem calted deadlock Conetihon,
For example i- Consiclve & dystom wilh ene evo chelywe wud
one printer. Suppose that process Pe ws ‘Roleling At3. DVD aud
Poocess Pf is hoteling adhe potilec Jt fi Aeeguts fha prliten
aud fj requests He Dvd hide. a clead hock occurs .
Ow
[fF Pe]
Act
&)
Dead sock Chaxackerizahier i
A cadlock Aitustion Con arise uf the
Rol Avubtaneourly cin a Auster
4 Muluol excenbton + At Least one Actsoweee must be. lolol
Wo a nenshmaed-w nonshayable mode only One proces at
O time Com use RatRoopurcer IE Auolkoy, Process cogucsts
dot Ferousee., the xoquusttng poocess nut be delayed until
The Aesourc2 has been weleased.
Keg west
preesing foe Conclitens
®7
rites
| 2-Hotd ond att :- A process must be hotdiny exe act Loase one.
veesouscee. canal woillig ce acquire additienat Aesousest» Hot
care Currently being held by other procuesen
3. No preempPhHen 1— Resoweee. Cannot be preempted Heat us
a sugerscee. can be reelearee| oly Voluntarily by dhe
porcess Atalay it, after Hal procvrs bar Completed ils Lash
| le Crreabac Waikt- A Seb f Po Pr--- Pub of waaictingy processes
mat exist zuch thet po us waiklng Werte for a Resouree
hotd by py pj vis waiting for a Acpowees held bey fea, Stille
“Ay Pn. us watting dox a peesowwces by Pn and Pr ud waiting
for a. wesorocea hele! by po
Resourer - Atlecation Groph ‘-
Deadlach Can be described move precisely uin dowms of a. direekedl
graph Called a. Aystirn rsowces- Llocation graph.
“This groph Consist of a ack of vertices v vanc a Aet of edges E-
The det of, vertices V Us poctitional write divo clifferont Syber of nodes
Pa { Pa, Pe, Pn} The det Consisting of all the active processes
in tha Aystem, ma
Rah, Ra Rit, the Sek Conralsting of oll Aenpeucee tepes
un tHe Syatinn.
A clisecteal edge ftom prveess Pi to Resouces type Rj us denoted
Pi—>Ri ds caltad Resprsh oclge,
A olisected eslge fem Resoweer Type Ra te Process Pi eis denoted
Rss fi w called -an axsigmment as edge, (Aopusat of 4H)
@| volun this precuss RL Aepuesls an vimatines. of aersuses. Apbe Bie.
O request eclge us tnsocted un the Xeoowres- allocation :
Graph . when Aha Aaquest can be fulfilled. The reoquoat
-edge- us Feansfosmed ado an oursign ment edge.
whon fe Process 770 donger meeds caceoss Ho thn Avspunn,
Ub Aekease He Feteourehe. Ha Ce ee edge, us Aabthee| ,
A
© ae
Ro
Tt the yoph choes Contain a. byele, Hon a cleadlock may
enisb.
“Poocess, Pa da hiding om Smatance of Zasource Sipe Ro. ond 2
unaiking for on Umdtamar 4 resorwece type Rr
Process Pr. o> hotcling an imstamee seosoweee Supe Ra and
am umstamce. of Ro_ and us walling for om Umatamcr of Ra.
Process Pa is ng am umstamer. of Ro.
TP rack reroweer Fype hax -exockty one Gmstauce, then @ cycle
Tmphion Mok a deadlock Ras ovewrred 1f the (yee nvebves erty O
Set of jespirrr Types cack af Which has Q Single, dnstence Rom
a. oleadlbeck has ocetursd: Bh A cycle tim the yeph db o
aneconsary but not o. ‘Aufticient Condition for the existence of dood lock
we Aatweun de Reseween- oWlocatton - Graph, Suppose Shek precoxs
Py Aoquasts an dinate, of mtn ob Mesouncee JAP 8 @nary
Since. nd? Asdoweer dnstonce us cirrentty aveilalole , a peaiueak |
edge Ps Ro is addled to the qaaph.. pt thge. fpoted, te
minimal Cycle eust- jy the System . + ; : ’
R2R2 RS Ra Ps —> Ra > R
x Sy & Ap t i
\ Poe Ra Pa Ro Po
Processes Pr, Py wu deadlocked.
Methods jer Handling Deadlock + —
We Can cleads with. the olendlock problem un one of Poco
vous ; j
— We Con use a protecot to preuadt- or avoid dead docks
eraiwamg that He Ayplemy Will mever,!-ewter a cleadlock Stale.
— We Conn. Allon Hoa Aystern, Do enki, a deadlocked sta te, defect
dt and Fecover. \ |
- We Can dgnore, ths, problem, oltegelton, waned pretend Hate
dleadlochs never ecews un He, diplem.
Dead Lock Prevention I
—_—_—_—_ 1 ————_
Thue aw fous 2 CorndiHous (Mutiol ercelumen, Hold dud
boat , No pseemplion amd Cixcilor wait ) for a oeaddork ub ocewr.
Ry -enaurcig thet ot Heust ore of these Conditions Cannot Rotd,
We Can prevent He oréweruce of a deadlock,
u