0% found this document useful (0 votes)
7 views

Problem Bankers algorithm

The document discusses the Banker's algorithm for resource allocation in a system, analyzing various process requests and their impact on system state. It evaluates whether requests from different processes can be granted immediately based on the current availability of resources and the needs of each process. The document concludes with a determination of the system's state, indicating whether it is in a safe state or not after processing the requests.

Uploaded by

nctitacademic
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
7 views

Problem Bankers algorithm

The document discusses the Banker's algorithm for resource allocation in a system, analyzing various process requests and their impact on system state. It evaluates whether requests from different processes can be granted immediately based on the current availability of resources and the needs of each process. The document concludes with a determination of the system's state, indicating whether it is in a safe state or not after processing the requests.

Uploaded by

nctitacademic
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 15
— ¥ t Banker Algosithnn | Y Conéicler the SnapShot of System. a pS | cee Available Procods: — ara | ae S la eae DIA ‘i; cae Le ee ee aed Po S| oe}! Vas eee eee B oh Oa | Pa i ie is) | Ps [© Secs | } Ay Js ls _ | Arsuey the following qtadtions uding — bankers * algorithm - o Whot ig the, ewntent of nead mortrix? b. Ts the system in a Gabe State? © Ty the *Fequest from process P,, aniwos Peer ee eco ee Yequest be granted Lmmecl ately? Oy) need = Mak- allocation [pratece| Process | Neod | | | § G | & |e |s | Po Dlo |O/o0 Pom Saoe mike i Ve rela | sl 6/4 | Gg 1 a aaah ae Sato ae (ov) nob Po? heed 4 available O;0/0,8 2 1 ,5,9,2 Po vB granted | Cuxvent oxailable= old oxailable + allocation | EST moro aia = 5,373 P) : heed 2 anailable | oom Saa Isr 37 | Ue cmenot granted Pas need « available \7079,) 4 1,5, 3,3 --P2 LB granted | current Available = old aNculadle + allocation = (gG yea Ua cay | = Dy Bee) Pa > need 4 available | Urn = nl eae Derr rn err | “. Ps 1S granted | current oxailable = old available + allocation ero eon Op | = 9,18, 8 Py > nocd 4 ovatlabla | Sib yro Z 9,13, Nb Be Om One grarted Pa: need 4 onailable Ib; So £ @ 138) W355 PiU) granted SQ NB INS eh On|, OFF I = A, Ih) yb Py: need 4 allocation H} | Curent oNailable = old available + allocation | Sb, He O S 2% fy Il, 6 “Py Db nob grantost The System Win undafo stote Ic) Request 2 nood 7 oye ON aera Request = Available ©,3,2%0 4 15,22 Available = Ayailable - Request SMS e ee OSes Os Allocation = Allocation + Requost = O11,0)) + 0(3,2,0 = Oh ,% J Need = Nead-~ Requost SV on ein anor tO aI 10) fyoilable = \,9, 0,2 A\\ecottion = Oph, 21 Request will be granted and Gotisfied . uy Cs Aiocation Mo® Byailable| Need |p s [elo [ale le @lAlelelplalsle D> Bea ome on (ce ei ome ome | ess ei folole) eee ene Ps, o|5 9 {Lb Dieta ie Cache m beet tse [si Sue Po : need 4 available 0,0,9,0 4 1,2, 0,2 Po ty granted current oNailable = old areulable + allocation SOU O aan Onna) = eral PP) : need 4 onailable eo One mesic | =. Py D Hot granted. |Px > Heed £ Ovailable orch pe omts | PB is granted | | convert oXeilables old axailable + allocation 17268 4 1,375, 1 | | = &,5,b/4 | Pa: need 4 available | | V\onl 2 875/804 | ~. Pz 18 granted . 2 | ‘Curvent available = old available + allocction | = 8,8,6,4 +0, 5/375 = & 10,9, 5 Bs need 4 allocation | | Sib, kilo £ Q,10,9,8 | >. by ie Hot granted . | Py > heed 4 allocation il 13,30 & &, to, 5 | Po granted Cusrent arrailable= old arailable 4 allocation | = Elie Sa} Wylyp Qa) | 2 QIN, I, b Py: need 2 allocoction Ser Caer ao | Renae tno granted . \ | Not granted, because the process fs cloadlockel [Fhe request Ao, 34,0) iS not granted (en mediately ; |! Consiclex = | the Snopsy ot of system Process BSS | Mex eaeee 8 a le] e[ele [> [| ele |» alo, ©\o ilapololy lati |5 fale ( Ei | | O11 ® | oO | \ Tienes | | | | ! Pa | i lise a ae 5 | el . Pale ton tenleu culouieune Is | ' ES OPO Ree [ot sis 1 j ¢ | Arsuwox “the following questions using bantcet$ | | algorithm. a: Wher te the content of hood matrix? » |b Ty the sSustem tn a Gala state? M |e Th the requart from process Pi, awiNes qor | | | Co,4.218) can the request be granted Unwnediatoly ? | | } |o) need =° mar Allocection | { Salciginecatn | ProcosS | _ _ Need Ae | 6 Gs as | { 2 aos etal | Po ole |o Ie | | P) ® /U |S |e Pa Viol cla | | | Bs B12 iA | || ole |y 3 nor a eae OPOO 2 {B/S Po iW granted. Convent available = old available + allocation | | Po: need 4 onailoble | ES WOMone OyOn | Sealine Py): need 4 allocotion OFCOM ean lS YEA po CoD Ope eencec: Po: noad 2 allocation Oop Meu itsy 2y, os =. Pr B granted | Ei 7 evan Soe = Q%,%,6 3: heed 2 allocation | curventt avoiloble = old aNailable tallecation ©,0,60 4 4,2,3,6 “ P3 iS Granted Current anailable= old aXalable + a}\ocation Se agi OMGT TST os = QW, N48 Py: need 4 allocation yas) eater Le Py granted = ier 3 Current arra\ lable Mi old oveilable + allocation STi on te aan OO Ny = Qo Moo IA, 1A Prt need 4 allocation Oimpiga a El, (My an ee grartted jcurrent available old available 4 allocation | = Ay Wye lag a 1,@_, ©, © | oon) tomes | The dystem 18 In the Sale a) = & 4 bib | Pa: heed 4 aliecation | NO) Omen one) | | | | CoS grantor Curront available = old aritable + allocation cS Aremere SB, hy Bp Sree voy es ®,. need 4 allocation OF CY at eee One Cees granted Curren ovrailable = old available + allecotion SALVO, VeB HF Op By by = 8, \o, 10) 1a Pi: heed 4 allocation ©,3,3,0 £2 & lo,\O, 1a BS Granted Current available = old available + allocation Ses = Q, lo to,12 + W728 ECOL mS ayaa yeaa The dale Gaquance ig exist . de PoqURst P, Cot 2°) & granted, immeciorely . 3 Consider the following srapthot of a dystom, a A\\ocacklon Met Available Procass f = S Rose Ca Se a nano Po i onlsieco lespriesh [eSesiea ens Pp eee Cmenon | scm a lo | poe Se Pons) sori) (he pear oe de | ) (sa | ay SE has es Brsuoey the follovatng ayuastion wing Bankers &@ What t@ the content of head matrix? 6. as the agtom in a dale state eo eV tre yaquest from process Py , owviveds kor (1,98) - Com the FaQuuest be granted Ummedicotely or not? a) Need = Mox- Allocation a bv) So}e. Bua or not al Por: need 4 anoilablo Mythos) 2 So cd OH Seer nots granted . Pro: need 4 available WA, A £53,358 os By Qxarted . cutvent oNailable = old available + allocation Se enee en ealon Senso a Deoc un Zaonranabte Op a oes ct +. Pa 18 not granted. Pe Osn hanes yon fs granted. current available = old anailable + allocation Sees oU a oe | Senate ues Pee Sees z. Pry 8 granted current ovailable = eld oealeble + allocation = yy 3 ODA 245455 Dona ate amma 5) Po ja granted aNoilable = old oNoilable tallocation curvent | Sano ae ee eon) | | Po: need 4 allocation LA Cero m a yori | Spe NS granted CuRVeny, es. The System the Baquance Ze Dao) Pu, Po, Pa > ic) Requat 4 \0,2 S | Request < cae \ o. Request will | Ayailable | Alloc oLion Need St eee } ovediable = old available + allocation Sea ED hoes BEOn Os Sloe oie) ss in the Sake state neod Sis Axaiilable Seo bo granted and satisfied . Prailable - Request BC o5o = &,350 Pilocation + Request Ay HO wv bh Oa 8,0,2 Need — Request Broo cue \Q,2 = 0,a,0 in Available = &, 3,0 [Allocation Beh DEL | Nese) ae SRR) t | hae nae k Alccation | Max | fvorlable | gear | eal } $ A] B le CB Cay cae) al alps } t % ye jo eee Pog le | f | Cie eu oven | Ch) oc). (ea [o canis Pees Pole ine Noon eee ee ere | \ \ Ra ps ln D | A 5_\5 ial | t Pu G/ Sie] sie P lo} 5 7 Po y heed & available sS59 4S 2550 5.96 W Woe ehe nted Ps need 2 crcilable 0,230 & Soa CAS Curvent need 2 60,09 4 *, Po 1S) Pa: heed ayailable not Bs 39 granted = old ovoilable + Allocation = &,5pt 3,0,a = sho avai lable 553.2 grated Z onaileble | Carvent onailable = Mm oe Pa 1G granted Did oncilable + Allocation neuen aero nie) Ny Seance ) Py: need 2 onailable ONS erent granted Current ontailabla= old available 4 Allocation = A,4, 34 0,08 = 1,495 Po: noed 4 aXailable ee Po is qranted , SOON \ab\e Ea On oe = sTeaor) Po: need 2 available SAO Oe ene) Bee) grantod Current oNai\table x Arloeartion \,9 Current availavie = old avcilable + Allecation sl hos On ae Ones 2 1, BT Ve Pa ARES Oncaea |The Soja Sequence 16 exist . So TeEqQUSst | CNC t ORS mae granted innmediately.

You might also like