You are on page 1of 149
Opusutta Sysieon Call: balakrishea veenala Og $b t Paka kn’shnaVeevata ¢¢ 1. Tntwoduetion anal Beaciegrotinch a. Procems Monaguaunt: © proces Conupt: © CPU Schuduling ° Syeuhyondxation © Gnuwunt Progaming © Deodlloccs ° Thacl 3. Hemony Ponagenent: © RAM chip Duplinetation I Loaoling : Ladetng ond aclouers Gruding © Techniques ~petg — Mubkievet paging — Tayo Pogtg — Segmentation ~ Segmented pagisy © Vertwoh Hirwotus 4, Fe Systems ‘Scanned with CamSeanner | 12 [Sane 2019 C¢ ; Tntreduction ard Rackg round / 5 ce Whak fean OS? OS fan Pater b/od wir ancl Compulds Honclwart Ce ge game 7 NNO” us, wwe | ie CF Usex Applications. far x, is T_T pethkf ("Hetic’) 9 oe os ts Tirta Cal gee usatteL) gosto coll frorden +0 Comm» e& with monitor a RIS tt fs vepouibe 6 4% Operating System is alo collet Rerouna Allncakor ,ecsusse {E15 apouilt @ | For atlocating resources of & Compubor } + Rergurces ano cakegoized a ‘tuo typy + Hoxclusou ‘Type Resourcer ~ Dewices Memory Software Type Rexouner— lus» Dimectorder. | Goals Opoaking System & fs Conviniones Gasy 40 se) KTR prfwary goo of os ts ; * Te Strondlaryy oat of os fs ebficeory ( stant by) Types et Qpooxing System 8 (D Baken OS + & onto 4k Tha joets computeat compltly ame chun jaonottasy solo 8 | schectutest Onto CPU+ % Rewtts fr Tnereawot CPO ob, Heneco & ee & ise, CRU THe a j ‘Scanned with CamSeanner Memory ATE the Tob fs Lauiig tin CPO to perpen Tho spear stacy -for execution will be Schuduled onto the cpu ¥ Rewlbsin fnexared CPU ublization % Thexessed through pur of 4 system, Von, thon Otten Jobs wlatea is S 3 2 Exanplt of rau pregrennig OS; wiholows , Unix (ai) A : > ‘Maliaatsigg cae 2nS—b Time alloted for each Tob » [© e Lee» 5 tle + os Memory ge Mulkitaldg is an extention wing OS: 4 multiprogra # The Jobe wll be exeauted fn tne Geamplinultitaskirg 0S 2 Windows, Unix (iv) Multiprocenior 0S + [Hultiple CPUS | Cput Cpu2 CPUS a¢ Trereanedtorougnpur of se). el the system. x o Fowtr tolerance [renont_| i ae Examples of Muttiproceasr OS: UNIX ‘Scanned with CamScanner re NE A aaa (1) Realtime systema ! (TRL sy stunn which au sb seats Hime bounal a CaWleol as Realtime — Rystens- | TRou shouldn'tbe any clalay tn execsution oF i Prograns . |e Cokegorad foto two types (0) Hard Real tae Systuna + £3. Saratite Syston» matsstle systenss, GS Utno hatoy # able accept (bo) Soft Hal rue System 2 eg.- Banting system G Minor delay (2 ; acceptest Examples of Reaittms OS; Seworkss Ve WoNK! » RTOS - le Duar mock operation eTate H/w to frutrucciova. ome Cxeutktol fn de two Lifreeat modu Ue, fe . (1) Usex mode — Non Privetged mode (i -Kemrwh rnvate ~ Partveliged mnodlt, — System modi Nonitorrnod oT dual med operon is wed fh osc to provick Protection and Q eee ty. fo Eek wae progearns ond clo tt OS fromeiront wien” & © Te Ts purty tne dussion of We OS fh whieh. pantiauonmects tua teatiction & PRABPORMaan hos to be executed + fHaEME. 4x at Q@ s ‘Scanned with CamSeanner Sy 8 Genvally the, priodiged frutruch'on axe ex eeukol fn tre Kernel mode and Ton peelaged ishuction axe exeuttal fo the tun mode « © Th mods bit ts uted 4 Cdentify Gr which porticular moc thy frutrun. zy has to be execu: “dkeee @ © The OS cluays sum only fo the Keine mecle. i ae ke . TRL nodsssitecegecaeanp ten eT pA NPN SST * Racwdiger Tastuatons [Esme] += © 1) T/o operation Imp ¢ System Cath ae wually 2) Sek te tu of clock fovokeck lay tg Software 3) Genxexe Switching intooupes. 4) Disabling Frkovupts 8) Chantig tae memory map 6) Changing “the memory map: Non ~ Prfudige Trutructiont Coanpto |] :— s) Reading He Stakua of, procenor 9} Reading ee stint of tee clock The clerign anc Preptmentarion of Ere OS WU LE done f nunbiple Gen. OTHE main ocluontage of thy Coy enrol oPPronh is, adestracston > onadalnity Oud calouggg © Modelou'ty meow if specif Goujon too update Haun PE will nol ume ony Frapacr on our foyer. ‘Scanned with CamSeanner “hv cud cvs ved To operation To Of, tr procenser is Cattgorixcot into 2 types — Synchronous T/0 — Asynchronous T/0 Sgpehroraw To? # Th syndhronow To Hu proces performing To operation willbe placed in AML T[o operation ’s Completed ‘ on sratooegptnsieneenRourine(ESR) ail initiate hth & et Asparerow lo: tre Glockaol state, GUL © Tn axynehronout se fo wrbilr tritading ts Ty requert, “the sagistord- © RigcenmntsensoT iplaciat tate tolackect state auch ftaGontinowmetorerewrkterdlate ued to notitirthe procens C ouen. fo sposation ts compile tis Sinal warhanienn'ts ry will be Qignetnercy that th data i ounilable aud veghiend hanalln ~fonetio tnuoke k- Re aay (J er (Biou) ‘Scanned with CamSeanner Fonk() Syston Gul Traplnunention ote mont) TE prego bos s'N! fore calls, Line piety Hany dawn will be, 2-1 dnilel Pid foruel D5 : iG (pid < 0) Procemer cated 1 priatd (* Chilo proce Cuntion faites”) a i¢ Cptol= = 0) c Print® ("Chilol procem™) ', de Camel Pant procen")5 : ES 0 Fonk fs a Systemcall rurtet-to create Child Procens . . © Fone seetwas, “wt Volar tf He childl procers Cxtabton Proven Cs 'unsiecengytt - o Fork subi , O to tu _now Cunt child pacers. © Fue sutum Fue valar( proces.rD of, child protest) to she parent procens « © Welun “iu clita procen és uated an ris menony (atation AUC ottocade to Lua Clit proces. ie ©The portut and child procener wit have tht Same vixkal address » ue prysteat SB addiewer_will di ffents maiol) Print ("Helo") 5 1 Cntld procens — outpurs atinu a main (9) £ sya 4 Print (aetna) 3 — Bent ls q Procens 2 aur 2 Hr, + {main () + pete tens) ‘Scanned with CamSeanner Process _Havage KENT > Paces Concept DeFfntevon + Paaguom under’ @xeaitfin fs called ox che procers » % Tr should ret to ths mafn menony- se Te fg oceupfed-tha CPU fo cxexute-ths trubwustfont. * Active and dymanafe . © Reoces wit drow variow attribute such a 5 A Proces TD. 2. Proces State a Prdontey 4+ Program Counter 5. Genwal Purpose registou © LE OF open Fila 7 List oF open chutes B- Protection fnfoxwation Pecos TD: Tt fs Ha unique Polrutification no. which fs anigract by te Os ak-the-Hive ef, proocen: uation Procom State: Tt contafnt cuwumt state Pnforunatfon of thr Protew whut ft fs nutdiing. Padontty 1 Te isthe feasts amigned byte OS at -the tee of procen creation. Some values Pacgiam Gunten’ Te contoins-the addon of the ext frubructon “to be exeeused. General Purpose pagisten « © Autre attetbuks of the proce {scaled ax Context of tht. procen. © Context ofthe procem wf be stoxud fo-tha PCR (Proce Control Rlockd).. a Pre B. Stake : ray | Pe GPR Loft Lod Protection fade: ‘Scanned with CamSeanner 5S ° Fvouy Procma will hawt ft own PCB + So Peweof- te Procener UX lot Stord fr Tne wain munory” So Pees aw foaprmunkeck by wing, Doubly Liked List - SE Procom wil have vartour Skater. Such as» a) New : 2) Ready » Running 4) wott © blocced 3) “Towuhatton & Compution 9) Supe Reashy . a e »> > = 3) Surpend unit er Supendad look zs Operattora pofeumed entra Proce % S > D> > = = x — Crsoke = 6¢ e 7 Dis pakelaing ~ Executing TSR! Trkerupt Seutce Routine panes peed ‘Scanned with CamSeanner @ initially pracen wit be fhthe New Stake, maton procon fe icles: Cuatton er proce fs being Cuateal y ; © Once tis proces Ps cxratol fe will br movtol onto Reody state. Anol fr Ane neooly Stale trou wilt be multiple no- ef procernses- © When thr proces fs fh tu “running stoke Hum it i's oceupyting the CPU Gud exeeutitg the fastruction eh otha proces and posfornaog CPO tine. © Thre Aunning stake ur will be only ont process’ ar any polit: of Hoe. ° Te tte nunnirg Proces xquua To opucation Hun Fe wil movt en fo wait br blocked state: © The wait Stake also thea can tmulsipe procener WU Peo T/o opuatfon Sfmultaneousy be multiple no: of procemes, fe muant fs Categorized frto wo Hype = Mudittoutdng or ~Tirw. Sharing (Tm Quantum) TEMPCONCEPT PPPPRMOPPHAR AR AK AaaOAaDA © whun me es Roa Minir tn te caste inky roa fs fn the Ready , Dunning and wart staterit fs ~estaing tea & © Tht xerourcs art not sufficient to managetne procenes Ththy suacly & tate cthun Sms of ht Procones wt be suipendled and-ihyy wittke moveel on 40 Sispenceel Reacly stokes 0 Whunsva proces fs foe supenotud reaoly Stalethun Tt & renfollng tht Bey Store (Secondary memory)+ P 2 2 PP ‘Scanned with CamSeanner © Thx np-of recone prurunk fr Hee watnmenony pur Of Mulls programed, ’ Ps 4 of rete prog hammtig - Qt amy Pofnt af time fs caltedt ot olegre © Procemu axe Categorized terto typo ty pat = CPU bound Procens — I/O bound Procen 4 CPO loud Pacem °-Thy procera whith requinua mont amount of CPUtMe ane Caltesl as CPU bound Procens- es , Zeut Pn Hho sunt Thun typeof, procena, wl spercl mone Hineita 't State. F/O bound Proc ~The proconts wich vequixn mone amount of T/p Hoe x0 collect at T/o loound proterser » : — Thue procemel ust spoad more lint fot waiter blocked Stake» Fauh and evo tte whun-the Protos T moving From ent Stale-to anotun A a Y. Stakes Hu Context of Hs proces ox Change L Context Suttehing * 4 th r cantexenePranotwumpracey fs called ot tu GankextSwtelaiig? B| Loading Conkext: Suiting 7 TE thy toritext of tha procem fe mone —Hhun -the Context swltuaing facut alto frenease, whichis undecidabte. =H o Context Sultehing Tins *S costa axy ove font system. 8 am Note: Th sona specfal cases *F-thea fe onty ong procen » SHU TE fs coniduxedl O4 tho Context Suttehing. o Fy Round Roben Schedultg with 1 Process. = ‘Scanned with CamSeanner AnH Operatitg. Syston Hue are) 3 obi Fount schechulons, 1. Long-term Schiduax (LTS:) o* Tob Schiuulor ¢ Te dois aealgeiliaimeiaiig = thee syst | 2. Shon Tem Schuduton (STS) Ox CPU Scheculan i Te fs xuporatbtr fox Scheduutrgronto ne suunntrg » State (CPU) . 3. Medium Téxm Scheotulax (4:T-S-) 3 Te fs nuponiT bie for susporchinganak resuoncg pssceeaiy © Thu [bctanwbyMtdTomMsehaguaN fs called ou Supe > Dispatcher © Te is responstbte for tna o Tt is Qlnprexponuiele for perfocodig Centex titel Note ‘ ¥ Long Term Schisulan Shows Sele cod Conatnation of both CPd bound’ & To loound procena tr onderto gee good Hrroughpat for the System. 2% Long Torn Seradhusr contri, dagras of multi Programming: Gy: Confer @ sysiens whith has “S+CPU protewer Then what i's the minimum & Moaxioum no-oF proceme thal may Purl Pn tho raachy » kunntng and blocked state? Min Max Resaly 0 Depehas onthe masfoum dg of ulema Running 0 n ; Biecw| 0 (Ary) ‘Scanned with CamSeanner © Procen fs hong Voto i frouar Tims * were Ready state: (2) Aryivatctine: The five wun tee : ed (AT) ; ee (i) Bure btu fT) > Tartine eaquin by i proses © fan tts exeeuttfon é 8 wut Hie of Procen. | G) Completion The 2 Te-ttus wohan War pxocens ( cami fs cote au Comptation ine of a Procen () Tionaxound Thre (TAT) + The tue deform betwen Co putin Hee And owytval Hin & called at Twn around That (> Wettig The CWT) 2 Thetiae clam lis Tuanasound time anh Rwut Hae fs called a wafting Hime of te Proc, a (wD. Reiporie Trew (RT) | “The em “ GRRRUDAME Ts Renown OS respon Hone of ths process. y CPU Scheduling _ Pts total execution piace cco the: Whea — Ready State Who — Short team Schedulor hen — Te Raoutig Tomita” 2. Runa rg — woot 3. Runntag — Reoroby 4. Watt —> Reachy 5. New —*> Reachy keg Goal of CPO Schedulitg ¢ 1)To maytinize CPU utiUxatfon and-hraghPar oF he system 2) To mininise the ug. TAT 00g: WT, anck vg , i S s > 3 > S > 5 $ 3 S 3 > 3 2 = = 3 2 = = = 2 = ‘Scanned with CamSeanner =D CPU Scheouuliig Algotthms tn Frat Come Frat Sowe (FCPS) * \ Cfeterias — Asudual Trt Mode t Non: Prtonptive WT un}. Parte. © Aug TAT= Qty 9H6H9 3 4 Ang TAT = 5o. 19.00 @ a a Ange Aig wiTs Orlt3e BH6 ‘5 aca = 2A 546 5 ANgTAT = B4rltt ta +9428 6 =, U3 2 18-83 Arg WT = DAFBFOH 64320 é ~ SA, 12.33 € Ae \e5|% | Pa) ee] R | og 5 1) ao 25 33 Ao bat Nokes Tht oudval us of He Procomer ans motdnig tie Q “jh prose wrsioh ras Lowust protens TD Mg = ae Beluenn ates G = Geni € Aw z Our = CPOE Hen cake Le. ‘Scanned with CamSeanner i Govoy Effect © Moma RoRsm th & 2 Shoxtuk Job Frat (SIF)! AvgoT= 38. 12-66 2 : ' Creuda : Bua Tray Mods: Non- Prumpttnt ctl TAT] wt ‘Scanned with CamSeanner Note 2 TP buat fim the Procenu fut On ontng-tan Schaal Ae i Proten whigh far lower Parival Hone. Qs ; MYTAT= “B38 . ep 56.54 € i ANGWT = = gut = 2984 : = 219 _ 36.50 6 4 4 4 4 q @ 3. Shorter Remaining Thar Frat” (SRTE)* 4 « Cridoda ! Busut Trae : € Agr SS ‘ gs B88 @ Avygwts Bl. a8 Ca S.16 « a es 2 eR RA ‘Scanned with CamSeanner 13/ej1e Quo Considlux 8 procener f\+B,¢ to be sceouithisl ax pex SRTF algorithm . The Procen A Ze Rnownto be Schidubd Frat, aol when A has bun mune’ for units ef Hs, hun tra Precen °C’ has awd. Te proces C has run for (unit of tue, Hun Hoo procer 'B' hos QuTust and compute running in ‘2! unit of the, : Then what coulol be Hu minimum Lwut time of procenes A dwal C# a MW anc 3 band 4 ¢) [2 and 3 Wa and 4 8 A SEG ie Senge emits ee a yar Raa 5 Socondy wot Yo c : Pe ands x-F7y we yx and AT Of CCA Hap. Mewonly 12,4 Usoticties For XY 4. — Round Robin Schecbuing + [Provtcls mintiuin Response tine | Cuteteda = Thre Quantum + Arival True Hook = Panenptior ooo” Execute Ht Procen for Pts Towa ti Context Suttchy will Moca IE Time Quantum fs Wusdin no. of rol nervfpone Hine wil -be Lua. Tf Time Quantum is @ Han Ha no: oF Context Bvtebae oi gebee tere “SUB aad ison ‘Scanned with CamSeanner Q. Pro. t 2 3 4 5 q Quest Gantt Chant: [RTP] Pel PL Pal | Pl ele eel eT Pal oz 4 ¢ %8 3 Wi Ww I ig at Q2: Ta= 3 pao. aT gt CT TAT WT RT Arar = 2B. ar.33 = 16 =) B33 t oe P = cs > = I> ‘WAR [ala ee] el el a ont g nw '5 13 2 a4 2Qy Be 32 33 Quad: TA=2 Ono. AT QT cT TAT WT RT \ 2 Yo 16 PR rN 2 AGT™T= AB ayy 2 5 Bo yw oH a 8 Ang WT = 5. 9 cg 3 0 £x¥¢o B 18 12 2 @ 4 3 fo 3 6 4 5 5 4 Xo WW 1 5 5 g ire \ 3 6 1 LO 3 & 5a ou WHI 8 GE Gowtoor: TR Tole lalelelrAlalel al Oped yh es Be 3M 31S 16 Bg » SOvVeveevsvevooeeueetegoubed dd d¢deuwe Oe ge ‘Scanned with CamSeanner © aT Fehgchi Oe. BB Bed ABs PR 3 Axo Compution odin in FCrS% RA[TG =2/), eers: P, Pa, Py RO PPh, Pa Que: POR FPL RC 6 8 1 1 13 15 6 G. Coit “Wy procenes , P., Pay Pa ,Py all stutag io Hee randly quant To ty Sam oxdes at me =O. The buut Hit xaquinumeat of diem Procener 41.851 sayp. then what fe the compution “Hos of P,. RR(TO=1). AT 8T Amst 98sec. Bh 8 Aye a o 4° PR 0 | BHeS 0 ae ey Quess + PIKE OPPS A PE PF Ps Gontt Chant: Cp [Pe] P, [Pa] Pi [Ps [O [tel o 12s 45 ¢ 438 P| : Gompurton of P,, Q- Cotter rh procenes Messing “Hee CPU fir punct rolofh algorithm TW tonkty F Saiehing Hos fs. 'S! units 1 Hen wad Waites be hk, Hut quantien ‘g | Sth Hak Hae nese, conden Suuitiles OM ALU Lut at KM Sonntag _€eh procon 5 gurantid to ger Fi twin oF CPU Often evo t! see, Ge n= 3, (PP, A £ 2 36) + 24) ele Bh ve, $Y 18 + in-ip, ae WG! ot ‘Scanned with CamSeanner (m-\)4 < t-n8 5. Longest Job Frat (LIF) * Crietenta + Buut tue Moot > Non Prcempttoe Quast. Po AT Qr CT TAT WT —_— a . 2 ° i a S eels lor _ 14 2 4 6 25 aa 18 € 3 2 ® to 8 ° Avg WT Hot L66 4 3 4 as 26 22 6 5 4 3 a2 28 as 6 5 9 18 14 5 jo2 Fo [Pfr] & | el pl Ps i a a LET TY Note: IF the Gwut times of tre processes ax marduhy Phan Schedube Hoa Process which has Lowest asudval Hme- O82. Pyoe AT RT CT TAT WT Ag tr= 386 _ 64.33 1 ot 6 98S Fert 2 19 2a 12203 BO wT = 250. 3 as te 8 gag INT BBP SAL 4 3 19 2k ges tg aaa 2 45a 5 6 85 spe 43 4 20 wo Vr | [%[e [ele OS 2 45 @ 93 12 ps a3 ‘Scanned with CamSeanner 6. LRTF (Longest Remain Tint Feat) Cuietoda 2 Bwut Hive Mode + Pre emptiot Qe! pro, AT &T CT TAT (wp qa ye rr ig IN 1S en TEE d 2 wenyo 9 OT MBB ‘| 3 3 BE WRE yr. on V1 GI sR Mg OWN MBI FPA r[efeletelelalylelae[alelal C1 2 FH FV gs we HW wy I PL RIB] Pl mR 2 2 Ss, At eT CT TAT Oe vay Cho ie Agere 13 a) ° HRA, 13 1% 3 0 Bua) iy ta [ale [ale[ele trl esja | ale] o-4 5 ¢ ¥ 8 5 f HN kh 1 Th CPO Time » T/o Time concept 3~ Life Gyes oF procen cari be ax-follows :~ Cpo Hae Th a syskm therx scenarios au posstele : T/o time ¥) cpu : a : ting 2ZQ x To ina D fo ' 3D cpu, r/o 7 4) CPO) Zo \T/y Comp tion 5) os ZJo.t/p ‘Scanned with CamSeanner Quest Goro Pst Compttion fine of Ps. Pe Py uring SRTF algo! oT ee TfoTine CPuTime — CT a 2 2 5 aa 4 5 13 63 6 8 22 8 Pa YP BB owt a2 # Tot CPUtinn To Tae Cir 4 14 2 20 8 28, 4 50 a 42 G 94 20 a4 aad re Pato AP [| Ps oO 4 18 46 88 94 ER Ror 50 flo 8 EPs To jy re S30. Gaterocs. SATE, Pv Ye remain Ie y.2 Ifo cp T/o CT Pp 0 2 4041 10 fe eto tes 1y 2 25 Rotos 6S AO WA BI Jon ua i V4 P| Pa | A 2 x10 9 10-6 ° G23 4a DF Yagee® Ug Faaae = YR) $0 bo, Fhe ae ‘Scanned with CamSeanner Que: SRTF, fird CT. Pao. AT cpu x/o a 3 Xo 23,, Oo aI at Yo oo 0 4 4 35 Yo 2 1 33 (pr [pl Slee V7] ele. [Te V7 yp 5 7% Io 2 WM WS 29° By 3g 38.635 4. Prvoxity Based Scheduling s Cxletenta | Padontty iS Hod. : Non prcfmptive © Phx Enptive y Non prremptive Pronity oo oe Ertesly Pro. AT &T Clee DST WT 3 \ © Be 8 a ° 4 2 12 20 «19 vy Ang = ald-2 A 4 4 5 1 Agar 8) g.g 5 4 35 BG to oe M$ 5 4 eK 13 3 3 ‘ [ [ef ° 3 a 13° 18 20 Mole? Te ne priosties of +t Procemes axa matching “Hatn selrechuls Hs Proces witch hor lowest dueival Hine, ‘Scanned with CamSeanner 8. Highest Respoue ratio next [HRRNT: i LA Cuituia : Reponie rario © Me Mode. Non Pruemptive i ih [emer | gas Ot © Tha abot ole on fay He hostess or ama eutt ell a iW ann ~ it Qu. Pato AT BT CT TAT YT aotat. 4o. g i l ° Sey 3 ° 5 | T 2 2 & 3 q \ Aug wT = 22. 4 ; 7 3 4 How 5 l 4 6 5 2o 14 a i 5 8 2 1% % § Ae Hhat=9 | Ae = 13 Berpone ratio (Py) = SEH = 225 i Reyponteratio (Ry) = ALE = 2-4 i Response catio (Py) = 3t5_ 4.6 | Rerpome vatio()= 549. 4.5 ’ 5 Reporme vato (05) = 2. 4.5 | 1 Qe Pwo, aT wt CT tat wT \ aa 2 ° Pog TAT = 33 66 4 6 io ‘ ° 5 ) 5 Bu i4 3 4 Pug wr= 16 3.2 = 5 6 5 Ig° 2.13 8 bea ars fae 33 jh PT] P| Pa a. foe q ih Wy ; Ab t= Bt. REC Rel)= atl. 9 RRA) 63 | 3 Sey. ats > RRR) = 515g ‘Scanned with CamSeanner Q- Gate2003 Least CPU utilention? AT Cv T/o B, 0 lo So R OO Ww FOFS : V, Z, ) en Sere: Te Te ey oqo 20 oto RR(TO= 5): Pim |e |e: Lea CPU J KR Pe eso 1g oe UsGeation RS : 8. Mutt lu Quo Scheauuting. ¢ —4 RQ ~L_s TAR a OT — + RO, |—_—_>- —| aa }-> © Depencting on thu Priority the procenes th asividh Pontiutar wooly Que ty proces. Lart be place wil be ducolvol. © Tha Layh prionly procenes wil Ut ploutol forthe tp bub rasly qua Quel Hee Low Priory Proumes will Urploud fa the Gotten Gud reodly quéve 4 : ee e Ee 0 TE His Te re stategy fellowal Mun ths protenu wliehary pieces the lestiom ond ready quia wit Sabler dro m Stosuuati on: ‘Scanned with CamSeanner Stawakion * Sioa, Note; Teravetal-tu prenblorof skexcatan th weal. Aging : oh te saaiteg™faa® of « proocemefinaanney Lun ‘the prtortty of tia Proce will Le Trvuaseol. 2 Tf te age of Hu procers truraanes then by facuaring tre prionty #4 Kus proven tie provers oil dda finity geo hom to exeurte. nck Akewakion problm will be avOided do. Mubtilovet Fiedbock Quote * TO=8 Th Ane above algorithm Qype Lorton Py. 83 QR. QT — 4os WS 36 boy TO= 2412, 1A, 22, VA- - MO Ao Boy 5 ewug procen will Ofinity gets a chancel. exeeute for (Pore anvounte oh Hee buk Stu Ada Ps 0 panibilty of Stodwation ge ¥ Fatorph H Nott contuplre Aging wt be ‘Scanned with CamSeanner wea PP PROPOR PPTR RCRA een: ‘Scanned with CamSeanner LRTF 489 No [The comptetion ef smatter procema (sclont before laxgeronts , ancl os mumony is Finite, aL the Algorithm Starwation Fers No NP. STE Yer SRTF Yes RR —— No Ne, LF ———— bye NP, Prtority —— Ya Renin. Poor ig Yes HRRN = ————wNo MEQ - ea MLFQ ——yu Note: Mojority of the opootig Systuus practolty Beptontnt Round Robbin Sdarolubing. Procenes gets a dabjnit Aine for sunnig ‘Scanned with CamSeanner ¢ Process SYNCHRONIKATION ape e Sed Pato 90 id FUOCONNEA QL, jorizecl Pnto ea a ne ap a 1. Co-opuolivx Procena : 2. Tholipordiate proceme A.° TRE execution of one proce affects or abferted by ettwr Proceso Haun those Protewr axe Said te be co-opuattur procema. *e Othuuise thy axe Savcl to be frolpendent procem - ° Unduurtancitg Synchronization = pal J. 1) The problume oxiser Not having Synthronization buy Che Procemer. bts 2) Condiffons to be followed to achieut Sinchvonizatfon =3 3 The solutions (tivorg 2 reyht) (¢) freonsisteney = oly Probl : a Synchron?zabton ¢ (H) Loss of data Prablims artstag dis to no Synchro (6) Deacttocsee SS» Proctucer - Consumer 3 Bee SD ee eT amma Ln Conplaton ef I execstionp.preclucen and cocaine Et Count vaniabl yalus Should : ° ee fg ihn iee counts 4 & fheortsteny A f ine Bu alz ~ sim ss : A Analysts: : = “ E — Procter execution l : ‘Trem ps 'A’ C] ! i Por Rp: 3 ei Cll ha a Buffer (o - na] bn Coruna Zag A Pro ‘Scanned with CamSeanner ° 1 tnt comr= 05 yor coniuiwn(vord) ord produc (vor) } eat ham fat theme’, f t j wl (tru) while (tr ib (counr== 0) 5] roduc — Keema (fem p)5 theme = Buf enfoutl 5 toni (count == N)} outs (oub+t) mad N5 Gupte [io] = lone ps fo = (fort) mock N 5 Procem Pim (feat) Tr loaol Re, M [Count] D. DECR Re Th. Sto Mfeount], Re I. load Rp. M[eount] Inc Re TL: Stor M[counrJ, Re e in’ is He vauable weal by the ‘producer’ to Fela the { next empty sbt int bub. ( 0 ‘our’ fo te variable ued by the ‘conmumarte folent"ty from | uuu “CE das -to fomune tu ftem. 0 ‘Count’ f the voxtebk wed by both producer ond ue Comamu to folunttty he no: of Ptews Prevent fh the bufhe at any pofni- of Hine. Shared Resources ¢ 1. Count Yariuble 2 Buffer. Two Condittom to be follpweol —2 i. When tee buftor Fs Fatt Procuucen fs nob allowed to produ tu & trom Frito Abe bufhos Re When the bufpor is embty , Contimen Ps nok allowed 10 comrume Feo from the buf hoe ‘Scanned with CamSeanner Untooual Assumption os i The runntag Proce Can get parempledt ou any pofarr of Hine after comPation oh tee cucu fatructfon « © CThconststenay)e 1st problem Th Produurn and Conmumur ane ot property Mynetworized while shonsig te Common variable Count. Henee fe lacking to the problem of inconsistency. 1? Rarkground process > Raater Spootex Daenon © | a- doe ‘ rekvors zation) paseo to fapropes SU) : "Tw .doe rc face (amet? OPER pesencs 2 |e. doe t “pardec——t Our’ m8 3 | Shee eee oh ae 4 Q Analysis 5 ‘ 6 | Rendy Qoune + Pi Py a a 1 pyrdoc || “Hy Sdve Spool Dinedtory (5-0). hrs RT , Chto FL ey wee | LI 9! Sopaye pavdoe Te Load ROT UE] r, Rim Re Ba + =~ =~ Pipreeiption 1. Sw soto) Rae Tis ace RP "Rav ~> Sble= Fypeactoe BM Re ra] Be Stow Min], Rt ate ‘eo’ es the variable uatol by AL Hae procdnes fo Poletti nex € me e me slot fit Spool AU rectory « © out’ & the vortolh wast by lu prtttorte Polen fy from whou % harto Print ter dle cuumunt j — Shaseol qerourus 1 Po! Yonfable 2. Spool sivuctory [SD] ‘Scanned with CamSeanner © (Loss F Data ® And Proldum ‘ og = eo i ‘ TRL procenes axe not Pr Ayawnvonizeck whill Ahovdng tu Common vasiable G Ghana ft Ps Wacky to the Problem ob Loss of clata. ¢ C ° Bra Prolalum a TE ne procomer axe Not propodly Synelrronizeat wahilt Abouting the common F Vaxiablu ar Common reowce “hun ft fs alio porsible fox Deadlock: ge Soma difiettions_¢ ~ 4. Cetttead Section — Trt portion of program text whou Ahan variablt @= OX Ahad Rowers WL LC placed. ; e Be" Count = count +15 J/ wrk Producer “consumer e 2. Non-CefHeal Seekion — The portion of program text when tha Tacteper gee dunk codt ofj-the procener will be placed. : ak: fo = (tort) Mod N 5 Tfeoct preciucer Coniumee problan 3. Race Condétin — The final vats of ony variab’ dapend on exeution Pequtes of te procene. This ‘type of, conch’tfon és callecl as race condn- ps2 An producer Gniumer problem, for 5 cor Po IL ' co C= | par Car 1 pot Com 1 Pom Py UL , ea 1 1 Count =2 | ate 2 To ovotol tim froblum of OC condlt tion» Only ene Proce shouldl be allowedl to enten frto outtical Sectitn. DALPPRPAPP PP ‘Scanned with CamSeanner x MUTUAL ExcLUSION (ME) f © No 40 procenser may be simul toneourty present Puide the Gudtiead section at ary pointe of tine. © Only on procestatlowed ‘to entur tito cnitical seation af ony porn of dime. PRogReSss : 0 No process acuibb ouksi Oth frterestud Process cnitfeal section fe fre © TF thuw fs ont) ort procers tying to cakes into cu’tftal section then 2E should be cipiatitely allouxot “to enter frto cuitiol section - OTL -two ow mont procene axe tying to entarfrto CS tien Gar proces should be cliffnately AUowd to enter tnt CS- BOUNDED WAITING : 6 No proce should Jue 4D wai Forever 9 ento frlp cxitial Section Chance to enter thio CxiHeal Section - re de the ovtteal sectfon Shoulel block Une sym enbering thet céticl gectitn whuy © Thee Should be a bound oA jetting © Sonu. processis tholfinitty waarting fo entur ento CS because CS Fs almays louy by Some othwr procenses s-this situation shouldn't axise. OT the boundsd waitig fs not satisfied “Hun Pt & posse’ -for Staxvatton . No awanptisns tulatd to H/o ard procenox sped Ore ‘Scanned with CamSeanner > The Solutions ¢ K) SoFtuau Type + 1) Lock variobus 2) Stree alturations (Deckow's Algor'th m) 3) Petouns Mgortthen 8) Horde Type + 4) SL ftuution ser “Teast anol Se lock ¢) OS Type: 1) Counting Semaphovs 2) Showy Semaphons pb) Programming Language compile Support Tyre 0 Honttou vols f Software Type Solutions $ 1. Lock Vaniebls + fst - Fainy Section ,goysin en T Load REM [tou] mm CMP RE, HO D. INZ b se BD Stome Mlle yet w. MI. Stowe Hvar} , #0 ‘Scanned with CamSeanner owe Ve VM Se YO Oe: EG Aor Ro] Pon R==0 Yu. (No bop) Rom R ==0 (Wo lop) — ~~ =~ (Py) preemptet) Ror RG] Ror Bom R==0 (Hw no loop) PSI eGo Lock= | RoOW-- ~ = SE prtempred) ROW -- lo=t Ro 1 @ © Both tre proves entuurg the CS sfoutrancounly “thus Mutual excuuton E(t) satisfied. © Hence te Solutfon £8 looundl to be fntowect. Strick Alkeration (Deckers Atgar*thm) + (proces takes ~tuin to entex fato CS) Proce fo ds oshile (bur) t Non_cs( 4. ashile (tun |= 0) 5 a. [es % tom=t 5 5 cia eotile (turn t= 0) \ al cs be ue Proces P, whi le( true) Noa-csl)°; twin = 0') cod ‘Scanned with CamSeanner Analy sts #| tune 01 Rt ~ false fas-turn= of (wo oop) cS Poa -- ® — ~~ === & preenpred') 6) Pros. cbut {as tums of (to0p) ox = ~ - ~~ ~~ --(B preenpiea) Pd -- tum=4 a (p, Preempred ) Poot -—. false fas turn=1} (no oP) Ro --- 3) (i) Hence , Mutual Exchsion (8 satisfied | ckurn =O Prot -~ true {as-tum= of (Loop) = oo Pa ts not allowed fo exter fin CS although | CS ts. fret. CG) Hence, Prog ts not Satisfied. © We hax providtiar progren fs not satisfied shenw solution ®& bound Fy be Kntonsteet. . | = ‘Tinportant Pofats —* | Preemption fs juit a tuvproran stop He, the Proce wil Come lotele -bo : Contin the ead execution. | 2. TE Hou is ang posstbily of solution becoming wrong while taking Aw Preemption tran comidin the par umption ! 3. TF any solution fs houtig dhocllock, hun He " pregsens” fs not Sut chreel, & i & ‘Scanned with CamSeanner ANEW. Sy, Sa OM TUrclomly HfValined variables: Pi PL whit (Sie Sa), Is whl(S tee.) 4 a 2. 3s Gea; tes y 3. Sys . G25 ghg ee ey R71 ~~ False (no torp) _Precs --— ( . ? a — (Preemption) * ME FS satitfiedl, ab Siands. oo strut (loop) be equal ornot equal but net beth. 8 a eH -- = _ Thsonty ont procen can he fr sich te fur S56 Ses idee CS ts fre fnitialyy , R 1 —_ tre (toop) Gave ace * Progren icnat satis Free , As abthaugh CS 1S fren Luvu titi Gel fite auttig for CS, but came tt Pato Coron Sie =S2 orws) , (a Pacem Solution) HedeFing N 2 oH defn, TRUE | 4# defi FALSE O fink tw 5 fat ttoterttct (NJ) Votd. flo Region (int procen) { fh othe) obhex = 1— Procens', 1. a 3+ teeta (preeent= Tau: *, a s frtoerttd [ol= False (rewrtedt [r= FALSE ‘Scanned with CamSeanner Noid Leone —Reafon ( far procen) 1 trttreted [prowa] = FALSE 5 ¥ © “funn” fsthe shad variable wed by both te procome Po Py, Anatysis (1) [for ME) RANK KETaag fotos] | By? hs 23,4, 5 CFadderstum = 1@ Tetoustel {0 = FALSE (no bap) Ks) 3 Apeeerried) : Rots 2:3)4) 5 Ket) Deoop) Ms. % con't enborcs ‘Scanned with CamSeanner “TRUE ww = G1 Tevownted [0] = Fae Tatowseol [1] = FpGe ! Po i a “TRUE i — , — Othax= | i okWwn = O e Pot @& Por 2 Cotrucs I-prten = -0=1) | aceeimmenart Por, ( frtuustest [o\]= True) © | B> 4 urn = proes = 0) © P25 (False) Lar turn=0 BE fatowstedlt] = FALSE | (rotoe p) @= Po —|Cs e& Sop eae —~ — (Po preemptul) } Roi * Py 2 (otters I prouns I-10) & P33 Citowrted (1) = True) & R>4 > (wn = 1) & eee fostum= 1 28 Fated = Tave (top) a Con't enter Pato CS wile “Hhwu is anottun proces frie CS. a Atonysis (2) ‘ Boere Trowted Cols Kater RE 7 Pies dhe: \ whe Traoortet [T] = FeGe , 1 .otuns O. TRUE a a a a Analy (3) (Gor pregen) turn 20 frtocertea [oJ = Ff Cr PL Yatowkol [1] = FALSE Poi RI 2 (other = 1-0 =1) Po> 3 (entwentea fo] = true) Poy (usm 0) Cates 85 (Fate) Lon tatoented [1} = un} (Wo to) Poles) eS at Ro Antouttd[o)= Roa intoxteed Ui] Llhe Pe Ro 3. [fatvurtelol- eu) me onerst otters 0 034 95 [fabe) (no P) | oes] “Rot P92 Res (ftoestea 1 = Tus) Py > Wave ( frtomttel[o= =falt) Pod Ror Po > (fatouted (07 =-bur) Pow 4 3 Po38 (enn) | a twn=0 ee trtorereal (Y= to} Ctsop) Can enter faro CS again» (oa Pi fs ato fakourtect-toger Pasidicthe CS" “www eve veeGduediddd UII IIIs. ‘Scanned with CamSeanner © we drow provid Hat atl-Hu 2 Condition oe saticfed fh traaoone A ALqorithm. Hence Pt Ts Prope Provicling Synchrontxation to Hut proces to artes Common CS. © heme Hak both Py & Pi (Precona) One trying to enter FAO CS ak “He Soms frat Anan wiveh Proven wil entrfto cs fst? Q) The procen ootwich execute At. 2 Frat, bb) The proces tebich execultd 40-3 frat LAM Protests Seek vty Fmt A) cont sayy. \ Bee ts UBT RONASAl AHS , Poo t.e3it [Re reas [Po 8 Pi Be, a 2 8 1 | Padowreat [2 ‘ For True t ut |e fon = Vo Fuca sy Hoa 2 i exerstig st before Po rand — | Pr fS enteateg thu Cs | How, Po fs exeeuting St-4 pefore Py. find Rote entosrg tin cs - ° Thu, enter te CS frat eo boop Gagkier tart Py 1263 Lee SRAM [Po ire - trash Prtourteot chug | tet tum: A9 ‘Scanned with CamSeanner G ¢ e © g © ° © -— -—§ «@ oo @o ® @® 0 0 Stows the value of 4" foto Flag i ina Single atomic yee a Hoxclivont Type Solution \s (LED beastin Ser :~ Tet ancl Sur Lock TSL register + Copfen He Cavownk vale of tus Figg foro sugiste Ord Prwcuption. = EE = 3S i) 3 2 3S nti Section T. TSL Ri, M[Ftg) TH. CMP Re 4EO Stone MEFlagl vO og: aCe Pot (Roe foog= 1) Po TE, TL (Ro=0) (Mo loop) Ss Bo CSE TS Aeieenpuon) Bort Rsage Flag = 1) Hor. CR =N): (so o> 1) Can't enter tnto CS ushile Ofer proem fs fn ~~ oe (Preemption) dl Poo (Aag+0) Ps TE ( bo | Flog 1’) ; Pio mm (R=0) (ne teoP) } Ra B (cs). ‘Scanned with CamSeanner $a: 970 Poot, UO | Ror \e oy eR (Pa tm |---| ®-0 ES] Rie Rs Pow | R--- Uwe a Any procem can get fato CS fe fs nat confrmedt Hot PB uri cater. toys toe waiting of Ris 99t bouncted | nee Precona axe Schudiuld in RR algodthmn his loes No & . enatina loouncled waiting because RA just eur execution of proceriet s TE ras rthing to do with the fog vedabe valu: © & e & © In TSL algo: fF thy ont only -twoo Prwcema , then alto bounded wor tty fs not satisfied. o- TF some proce @ fm the cxitfeat Section Han al Hu otven Prot vobieh ost ‘arying 40 entur Has Oaiteal section wilt bee rapeacutty cluding © for I, 1, tritwuetions. _ Tha prowmes @8 bury th Cheuethg those fartructions anal waiting to 6 entor Peto Cotitical section- € —This fo called Buy Waretng @ © wth -the buy waiting, ry axe wasting ~tre CPU Cy elu Gru). © Bugg esaitiy is alt eattest as spf lock ‘ ( 8 Te axetil Hu problem of Bury waiting, “te Comeapt: of Stenaphone wilh be wed ‘Scanned with CamSeanner & > Properterof aut-the Solution 5 Solution | Mutual Exctuton Pregrars Bounclesl Wal S Lock van! ablu K — x S t Strtet Alteration 7 Ce * (Deckert Adgerithm ) ve x 3 BH Peterson's onal ie we Net . ES etna / V ws x y Paconity Thwvefon Probluy & Re aay Queue @ Solution “to Huis probltm & Priority trhexttance + SS eet ete GG ‘Scanned with CamSeanner nee Operating Sys tem Type Sp lutions Semaphore t- 4 Semaphors fs an feted ex vaoalo, WiLal by Vaio Procener th Oo Mutual @ exCLUMt Mame: to Achieve Synchro nization Trproper wage of Semaphore wil aio qe coreng Meet Semaphore categorized farto two types: WO Counting Semaphore (vatuu range: ~ © to 00) | (8) Binary Semaphou (vats: O ert) Too diffu eperotion performed en the seuaphons vortable— . 1. Down operation wort operation [PO 2. Up operation /'signal operation /VU) J retreat © Counting Semaphors $ © Down (Semaphore S) 1 S.walur= S.vabee -1 5 if (s.value <0) Block ter proces and place it's Pee \ fh 4 Swpendtdl U’st y © uP (Semaphoxe s)\ Svat = S valu +15 Fc vam £0) { Select a procen from surpenoleat U'ct anal conleeupC) ; 5 j ‘Scanned with CamSeanner Fe peony down operations if ths procen # not getting susp erctacl tem S callus as Suetenfyl Olovan operation - ‘ TE tt {3 suceemfut clown operation then only proters uv U continu hod zF i Cxeuutfon + 3. Aptos perpornitg dawn operation Lif the Fe is called ar unsuerenfil clown operation . P ATE thts uncuccemful clown opexation tan tw proces UU not continue furtiux 5 j S procen & quaing suipenda thon execubon « © Posttive valut of the senraphors thdlicakes NO" of Succenbu down opocations wx Can perform - © The down operation on “the countieg Semaphore wit be succesful only Ath faital Value of te Semaphone eel Note Bi The These Fe no unsucce pul Up epexation of, tw UP opecotion & oer Succemful Ba. Proces perforentag up operation will degrately continut tha opeation > 3 Quy. Gomtidor a Syston surhue fre Znitiol value of the Counting sewaphows & , Hun ‘Vosiout Semaphore Bperotions Uke, IB Ps UV, GPs IBV AP art performed thin vohat i D Hee Prod vatueel the Senaplor” Se th-23 414-6 418-4 = +13. aw *_Noke jproconermbloaed){ t te swperdad Uist §. 5 $= 10uD RRL Pop eine we [Xx Soporacst List: (Ba Py 7 2preeena (S="2) ‘Scanned with CamScanner ea Gus. Gare dog Considen 0.Systin whch hook camlieg, Serato variable (S). This vorious | hort Operations Lees 2OP, 1AV, ait Pettprmect Then what fst Longest fitted Valu of Sewophor iS , So -Hral- One Proce will remafn blac, S30 +125 71 S-8 =- Sou @ Binesey Semaphore * © Down (Semaphore S) © UP(Suraphow S) ' 1 ef (s.vatue==1) \ 1. (Sunpendes tse fem py) g.vele= 0") | Seseetuas * shi ede ‘ du = {Block the proces Lscucra proterfiom surpencted cad plow tse USE and wateeup Od) freta Subfercicl UE. | 3 5 3 te Abie pertpronteg down option, TF tu Process ts not geaig Surpendal Annie fe called ar Suceeshul down operation « 2. Thats succenful clown operation then only prow ust continue Furtior execubion fo dnt Cod 3. After Pedouring Gown opexation PP ta Protos ts ening Suipendedt Anon Fe is cabled ab unsutrertul Cloon operation: 4 Tf this un'succenfl down operation trum $e Proce ui not continue fudian erection fr -He Coole. f' ~amaAAADRRADPP © “Thyu fs no unsurceoFu UP pectin or, Up ppexation is awe pacenful. “Tre p rocons Pexfoneing up operat'on voithdlupinatdly continue tn. execution: 1 ‘Scanned with CamSeanner Sony Put N: ue Py v ue Ps e Ps Vv ee Ke Vv uw ere e sopal (GD Qu Worelmok py 95, Q 22. Binary semaphoxe(S) = LEX Bro 9p M4VO 16p0s BVO>s 3 ply ,2v0) -8 are -5 5B -2 -frol Svel= O —— (oppLeabt for both Counting & bfnasy Semaphore) | > eS Important points 7 3 | a Evey semaphoxe vowalole ott hou Hs own susperolil USE 3. TIF mosu than ont proce fs fh the Suapordlad Uist Fran evoygtie cylin 056 > 3 ¢ podium ene UP operation trun ent process ust wakeup from Mu Surpenclest F Uric and tis ott be bated on FIFO order a > 4 TE two on mone procemes Ort th tne suspended bist and if thou ts no other those Procenes Cut said-to be thvolutel in the F preento wakeup then Procemer then 3 lead ocx: waouiypcane own eile pasespattnstarscaeciuingy ‘Scanned with CamSeanner Os Belpre Be 1 409 execate tes faUoung cole: wohPle( bru) t Plmutex) 5 B+ V(musex) ) \ Tht proces Ro execute tha following cack} votule(tue) S evtmutex) 5 x 3% v Croukex) 5 oak Tethe max ab: of Pretenu Hak muy Pretee fet TM CSA iy Pot of Hint? Noke Tritil valu oh Nutex = 15 Aon by 3 °¢ 3 ey 10 eyt ~m—- ma@m@nanaG QO OeeODOH GE & By 42 [Part ea Op] Pe! HES [Ps + CS [Ro sake ts) Pt Bes)” Mater = 1 Brg yo smpends [GDR . -- = 1 use ee P= forisw She esttrtoy ste Alooue onder , Can be 2A tO Oe ve Lasko. {Pa 2, | Por 3|P.12 | Port 2. [Pala : 12 Pitas | Pert, ‘Scanned with CamSeanner She oy C3 1409. Po! S Gots [true ) usb Les) S 1h pester) ANtrnusten) s } wimax) fern) a : HES th Sen] [Res MM Bene | ms s mater: Kiley» BS Si & ® epee { Re) 7 3 At moxtinum erty 2 proconcr cau lee Suid the CS. 5 Pro Qu. Pre |4og : . tuile Gut) ae MUL 5 1 Plrurx) ue y NV (water ) V (resatex ) g : 5 3 This Biepex fmplacatation of of, CS pecblm tate muloe, Thin only One } Proten can be fide Hu Co at any time. » Que Considn bu0 Content: proenses eP%Q exeuuting suuspective Contes» aa 2 + phil( tue) atule (tue) wr! —————— , pet Cals paint (1') Pear Co’) brine) nd a Whar Shout (efor bfrasy Semaphore posit wher mus bt fri tel Girony Semaphows 'S & always at 2 9 [1 opit- -~ fons On ads IGrRs TEP anst ST! vabut fo ger output, ‘Scanned with CamSeanner @) w= pla), x2vls) > geplt) > =svlty say, te1 B) we PCE) » xe VC4) yep) y zevlEy b=] too ©) weplt) » x= wt) + Yr Pa) z=VG) 1 s21,t0 cA useplg) Ke VlED ye ple), z= VW, Aes THO. Outpul ts 00 tH OOTIL - Sic P hun Q. no inewbperatlon of fro « ony option id) Supports Hib Ktnal of, Fp luwentalion - S=VO T= ro pls), vis, plthvs) pars O O11. -- OK eohat which of 4 folowing ws ema dda” a oukpur sitig wi neaun ~ containtre Following of FN Form O10 OF 104 ,whuie HS ool - a) w=plb) » x=vle) yep)» Zul) s Se) b= 4) vw9=pls) » %> vie) yeple) s xevUbyoo set bet Lor ue pur, x=VU) 5 yee) eV), Sele ay wo-plXd X= VU) , few) » weve), 4el) CF conte be of form: O10, D141 0 or LO er 1000!> ete. Soe SH Six gw Aso t bsfor t=to | Mo p(s)" | pa} pe print? 00 opel 9 ai DIO 00g Q Lolo + ~ Sgeiee So 2X, Si=% Si. =f &, 4p. +p, Pie a1 eure O°. See¥! Son Sappeeicg 2See py fi te ! ‘Scanned with CamScanner nw mmm mo OOaGhOKKERKKKKERLA Sy Classical problems af (TF) vais ‘ ‘Tntuproces Gom municakion: 2. PropuceR ConsuveR WITH SEMAPHORE = eo ry 21 Zz Ls ow: fo ee _ bp af Ruther (o- NV Void Conumur( oid) ITER i § fat Teeme +) Sematphort : tohvile (rus) Nord produax (void ) davon (Full)5 1 ine fkonp ) hoion (utex) 5 cobs. (ous) theme *Bulienfourl, a | produits — Pm Pn ps oat") jour {ones oct N 5} STO clawor( empty) > ae Lplinater) 5 — down (rate) > = &P (empty); eg Butter [ent = Feump) Proconttanl iene) 5 i fo= Cfoti) Mod Ni) * x = Up (wuss); Yo 1+ Plmatex) 2 pte PBX Paw) us By 3. V(mutea) ci are eV Cfuts) eCoeti)) Bey OressH mutex = YO cesta fuu=o c: Vag | Ee Bota Jux procener is Becieed tiws Wodsto Blac, Blok Denatloy © frerebengig aplenpy) ruploutee) of commen cede. Puocuer Cnmower ‘! Tay ) PC fun) e a 2+ P(mutex) ial 3. Viwuex) 3-4 (empl) A. v(fuu) 4. V(wurtex) No Problim, otn’s SHU Conuer. ‘Scanned with CamSeanner \e-uru 208 2: READERS -WRITERS PRoBLeEM ¢ Datoboart, nD int(ac = O), Y prour inte ds oF a ot toss) Semarphoru wurkx =] 5 Yetta) her naire ee: den Cae); Void React (void) 4 white Louw J A clousn Unuiiex) RCE HO +1) FE (nes 21) down (db); Up (mckex ) 5 down (mex ) 5 HOE HO- 1 iF (wes 0) up (ab); Up ( mutex) 5 ' i 4 Cordiitions to Ue followed + © R ow &) Wee RX) PR Ro () * W-w(X) ‘Scanned with CamSeanner Nok + 0 perl RemdanERHREY foteges vetabls ureal by vtadud fo sinennbonnaehwataolas ee Ory Pt+oF tim + : 0 ‘mule’ fs foo semaphores Usd by tor React fia mutual exclanivy esanrer © db’ is bofoany Semaphort_uitot by Reacher andl uritws fn a mutual excuutor ywanner + Ananysis ) nes Ot 7 mare Ye Reader: | Uortters ad) db = 470 cant ger turd lb iF Oey weader fs fn’de! mls 0 4 Reader’ | Reasters ] : Another vader Con ger traf “db ein FF another rtoderis | already frtich! ‘dio’! © Pokaloane i Aap) v= | Writer: [Reader * | muley = 10 (Gace) | dhe Xo i Can't ger travel Ab" 04 | ®&) : another warty (5 alpeacty ' fosrote blo’, Be clatnbane ‘Scanned with CamSeanner Arvalysia Bea Writer: | tate! ie UU | ex ee 7 Gou) J db 1¥oO A oh other toner, = is trade a dasebue. [ e i Aakalor i i Qua: What happens HP we fkerchange clown (mutex) Ae=HEHL ah Het Renate cle? a ©) No problim, soln. stl works Connectiy | [i B) Mulktipu wades au not alowid thtothe darabate | { CT both ataday andl writer ull catte Tato databar ob Ha cant tint. T eertttestoder wore \. Maret | ts P(dp) r ~ | 2+ P(muastex) Ts) é = 4% ilrc==1) down (db)', 2. \ldey = 4. MEV outer re s 5- P (mate) Zi Ee 65 ren eh) a= S tP(vc= so) uplde); al Oplrnater) 5 ack a vende 1 Chee py beet. % te Bx2 AE max fo) : db=*o > vd | Mees 12.3 a TR) | walt, : ‘Gay “GS fe ‘Scanned with CamSeanner SONS Gus Wha bappuss TE we frtorkage J tanan. > Uploaton) fo cradles cate) RE OD rakes yt db. MO to seeded 1 Dr Qyg) TEAM 1263 pA Re . ; fee (PEt ae welter 1 PE) | 4 ba) Kea’ ' bce ee dbt Yo ; Both readert andeariters be fr the OR atthe Same -pione- coo | Gus What happens iF we frtorehiange ne = BAO mutex = 4928 dovon(mukex) 1 Ez KENL fo At render cot db =40 pe Ri 1,2-3-4PR].5] Res 12 PF : wed ve Napa TB] 6 [Re 1228 [Rr Kal ae Tee + Roth pre radon: we lolocvect and rite artatio block, tau Desoltoc. ne: ore mwwty AKG ab. xo To @s yweo mii Gr 21d ABR) [Rav 2-3-4 (OR Regione 7 aut fee Ro | wea o . 9+ WOi_pa 95. aoa 5 rete Koy R01 .weo Rem Ned muktx =O MUO Oy Oy apt wee RB, wey R6 Wee wants ACY ps1 maby = Voor “Soxr2 | Ro Wo Reo , Weeern woo MPA Or 5 ‘Scanned with CamSeanner . “ on Qua ~ Comictn Hu Following.uica by He clanical wastert Cuoritua whieh of ¢ * Ave Rutowing ie eve? O) The Coole fs propedy agrehrorintg Clanical xta0lexs and wigtus - b) Mutripl wawltes an qulowtdl fh tu atabore Ob Hu Sane Hie C) Bol vow ker and teacley wil Cnty fo tae olatoloat ol Ht came Hive ASIA is powtbt for daadtocx. int xe= 04 int wes 0+, honk mult = 13 Semaphore KEN 5 Sewaphon db 1") , / Void Reaster (void) void wrilen ( void) Lube [bur 4 usidls (we) J rdown (29 5 1) dowale)', eaten) 2, WE FwET, — Bb 3 dean Cold) Ly Wee HOE TS # [Be] 5. fF (acest) down (Ab); Uptoey, 6. §F (we = =1) wen ec) " tL downlad, upl)5 8 uplas) , \ up(muts)}, ‘ BR Chuonlmustex) *, HOzQ, WC: MA (MEME Wades | nef deg ' TR(ne = = 0) up Gb) 9 3 ° uc ipl were a & sg to og eM \ ia) Vet to 4o & & ‘Scanned with CamSeanner How drodloct is peniby. FF we foltous ter following cequance ¢ 5 Tere (db dawn) RsteWS Ponstel 4 8, 6. Uowoer) | Ws 3¢bioce) [Ree Po! : : : (boa) True Whee Watt | [reer] fre a] Me 0 As av te readin ond writes au blocked: Tu Deadlock. 3. DINING PHILOSOPHERS $ ork [soopsstes ota pritosophr (tor GD pil nutes wv" ( tru) A thineteg (Vi Foke-Foue( t+ // te Lge fore tobefond( PN) 5 /]-teuee wow fouc tat ()5 Pur- foour (7) 5 Ii put leht fue bate \ Pur fone (MO ZN) 5 U7 pub right fone back ‘Scanned with CamSeanner Pe | 8 Th ute philosophos on hang ak ht same “Hod Haun copay } wall toe Hue Luft forde Aisur ¢ fag skin thy ey to otempt to take tu ible Forte hin embocty vill get @e Hw nilat fou and atti philetophuu wit wait on each oun and g a will P fnto olaodlock . KR BR Fh Bm PB SAF NS AN HH dufinn NOY He dafing THINKING 0 TH date HUNGRY 1 H define EATING 2 He cuba CEFN (i+ NEN Lett] Ragat philosopher duis (RIGHD (P41) 7-N Semaphore mucttx = | Sewaphot STNI 5 }] al S[UT's we tritializeat to 0 fat State WI 5 Han array fo Recp toe Petey Coe prilasophows ae we j thinkiog L)5 stoke-fors (1) 5 eat (05 pure fous (5 ih evey one’s Ato. RPL IAL PTR TF } alee Fontes ( fn °) 1 dowen( mutex)5 StaeTh] = HUNSRY; \ kere (1) 5 ‘Scanned with CamSeanner 4 | down $0) y pur- fora (he 7)" {down (mutex) 5 Stae[?] = THINKING } fer (LEFT); bee (RIGHT) 5 Up (mutex) 5 ; vot d ten (fake a) ; {ce (atate(el = = HUNGEY LE Stade Cee TTL EATING RE STATELeGur] 1 EATING) 4 staré} = EATING s up(stry)> t y o mutex fs the binary Semaphore wrel by Che phrlosophys! th anuidtial exeluatur mannge- © SW]: an anna of binary Semaphors , ; a to teak of eo phi locophus Bo statelNT: & an Matege onreay, wacd *9. Rep "4 stake S s DD DB BD > fruv'ttaly’ all ae amugned to O 4 Stak. InFelalty aul tw. philosopheu ust be fo the tHhhki % B Analysis Mutex = Va! > 5 y R:T Sfol = O RrT Sys 0 ap, = HME spy: B40 : RT S[alz O ow f22 Ceep { afs1) Qor) esig) : ‘Scanned with CamSeanner Qu Agsumethat Pe Pa ont inthe Cota seate. Thin the pri lorphn i abvo-byis to go into eat stale, thin which statnaar frths door cade & controll the philowophur net ‘to go fato catig state a) TF tnd &) dovan (mutex ) o) text Fanction —4¥eon(S 81) Matos YOY © Po: T Sbol = 0 BR TKE Wis KO P=7H Sby- 0 py sFHE SC3) = BVO | % | Ps (R (beoetes ak clown (ST) staktunt. e Qt - [hat ; e Se wt faterehange UP (ouckx ) » chown i) tn’ the eo 2) No problems. Tr soln SHU Woo Hes e ©) Mont than two philasophus can go tte caticg stale ot Yh cane. @e LF Responnitol for lead! locke o* ch) Now Nukes (oO 70 & & Pez WE Stel. x0 a R= FH St. oO Rh. THE Sv. 0 & fae 7 Stia}= 0 & g Po | PL | x | ‘ [e |Pe, a lock + “Zags (Boe) fn a Karts’ Sige ED: Ceo) AU Pritssepros we buckets (cy mutex 0) Tw olsaslodc: a TIT ‘Scanned with CamSeanner fue Assumethat Preces Pri's inthe eating state. Then proces A fea tyg jo AKO tats’ stnit, thin 74 toll be Suapendect thin vshat the procedure and how 4h priloraphte Pp coil ooalceup aged go fivte cotiby avate. Hw Hues YON eNXo Yoo 1 Slo} + 0 Pe OY MET SU,= yo Pe vue Spyro Pet Sie ° i ) itusaveup | B Rie VP, [fo its “Aue Rr@rT) tod tre proven BS oiueaeeup | Hac xed Gy. ket B-- | “Py be He protires and MToT-- NCH be tre Wieepy semaphores | | Gmuttxe a faitiabzedt to ii’. Fuck proces B executes the follontig contr: wait (MET); wait (m [ (tt) mod 4) 9 (Cte); Signal (1 [ (cer) mod aT)s BR PR AR PS Py NCO} Nes arse Fe = Coniidan ter (rUlow Stttemumtt | T ME is sabishcd IL. ME is not sarisfeal IL. Te i possitok for daoolloe- 1 unnfeh of +e followtey is TRUE? @) only 7 ©) ony x sm 8) only ae only or, OE © dealtock #s ponible fF all Hu four 5 Procerses quires yeapective Muukxe Ondl usaibs chor tre next nautex: @ HEB not sats Recast (Po Ps) (2) (PosPa) 4spRe) (Pav Ps) Gn eater He CS sivouuttn eoutely ‘Scanned with CamSeanner OB: Guides the following code wtal by i procenes to acter Hs tommon critical Seexton, Shoud booltan Locke = FALSE 5 Wott: swopl) Func: atons‘eally sivaps brobtan kes ‘two value by untng Cobh by sefoence oto f Ve key = TRUES Lous SY) a.whik (key == Teve) S swap (Lou sky ); Prt 2ecs[ Rinaa lez] koeto eye) wop- 4. Jade = FALSE mage a Sseteled © Febie (oan) 5 ae vye Hwy: ? Chea for progrens anol bounded © Dead lode fs not posible in | toasting. amnyeae ° te Brag nurs is sated os any Preces notin CS Gnt stop any oftuy Pree which tty ig to enter into CS. : i Souncleat wai ting TS mot satisfied, as any Prem (S not Promivest fe wait foe Ht Finite tine to enter thio cs. ‘Scanned with CamSeanner bi uatng Hae a que expected bY : Than sor Algo. Hh Lousnt “Hous of tae PTO P maa : Bulourtg -formula Cay = Th t (1-.&) T Tray — Next expected buat” tee a — previow expected kuruk Hae TA previow actual busi -tine = poncmuter wobtich conérelt yeatie welght ob preenrcent er ont past Winton ( 0% <1) Ge (0-5) (5) H(5 UI) = 745 Te (0-5) (BF BOUTS) © Qt gass WAS %q = (09) (3) F (0-5I(TAS) = LB +3845 = 5.345 Pies (0-595) +(0-5) (5335) = 25426895 = BRAS fF d= 1 dnt, be. oe OP 5 ° A g & ez, X=0-5- Py, 3) Pa 5 fod Us - | ee fosEE SHO] = SNE HT | | | TG: 5 5 T= 8} TW=B5 % Ee ‘Scanned with CamSeanner FY8| Sune [19 samaing e_Compiluc Suppork Type Solution ¥ Montton @ Monitor is Progremedty language compil support type Solutvon to achieuus Synchronization © Honiton fs coUect’on of variable, tordlibon vauabls anol procedures Comloincak tog in a spectal Rirol of module Called Pathog. oO Th procemer xumity outside tra moni'tox can nok chi acted He itomal Vewobl of Eat monitor. but howeow try can Kal procechives of the monitor. © Honctors Jas an fmpoxtont propody that erly ens Proven can be active ak ani point ok tow tric the monitor. Syntox EXAMPLE, Adams of Fe oppor 4. vasloblu 3 mention Gadition voralols 5 Procedure P, Condition Noxious Eq. Condition X,Y 5 “The two diffount operations porformeal on te conclition vad ablu of the 0 monitor —* i) watl)> i) Signal Qs ‘Scanned with CamSeanner W Woltl) operation ;~ Tht procem porfonming odait() operation o be Auapenctidls Anal surpendeal procen wit be plows fh He Blsck usm Of the reapective Condition variabl « G4) Signak (operation :— eg x Signal()5 or signal (x) 5 ny OV tonel'tion vaniablt wih Qu Procem will rome From-tru bloted quuss ond any OME Procem ww Con tines the exceuttion Signal Aas no effect ancl the Sioa wt Le let > Proctucer-conmumer With monitor 2 [we] | ss | Count = 3 i i L_—_—_—_—_ monitor Producer —~ Consumer | — { tre count’= 05 | OTe ca . ' 1 Condition Empty, Fu) a1 Zz Procedure Ent Ttem ” | 3 4 fF (count = =N) coat (rats. . oe enter (Pend : t Cmts Cunt +t, | ese ie kl ay WP(cunt==1) sk nal Grp ); Baffex (0- N11 5 Tee Procedunet Remout Thuy? { #8 (tount-+ +0) wait (Erupty) 5 Keraove( Pema) ; ee Count = unk -4 5 3 Teount == N=i) signel (Fu) 5, ‘Scanned with CamSeanner procdive producor Ae tak euup > whi (hue) producer ~ Feu ( fom p's producer Commumur » Ener ~ thera 5 ‘ x Procetive Comumur tht Temes cokile (tut) { pro ducer comunen » Renout— Trem 5 procers - Hum ({ tame) 5 4 4 4 Analysis. [eel Count= 22 ° a Producer \ Consume « wT >| 2 ___ Now wr, \Cour *. fares 5 . Pe Gutter nou Counts N ae watt: | comms avin,” Ond Cake = WI=1 a True ‘Wo Signal LRutt) ~ a amnavneaanOPh® ‘Scanned with CamSeanner St ‘ , 4 i b ey Eien irough ects uty tu “count? vera « then will not ies intonsts beeawse fate Hu moniter only ont pHgeum. Getive at amy pote of Ene. ae Dawe we f4ot Geer we pg sh » Gu a SE SEO =0 Votd tasouen( void) Pa pts); proces arsed ++ 5 v6) 5 ($1) otal (proeravived |= 8); we( R)) ples; an we(ea) Proce UNE Se N(s.) Pls) EF (pocematyt = = 3) i ‘hi Ba precescovrivral = 05 we Ry proceslepr = oO fl v(si) vosy}, 4) gain PhO reing Jue 8 Feroaor WER: "é os v(S3 \ Pr) Wwe ky ! us 18. WB : Sok unsigrest he LE Ot fo Rees, prowsanind PN 2 4 (otwayai lt A proces-tbr= iy x Deadlock a3 only 4 procens aratnes 3 Seeumomertstchingsiesokudn os pmaseastenstlawed, ‘Scanned with CamSeanner 4% | Tune \p01> see CONCURRENT Rogrammmg eo Read se ees efradigits Side e *Fs totes farda bts Se qe afd; . oo he gets Paccedence Jraph: \s Note 1 Any -tuo Statements Sr ancl Sj Can be executed Contwountty er paraniely iF thy axe fUowteg the below Conclitions - 1 mmm ae OHGRSHRKEKCKKTA © Rsv nwl(sy= O 2 0S) ORI = P © Wis; A wly= o A The Haak condinoumnt propranntng é& pene $0 on Ye, mul procera sy acim: cs Conewvunn} dros bi-fhermt- muanings 5 : Gi) They can execute Goncwourthy oF Parallely . ee é ‘Scanned with CamSeanner S Ww) Thy don't have any clepenctency * Be (8) Any one can Stoxt Firat. 2 A. Te concwuent p g w(t be word Ben Ry ane 2 » S S34 parencl QP Drow te preadante grape or te folonieg program 34 &) parbayia E Sa (0) CS) ig RO YY wm Fs ees z 5 2 z l 4 Se} Ss} ena begin Sy} [3 @) es ba Su Say ‘Scanned with CamSeanner Ge for nn fpttowing precednce Graph rite par begin-end Cooke. G2 S43 &) Pox begin : S35 Gy) tegin Say pax begin Gy Ss» & . po gar ten eed Sa} i Si4 pon be eo, 25 Pan begin Sey Ss zs 33> ‘Scanned with CamSeanner S® Note: ce Be SS TL Fs not possible to uanite the eoneusoumnl: Pryram fon ab the 3 Pieeroluner napha by tuihg Pax begin - par endl. bupit (3 voorranch SQ pomible with the hulp of ‘Semaphore operators 1 oe 7 por begin Say > begin 3 S3', Be y Say 2 (Se) 4— Cuts Dependtency Pax begin » ‘ a Sey +#— Not possibl 5 &) wto varite wir BS Pas-begin fend cw 4 5 Cross clupenctuey of, Se eH" , Conntet Seln using Sewaphows Call bthaxey >) « aie B gu unapela) Heine ‘o" > _ Pos begin Tr ; begin , Si» partbegin V(a) , V(b), paxend . end 5 j begin. pla), Se» Voed ene 5 ‘ begin pb) » Sa» Vid)» en : begin PCE) , Sq spanbegin V(e) » VCAs pavcend » enel 5 begin Fle) » Seg), ends begin Pld) + PCFT+ Ses VCh) rend 5 begin 0G) + PU)» Sqrend Parent ‘Scanned with CamSeanner Qu «Write conawur program + Pax begin begin Si, Parbegin V(a) V(b) porend ensl > e@ ee@ee@@e€« e@ ¢ « ( begin PCA) + Sz parbeg’n V(e) +l) posend end begin PCB. SVE) end 5 begin PCCD» Sa partyin VY NGG) parend tonl 5 begin Ad), Ss, V(h) end 3 begin PL) Se» V(t) ends begin P(g), PLAY: Ple) 1 Sa, VU) ends beg? PLI)sPG). Sy ends Pox end. ‘Scanned with CamSeanner BE Conicr Ha Following Concanatnk Hgnam : ie Count = 0 Usht’ wit beth maininaim foal abe re tally () of count of ter completion of both Hur: fint 5 F foc(te 13 i255 ite) aetonsoh ay (>. fount = Counk+ 1}, Note Count count ++ | will execute mn ay: fn 3 tratruction Uice (nol, { orbegin Moaniar and thin stone + Says ——-Ps T Load Ri Mecint) , T INcR Ri ; pant =P TL Shorr MfGunt), Ol Whe Ws @4 ws Count ity 45 i page oe a eae ceunee OHV’ Pe (Aeutty2) - ve jo a $2 ee ‘Scanned with CamSeanner _Sount = ERY 2 2 Past feations x [EP=0| Be ee AY tleation 9 a (Preemption) Patedilds 2) adenoneay Sy es — Preemption) B: 1S! jtnabon 3 OD Gount= Ri = | Bon ~~ = =~ (Pa ennption) Por 5 *itaations ¢ (BET] 1 Bi 5" Heaton 3 1 ler= 72 | al que meme ce) Pe Beara, 5 {sation ee ; Sar + —- fon Py 5 thenation 9D [Rretuar = 2 ‘Scanned with CamSeanner DeapLocKs Definition > The two or moe Procenes ove. praiting 69 Some event to happén urhich Mio happens »-Han -thase Proteries aout Said to be thuotued fr tn” deodlock « Basies of Denct locke Procemer, Requesting Edge (BR) Proewe PF ruaig B) Prowowk is euquutig for Jorone fastance of buo fratanca of serource newower Ri. : * Als cation Edge _ o) One frtance of eanaxaRy @) “Two instonua of xexouser Ra ny fs QUlocated to process AUlocatel to Procer P2, if R R Note. O THe resource Hequist anol Herounce AUD cation will Le MePreruted by wing Resouer aWecation G raph. pac = G(V.E) S Procenes, <2 So Reaweating, Atlocarion Resownees ‘Scanned with CamScanner Ws THE Resource Request’) Rebemre Life yl. - LTR proces wil make o seequert for the xuowree (to tre OS). 2. The 0S Clary vabiclote te suequent- of the procen- 3 TP the serquest mace by the proces §S vole than the OS with Check, for the ayai tabillty of Une Hesownce . ALTE the erowret ts Frualy oryartob thin it will be attocaded 10 the Procons , Othuxcrvise the proces Inos to weil. 5 STF at tre surounca xequined for the stat oF exeauiron ne Allotateot then tir procens wil go into execution: 6. Once execution of the proces 1 complattal -Hun itwil teleane Old Ths HexOuwes . lg © Deadlock exists in re RAG the RAG Ne © No cleadtleck extsts tr ‘Scanned with CamSeanner ee OMA 0. System wshich bas "N' Procents aud 6-1 Tape dnt , each procent Haguina 2 -fape chrivt “to CompUht-Heir Cxeurtion “Hain whar (5 Hy maximum Volus of “1 usiveh eww cttacktoct free execution @) 2 iw) 3 oy ey 5 ca ach proces can be altocatet {tape cbuivers and 1 extra tape drive con be used to Jalllil-thr vequest’of each Proce ont by one « Tu, nt) 416 6 sth mayimum yal For N Should be 5. Qs Grieux a gysken whida Loa D procener Gnd Cath proters mquines 2 Mihountd fo Compute Lhuir execution than shar is the adnimum no: oF roomed respite to come cleadleck free exeution- @ 2 (e) 3 Lo" 4 (5 3(ot+ 1 ¢ R GSR ts tainirasim valour of R may oe Zh Pm Pa Ps 4m a A@ Gan full one by one. + | ge Conidusc a system wich bas “Ni procemer & 6 Hurouner earl proaty mequin Hesources KD Complir thir exeeutionthen urhar isthe max (ny tubo enum oltaoller 4 Exeuution: | Py Pa Re gq a | N(2)+t

You might also like