0 ratings0% found this document useful (0 votes) 86 views20 pagesUnit 3 Operating System
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
Unik3 (ePu Scheduling )
___ full oxpsotnark on? : =
Agenda.) objective : a
4.J CPU Scheduding and Critevt. for CPU gche
duiio ,
21 Objectives of Cpu scheduling. =
al “Preemptive VS Non Pie -ey
mptive scheduling,
4} Operation of mulsitevel schedulira .
S.J Short. term 2 long tev Schedulin.
6J State of procere T1 process state! diag ram.
3] Procers convo blook and T's campolfenis.
“l9.J_ Difference biw Schedwters.
9} Precers addvere space.
to] Process Mertification tnfovmation,
11] Thead 2 TS aduantoges , implementation
YoCes , types. Z
12.) User Sevel thveads yg Kernel Jeval thread.
13.] “Thiead us Process
19.3 Thread Gncellation.
15.) FCFS scheduling and tts advantage,
16.\ Shortest Job Fi¥et tes) scheduling algo,
odu. 8 disadu.. =
12) Priority Scheduling Algorithm , adu+ dad.
$0.\_ found “Robin Schedulivig AlgovttAm om
19.|_ Mult Deve feedback queue” scheduling.
do. Mulffprocessoy scheduling .. u
ete oe
1-7 Varfant of ound Robin Khedullng.
a
22. Deadlock. | Resource allocatfow
a
graphs
Banker's ah, :
Oo247] Dead.dock V8 Sievoadon=
—— oy
Like y Shave, Gubgcribe- .
4.J cpu Scheduling -
> Management of CPU Yex,ourvceg.
2 Sechéduding mechanism fe the part of
he _ process ‘mansgey.
3 Hordies Removal & Selection of POCO.
> Tk is the base of mutt’- praqtammin ch
System.
Jd we Tncveases cpu usthigadkion.
Scheduting Critevia-
4.CPL_UtitiaccHon
e Average functton af me.
* Range rom ay. t© 1007,
2. Thro aghput :
At Yefers 40 the amount of work
completed in a. umit of time.
«the highey the no. the move -wotk
is done by ‘the “aystom,
3. woot Time & f
4. Turnelound Times
Submissionef <> Comphetion of
Process Proce
Turnaround Thme.=*Chaman Tam Waise Tr RoF ron Book, —
_____Fadte? fn _ a
Okjectivet [needy of CPU scheduding Se |
4 Eptfcfeney 3
| 3 Meimut Throughput
|__ a _Min?mige #5 Refpowe Tine . a
| 3 Minimige overhead
~ Maximige Rerource ase
3 Avoid ftnde finite postponement
> _Enterice prfavittes.
y La Pre- -emptive Scheduting yb Nen- Pie-emplie
Scheduling - a
J £
fre-emp tive Non pre-emptive
7 Processov can tun [> One Lxeaatioy,
aathey proces white | staves then after
QuiEnd PTOCEIG ex Corr Compledron othey
kon. PYocere can dun, =
2 efy wWgation #8 [> os ehu_udttagton. —
more.> bess wetting x ~ Move walting # |
Respome erie. Yerpome tne”
> fdexfhie 3 _nigid. |
2.89 SRTF, Prieiity | > &Y. Fors, sat
Round - Robin eke prtovity eke.
tobe used fn computer conive 2
whe non- pve -empitve scheduling fe nity
Operation of Muttt levet scheduding :
I
~_Heve p¥ocess queues ave usthey ‘divided
irks Peveral A queues. :
[> Each queue hoe ite own scheduling
eulgovfthm .
[> V for example : diffevent-o queus can.’
be_used foy foreground ¥ background
proces $a.
Aiqhest prior te
Oe
Zz System Procpse, —
— Trevactive Processe3 —5
— Trtevactive edittra pfoces —
I
—5 batch process —>
il — Sssudent proces —
Jowat priority -
Kubseribe tos Sant Fraginess Babu:Bate}
Page: —
as]
35 — Shott Term Schedueling Objective & Tmplem
entation — a
> __Tnevease Sustern Pevformmance wrth the
chosen set Lot ext teva.
> Tk is the change of Yeady state to
Aunning state of the pvoceks.
2 Te 's aio _eathed CPU scheduler,
(alakulelabebast
Long tevin che dull
YQ _obteckive Z: fmpleme. —
ond md me
7 Main obfectfue fe 46
provide balanced —
execution.
3 Covtyatly the d
eqvee af multe proqya —
mming, Zz
3 They detexming w
hich pYoqiams ave —
admitted to the system for predentin 5
= Tob Scheduler JU q
Select pYoceva from queue & Soad
sthem Frio mah Memory for eXeation,
:
§ 1 Skates of Procae. | Procesg Trantdton
Dfagyomn:
J
= 1. New 1 Creation
a Running 2 creator of Mstructong
8. waiting Woaiting for other procws ereauden
4 Ready + assigned ~6 processor
3. Teva noted < ercutton tnished.Sch : e
[ile oF waa sheduley_dpadch
= xlo at event
Completion
wart
Gntert Switching A
4. Tt © a mechanism +o stove and Yaire
‘the state ox contert af a CPU in process
‘biock., So that a plore? ereation can be
yesumed foo the Same point or a JateY Line.
2. Tt aflowe mult? tasking ,
3. Tt oecuys when prams cxeusion &
chang ed fron one to they.
Process tnuciwed im contert Switchira -
od
te Save the cordert of the pyoceisoy, Mmetuding
proqyam coureY_and athey veqistes. J
oT U
2, Updoxe the proces conties . block of the
proces selected. This included changing
the state of this process 40 dunnine
J
3. Move the pyocas contiod block of Ais
il procms te the Oppo priake quente ,e pincers waa
ptaced fn the Swipended state by Hselt ov
oS.
> Parent procars YeQuet °
> Swap ph
> Other Xeason
S.J _Procers Ortial block >
4 Tt Ba datactiuokwe used © steve the
information about the ptocers,
> “his info. is wed by CPU at tantime-
the faltowteng ave the information that 7 cont
ained by cintial block.
2s Namiig the process
+ State “Of the pracers
* Resources allocated Jo the procos.
* Memory oocated to the ptaces
2 Scheditling fnfermahon
* Lilo J ofp’ devices associated with proces,
Process Id
SS
Process State
Progam Counted
ister Mnformetion
NQ_thfovmaton
Memory tated infovmadion
Aca oa thfo,
| Stak tae eS 6+shot “Term _Mid Ter
GY tong Term.
schedulers schedulers Scheduler
de [Tab Shedtudor | CPU gchodulery | P-1oce3 of Swapp-
ing scheduley
Q. | Leis Speed Fast Speed Medium speed. -
3. | Gctvats degree | Les conttad over} Reduced the
of mulit- pirag-
degree of mutt | deqice of ams
Yamming . ping varnrnvng. | ptoqiaynrning -
q.
fibsent ov'minimal
Minimal in-time| Tire shay ira,
in-tme- shaving.
sharing system. |sustem we md
so
System. [term mheduler,
5. (oak) RAM @) 2) | P. can be veintyodued.
AJ PYecexs addvess space.”
> Process addvexe space means a space thot
is allocated in mematy fox a process”
2 _Add¥es pace fe a space fh computer memory,
Cg
a fuety proces Fos an addvas space.
2 Phusicat addrere spi
Addvexs space i
Cx
SUTURE RIATETS TpaAcS
eatedfy. UM. }
LAL
8) Procas Adentiticatton Information .
4
as
uu
Tt ’s 4 of process.
3's fafo, te tecovded fight after the process
[Lis _eveated o¥ boxn, i
see ess)
ff
_ — -
‘ 3 4. 2
> Ws fd fs very umrque_t = _
ait we fattdwing numerte tdevftioye, ~—
a
bs UTTGRE provers CdewRttey——
B User fdenkihrey, a
9.) Thread — Ss
x Tis a flaw of eveeutin though the
process code. a
*& Tt has (U's own proqiom counter, a
system , Yeqistey, stack. 7 =
UJ « Fath thread belongs to exactly one
process. v oe
_No thieod cant exist cutside the praca.
* “They ave wed 46 achieve mutica ,
| Tete Yieia Ftey | Cor =
i ace [sine Register) aE
I Sead s) a | a
: Rie a
| GB Sigle Aead =
| Adi Jo} — =
| > Thieod minimize contert swttohing Une.
7 Use of Thieads provides conoeuvreney witht _
G process, S
> Efficient Gommunicadéon, x
2 Economie friendly . i
> we con achieve nuiltiterking,
J— ta ene
> Threads can he »_be tmpsernendod aif
Aevet.
3 _ User devel thread % Known or
Josey actuodiu. :
| Aryplementedion. of “Thread; - oe.
_@ Thread implemented on fn user space-
7
i
n the kernel.
& it simp.
2 Thveads Tmpllemontation tn tevned 5
: Th thie procedure thveads package enticy
~) In -his no thiead -tebse 1s proort
> Th a thiead wants to do any operation
Tipsy do kernel call.
= Here the? mformation % the sare @
[utth the user Jevel thveads.
7
G Hy bid ?mptementasion + Combination of beths
= |
{
to.J | wer Level Threads
tleynel Level Thread)
Qtower Jo create and
Ae fous to evoate and mana,
| manage:
a. Mim plemented Pad | Kevnek Revert thyeads
neat Sip tox at ate spect 4o the
wer Love! - mg Sustem. '
8. an tun on ox. Se asin specific.
4. crit, proutded at the|_tleve Keviveh a
tee Jeuvel called Support (
user Jovel thread. |4 11 “Types of “Thread -
1. User dever thread -
> Alt of the work of thYead managemert-
done by appureation. v :
a Created, destYoyed ay we can Say that
impoemented ustrgq Fhiead Librovy. 2
i
user Space T read (4 ig
Kernek Space
GD ;
Advantage ¢ a
> "thread switching does not require
KeYnel mode privilage. J 5
> _e@ &r kan any Operating System.
YD Scheduling cay be” applicakend spec Kio,
> fast (© create 2 manage.
a
Disadvantage:
2 Ine Eypreat O8 , mest system cals
axe _blacking.
3 “Mult threaded appltoation cannot
take eovanege of mult! pro cesoing.
J
2. Kernel Level thread:
Hee thread manag ere rst ig done dy
Kein eh (Self,
> Kernel threads
O%€ Supported divectly
dy 08. : SS
U> Sehedutig by-the kernel! fg done on o
ahread basis’
= Imptementation fs done_in Kernek space.
Advantages §
~ Tk con stmuttaneo gchedule mbtiple
threads from the same neat on raultiple
pYocesse.
> Tf one thread fn a proceds 7s blocked,
the kernel eon schedute another thvead of
the same process.
> Kernel voutines thenelve can mutt-
thread. ie
_||_Digad vantages -
> _ Slowey to create and manage.
| 3 Traméer of contval from on’ thread &
another within Same piocBs Yequeyeys &
mode switch to the Kerner.
12.5 Thieod Process
4s [Tread ts called Light | Process fe caste d-heavy |
eight process. weight preeas.
weight p ight proce
2. | Thad switching doe
Trot need 40 caWan
| operating gygtem ard
Process awitehing Needs
frtevfece woth
eause an imtevvupt 40
operating system.
TU
the kevnek.
3. | AgLthYeads ean shave
Tn muuttiple pyocas
Sayne_ Set of open fale)
fmphementotion ead
child procers.
process executes the
Game code."> blacked and wal rg ; is_b§ocked no other
second thvead_fh the same | sotvey pracas can
task coutd yun. execute Unt the
feet process unhlo.
eked.
&._One +hyvead ean Yead , In multiple process
witte oy ever) Completely | each pYocers aperortes
wipe out another thyeady” frd ependevesla of
Stack. the o-they.
: ~~
4. while one sevuer thread | Tf one serve PYocer,
Lobel cheat
‘| votes Thread do nat Yequive any cman to be
execute.
Thread Cancellation t
Task of terménesting a thread before tt has
Completed.
> Fey example, If multipte thveads ave con-
cwrentty searching through o database and
one trend returns the Tue. the temaining
@ +thyeads might be canceled.
> often a eb page f Loaded using several
thveods and each image & toaded’' in a separate
thread.
> when a wer presses the elep button on the
browsey , att threads dJoading +he page ave
canceled. v a
o v cf P—
Siieuthe oF Sail Frances Simplest scheduling alg ovithmm .
3 Te tobiged with“ FTF queue. Lt Enola :
Jike-
% when @ process enters the Yeady gueve,
7S Peb is Littted onto the tail af Me Guene
® As goon ah cpu fe free ,it fs allocated t©
the fist procels of queue.
& Aifter_completion process 78 temoved from
dhe_queue.
_fidua ntage? Divadvanitagg : Q
fetler for Lo79 procera. > Very emadl process should
7 Simple mefted wate for hie tur
+ No slarvation 3 Throughput t¢ not
emphias 'ged-
14.) Shortest Job Frist (SIDE
> Tt velUiG on the Length of proces.
> Gmabl procerser ave run Prt
Aduavetog a: ot Disadvardagel?
7 High Theapa: a > Blopsed Ye tecording
3 Ottves putovieg Wehort > Starvation be
g 2
“ibs. possible fot Lord p roceise
Foltaw won Instaqvayn
(a Gast engineey_ babe.
Jfr
15) Priory scheduling aulgotitm=
mon. pie-empeue algorithm.» x
mast eammonty wed aloori thm. a
each proces (Y aisi@ned “a_priovitq »
process with high” picority yun Hist.
og wi;
biLiuyL
I Advaxtagel-
|S UPriotty ean be selected . based on ‘ema vy
| vequirement’, time Tequuitement usoy preference.
| 9 Assignes_fmpartance to pYocesse?
Disadvanfagg, 7- :
| 3 Te Wher priovtey procera) we up alot
af CPU thle , Lower priority proce) 9 may state.
[4 Assigning preovitey fe W sevsitive work
do,
-
[46.3 Round - Rabin schedudiva 2
U
> Stmttoy to FCFS algorithm.
| 2 T's fe wed fov Rme shaving gustem.
a Hele the teady queue fe cfvdutdy
j queue.
> pv scheduler start tiawersing The.
queue and ausign 4 quantum Yme to
eoah process .
> Then there processes ereeltes on thely
time_hasis.Adu 23 ¢ :
> effective on_tme- shaving syetert o¥
—— eae piocessing system.
2 faty-Heatment fol all the piocesces.
> Overhead an processor 1¢ Low.
> God yesporse time.
Oserdvanieg e-
> Cakefeully chooging of quartam value.
> Procossnd overhedd ts theve in-handting
look inter sup.
> Throughput fs Sow Ff time quantum 8
00 Small
1-3 ePu Scheduling > akyedy covered:
Tt
Mutitlevel feedback queue schedui7g -
+. overcomes the problem of multilevel
queue scheduling alaovithone
3 __ separate Yroclses with diffevert cpu
burct_tme.
=)
thone pYocas user too Much timed
move tt to ~owoy p¥iovity queme.
> TE allows procas 6 rave b/wW-quamg,
> Tt implements twe oy mote scheduling
quevgs,.
J
£8.J Mult? Processor Scheduling - |
2 _one a multtprocerey Scheduling fe Zp-
2 Scheduling done wind mnuublipte procesas.TTeda/! Numericals- ; ‘
19.J what would be effect of pusknd too
pointers %6 the same process tn the ready ~
ques 9 7
20.1 Peadsock
eet :
shy deadtock axige -
Mutual exctuston
Hodd and watt.
No- pye -ernptten
LILilie
Ctrewley wast-
Mutual excturton
Hold and weft
appvoacher of preventad Con :
>
>
3 Ne pre-emption
>
Crveuley weit -Dead tock avotdance
D__ Tt allowg the three Necessary condHors
but makes judicious chotee to assure deadlock
oint ig nevereached- ;
> Tt allows ma ve conayvenoy then
preventatton does.
2 “hwo Approaches ave used to avoide dead -
Lock —
*& Do mot start a process (ft (L's demand
A0eads to deadlock.
* Do Not grant an nee rental ete
yequart 0 K process ff thie allocator
mignt Lead to deadlock. :
ue
System can be fs following gtatoy~
U J
Safe.
fax
uate |
24) Resource atoratton giaiph:
2 Guiaphitgat Yeprerentation ww ONIG
TRoUVCA SF procusg.
Resource 3 [ay Ry
Procas— ©)
=da) deadlock detecton’,
= (ETS a process of deteminiva eldhe
deadlock fn _a system: J
deadjock defection appioaches -
> Single frstance af each vesource type.
2 Sereval_imtance of a Yaource Jtype,
23]
Bonker's angasithem for avoiding deadsock :
oO
~ Tt ts an yoourde allocation and deadlock
avotdance algorithm.
> followiig date stiuckive ave uaed bo
?mptement “the Banker's algorithm.
4. Available!
1P aviay of available varourcg.
J
& Max! 2d arvay of maximum devnand of
earch process.
3. PUocmtion: 20 aviay that define the
mo, of Yesourees atlocated each proca
4 Need? 2D array that inateatey the
aemaining yvesomicad meed af each proces.
F >: Fase} ——]
| toner go. wer bon alge lo aie
deod.lock: 2
—— | 4. Safely ataortthn |
Qu. Ressiee vquat algor"thm, \
“lechniques to Recover fiom deadlock! i
O_Pocar Riminaton
bs Abort all deadlocked procescal
Ey Rott one pvocess ak atmo,
GRaovice pie-empuon,
3 Selecting a vietin
+ Refback
7 iM the procerg
|_ Like , Shave, Gubecribe,