Docsity

Operating Systems : CPU Scheduling and Deadlocks, Study notes of Computer science

Partial preview of the text

Download Operating Systems : CPU Scheduling and Deadlocks and more Study notes Computer science in PDF only on Docsity!

& |Schea ing: ° — [eeu schéduting & om ine process of selecting Baie [OLS process gin Pe a : css going._tae— CPU to fee i IA gen eduler is_tesp ansibje Pe _ fn peoggrarn_chtuale he executed on tne tte aera: alaowtthm is the alsa oithm Lseck by lo cu -bo Camry out tne Sele chem of a process Lon exertion: wl fa. of schealuling alaastnms: - | FPxst Come East Coie ate, CEceES) - Shortest Deh Et CeTe) + |Shortes?+ Kemofning Time Next (Spr MN). * [Round Round Cr : Paci Scheoluling a pS as ee | From Lio Reguest To Seyvyce Service Mode) of CPu Sebectuling CPU Riek Cu chor St te a. me periacd when o process ts lousy With: CPU. lo Burst Cyche D Th fs a. tdime period when a process is fou y With Tlo resources - inal working. load =r ° CPu Buxrsk cxdtat storee from Ffrle- weit for T/o Lio Bunt Slore fPocre ment CPU BUssSE MORES to ole mast for i/o ¢ Blo Buwt ods store Soe cu, wast For s/o Salo Buwt | Explanaiion: is process Pxecuition Concisks of a. Cycle ef cpu exertion and zlo wait: A proces. staste ts execuaton then CPU is ascig nad to ik,Se proce s executfon beafns with a CPU burst cyclo. “Tats cs J followed by an Tio buxt cycle then a process L busy acing tlo app eration». B Proceso suotich Trequentias from CPU hurct Caycte to TIO burst cajcle. and vice vetca- The complete execarhon of q firocess teats twit * | Crdterxfa tn CPU Se D Sane 4 —___1.|Tk is tne perceninge of time a CAL ts_ousy at [tre aoa) is to keop CPU as busyiasg | CP UNxyilization: — processes - in execudtng pete = | ible- i frig utife ation means the cPU is petna used weld low utilization means it ts 6 idle. we Itt ta caleutated as: CPL) Utilisation = CPU busy dime vy Joo % Total time 2. Throughput * [Te ts “Sire -niurynaber af processes com pleted In a aiven Hime. 1.9 me -lTks Goal fy +o enrauve more prnoceccer seo fiir lane procesced Yer unit time. More througout means the 3 peern works faster. ATE ts calculated oa: Throughput = No-o0f processes comapoletedl Total time Tiercnavre une) ime (TAD: jt t the total time taken Prom 6ubmisston Hho complehion ef a. proces: -@ ths Tt: Inclisrcler Lucithtn g. Hime, COU execution time, and slo +imoe- ooo jie Lens hoananxo une! time yeans jpyoceses, are completed faster. \e: Th t& caleutatey Qb". TAT = Completion Thme—Prival Trme lalatting Tyme f WT)! CESS spends TEactoe’ Loko scheduling’ slgedinm Ipnce.ss pricy ana Cpu Hours Leng ty _ ofCect ad Lime. “te|high wating S nyvse ees Teed nse acess ] Starve Hon er ell icienci, ivel Te fa Cabcritated az: \arT= TAT — Buxst Time.- sk Tynes of Selneduiling: TICPU schedulfan ex tne. forocess al sebocting fal prece an Allocating the prac An He CPU foo exerubtad. wiper. are -live shapes oF Scheduling on Shwe fae bank ety eu A Tunntng (D0 ces Can lore Mmtbeynipled or nor”: Pree moitiwe echodulina d Kio ~ prea ple ae. Scheouling _1Seh ulfng Preemptive on-Preemplive | Round _|EcES Robm — QTE | SRTE | | Priorihy. (4) | Gant chart: Po | P4 PL Pa ie) to TA 28 3G eT-AT TAT-@T Proce Pyaivel |Burst | Compleh | Tumoayound| watina. SS . a Time(at Time(ary Time CDI tne (TRT) [thyme Cut) ion fe) 4o 40 Lo fe) Pi A 4 4b 42 3g Pr 2 1A 2k 2G 42 Pa | 3 % 36 33 25 Torah 22. AG Avg. Turnaround Time= Tat) Tumenronmnd Time m: No. of processes = 82 ma yy = 20-5 ms. Bvg. Waitna Time=Tetal Waitna Time aavs T No. of Proc¥sces = 4b ms Ze = Ibe me. ea ae j ISTE [hs a cPu Seneduling algctihin tnat Shortest To Fixrst (STF) * sebecte ne precess wna Shortest oysartion | Timo to awn Next. (th | T+s marn al in +m Minimize the warttng time of all france Sea - lie | Th has So types: “| Non~ Preemnohve 3 : lPreemprive Calso called Shortest Remainiag Time Next -SRTN’. Ww! tN non — preemptive STRr ~OMACe A: proce ys iy leamyts, execubton, Th rons ‘unl ik is Completed! Ta preemptive ore CSRTND sacunning GP ons can — iterated Pa incbeghs prcecets 1405 Un a-shoxytey burst time, avrives- vic TE hue pro cocses have the game buyst aime, the FECES wile ts used ty Aacido tuhich ene vwuns Boyt. Mil. da. Tt aives least averaa. matting time Je guritable, for Leeched Syste rms. Disadvantages: J Lana Tohs "tac NLA Cr chek. CRU Hone [eharvatia) if hand to KNOU2 a precorais exack brea Hime - sieeeadiareaniiae es Lih Ue SJ —*1 Round Robin (RR) * ° te P+ i a preemptive. cchealiiling Olgorinan For time—charina ae Bed g it|Fach pyeress o a Fixed CoOmMou 7 iv The. Stheniuber pu rcAtA the, Piyst proce, 5 q tne tities ano sets a timer for One AH ne Quantum - ATR a process Rene Shoes bebore tne tim, ouantim, it relboaacr tho CPL o+ne rune, it La preompied Lvhen tho Lime expt ui-|Preempted PrDcpAses cure Morwead-to he end Dh tie Oticie anol tny schools ley selecky fhe ext Pacers. Every Gras ghosts cK ny snare O} CPU time. t Nlo preceads sStmyvatton oaccrs. I DPisadwa tag 2. : T+ haa hiaty overhoaadl clire to frequent context lr ty on Tt can Frasve le ger fae! erage Wa then time: z R —¢ ____ | Priiny3 Sch eo ult ing. Maaritnm : 4 yee Ped ph asstan» QO. pyrexvt 4 —____ lana’ +ne uiigyn east: Praorithy forocess eons ‘ i Lxsb- 4 MS ES pets processen hase the same Ney Are excooubed in FECES order. tie Nov_ Preemptive: Priority ocheduling leds fal Tunning. forces U penceh ir: ve a higher frdorvhy. pomcess Owes. ively Sa prem prive amecle tne Cou is mMok Inte ruypiedd inde) the Client proces, Conple}es. vv: Preomptive. | jatosby sched ling pauses ‘ G 4 +he 1) rie es {fia reeoa races usith higher prtouky OLY er - vi-TThe he ghtex= priority Prwehieck paveaes q TmMme Nadel Woe HA. poured procens restimers after tk dinishes- Mil | Prluensta oe”! : - Itt allo Pinpowtant taka oyun Pw: * 13+ cleaytu shours relative, Tan jpond-ounce O x Lach CLAA » Witt Disady Aras! ; Te Poa couse Sharvahon of low a riovby, Pee cee * [Sa A Aifpecrls to clecsde tomeech Prony 1 for earch PYO cts « aT SPE PEL ELE LLL 4 { A dea ollock ts g situats OF the process twoiks Fox a _btaouree ge CLAY VAT his siuoctien-none_of the processes on 1COn’ execiite, becouse. rhe peaocurce each : One needs is allocated to oanoathor warting prccerd. ’ itl Psaurme there ane thr oo Prmoc essen P4, - IP2.,P2 anol droroe wesnunres RI Ro ,R3- Anittoly 24 is witin PA Ro iy usiih Pr, Ana RA tA uxnjpn 2. We Late ne, C4 KeGiagat Ro, Po Peg t1paba R3, and p2 Coit exks RA. Since bach requbstec resource ts alread in tac att din op processes dtop,cofating a. he aollocke - ‘J a . | | | | ——PLRL R2 YS ! * | Necessemy Con cbitton GS PETIT TTERKKARAAAAE 3-| Mutual Exclusion. - hs condition Stakes thax at least ong lresstotines Ast behen= sharable sie. only - : — Process at a Vime can une jhe rooure. ° Harney process — must be delared until tine reaurrce | haa been released. x r aL AL db died | # 2.) Hold and Wait: ’ process ta hal Aing. adteas} ane w ona! LA _woairrng +o acauive add: 2 SQOULYCEA hola us oxnor prncerson.- 7 “Itt can reg La pb Der reaou weds Untnouk releoal na, Ah, ome ib oe dy hax. 2.-! No Preampbion: *TResmuryrms cCannnt Ibe preemuited ox -forcitl, & rr 0 Jd strates Aye a. praee LAA = i elTheay Can only Nhe puhoaaad oluntarly | - bu eo pomecess ~Anolaliin ey tho mn ustialley opter Ub Nox: Cerenyplste a Lb, Snide. u Hel Cigrmular Uo%ib : a ‘TThia condition occurs whon -+hore in ao 4 Aer pt rece sre x pot Po, Ps fees Pr, [yhoo + } a boy Oo. Reanunre + bu Pn and s0 en toith Pr wvarcting Lor ¢) 4 7 “¢ ia_resoisee. helal borg Po. * Thue: Porm.4 oc cirbar chain tohere over, . ~\ x4 Another tn +ho Loop i 5 : Rosignest te / Waiting for = }-—+ Resource a} PAGE oe Si No Preemption Condi tiom:: paetentte ln allowin ro Deadlocks can he Neaouxrers +o we pxceem p+ d fies fomocnss 4 Pak rnisat relboose. its ar err iu. L-¢ mo a. News regu erdsk cainmot le granteal Ymmeols Abehiy i ye aourcea Ore crolol rol to au ift-|- The breleane Lisk toy other proc erres- Wwarhna twlThe joroce44 heastnsts only udhen tk can Ce ae. all its pacevios day halo reaourvrenr — t+ by pregtostin a. qleng unth the nor onern card) ; 7 a Ay Gd iminad Charce ba ae Loaitk Lowel idcisse ° z §-| Cann rece 34 1s AArartanedl ao Uunigasrs } ons we num ser tthe fare ent eorelar wait ntyies Mist regu cat resources in t : increnatnga ovclor of t+hoty peicohy Numb ew - ieg-l ot on pmo eds pegirests «4 PRersomrro uth Lay Q teaurer riomty than one itt already U holols, ft} meat: ae rebequsg. the reg yoviombh reaouasre- . {h . bv. “Thala nNumeortee! Onrc Noa pyres that etrrcular nadon oi and pS a ¥| Banker's Digorit+hm{ Steps) | Bankerte Algorithm is_a_oleaoallock Avoidance Alaevithymn that. chore z the alloca trol , Grequired pond availelbe Yesourcer helbore Giving them +o cng 10) *e pmacess to auoia § Pradbock. PY} tinea x 4 — -_ 4 ( 4 ( 4 q q Mat» A: eontains allocated vesorivcos Mater B: Contains renrdred resources. 4 L d F Ve cher : keeps Teande ot Free -resource sf sk q \Al hen a fonaceas ecitipsts peaniwyecs Hi, ¢ OS cablocabes trom ona hral hadia- 4 , 4 Piter -+-he du tal +ne os Upolates matrices ¢ a! anol BR cuncl the F veetor.- -4 Sleo >A ! « JO. rs . 4 | an al 4 The O8 COMA por ye tne Fo vector’ with ‘ Lach youu o¢ Amat ty Pp to che ck ~. if oun jorecess Can comap leds ; Stepp Ay’ ‘ Tf" FE cn smatter than evens vos in { Matix Bit. DO Coss. can cn elit f V i Tr anol thre. $ustlem cis undafe,- |! o 7