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
You are on page 1/ 8
Name’ Ashutosh Vilear Pal} =
Rott ts: UF =
deadlock
Lil write _clep of Banker's algarithm to_avel
YY Banker ‘e _algarithm is the deadlocl avoidance _algorithr,
Banker's is name because the algorithm is _frodetey
“dele
aftet_a banker whe makes loads fiom _a pool of ~
_||_ capital and receives _paymente that _are ‘returned ty >
that pool «
= Jay Algorithm is_check_to_see if granting the request _feajy
ta_an_unsafe state _. 7+ it does , the request ts
denied. If granting the request leads ta d safe chute >
it is carried out,
3Y The Pika proposed an algorithm te requlate fescue
F
Allocation 42 avoid deadlocks. The banker's algorithm
is the best Known of the avoidance method .
Ay By Using avoidance method, the System is akoays
tept in _a_safe state
Ss THis easy 4o check it a deadlock is created by
giarting a request, deadlock analysis _metheds t
used for this.
6y Deadlock avoidance usec the toorst Case analysis
Method to check for _furture deadlocks . :
77 scfestast + There is at least one sequence of
lesource ilocctions fo processes that does
eteesuaaes
lesult in a deadlock.
oo * Ranker algorithm uses following data structure + -
be Allocation ¢ Allocation is a table which tow tepresents_
coeee ee proces and _column represents Tesources —
= Olloca Cinj7 = Number of Unit of resources
Rj held by Plocece Pr, ae
—Max_be_the maximum value Qumber of
vein valde Number of
Ses thet procers's claim is equalRolINo [y
Names Ashutosh vilev Pah)
“requires duting its execution. ___- ___
-— 21lax’ Max be the rmaximam number of tesources.
| ___ that process _tequire_during ts execution.
Need = Max~ Allocation. —____________-—
is Available: There will be number of fesources still
| __ available for allocation. this is equivant
to the otcl number of fesources minus
dhe sum of the dilocation ef to all processes
in the system.
Available = Nember of resources — SUm of the allocation
Eh Dall process = Number of resources —
¥, Allocation (Pt)
iz]
* Weakness of Banker's algorithm *.
| tr requites that here be a fixecl number of
lecouices +o allocate +
lo The algouithro teduires that user state their
maximum needs (request) in advance .
ay Number of User Must remain Fixed,
__% Examples of Banker's dlgorithry!
system Consists af five processes (Pi,P2,Ps Pa, ps)
and Ahree_tesources (R,R2,Ra) » Resources. _type 21 has
Instances, fecource type Re has $ Instance and
_ Re has 7 instances. “The Fo Nowiy
1g_snapshot of the |Name: Ashutosh Vilras Patt
Pall No: (9
| age
| ate
: ae —— =z
___[frrecece | Atlocation Max Avai able ~
Bl Ral es | Ral 23 R, Re R3 a
|| pe Top fo | afs[s [| 3 2 2
Oren la2g Osl0! 3lal2 ee
Pa Blo {2 glo}? ~
fL py fo fa fy aj2}2
Pete Oona ue) ea ails :
tb Need = ax = Allocation 7
Process Ri Xe R3
Pr 1 4 3
Pa { 2 eS
Ps 6 o w
im 9 ! .
P. 4 * i
currently the state system
is in safe state
% safe cequence!
1> Tn the above example. need of ptocess Pi ts (44,3)
ane
available is (3,312).
Need > dyai lable — False
LY Need foe process Pa is (12,2) and available
(3/32) 50
need < available (work)
(1,22) < (3,3,2) = Tee
then Finish Lil= True
Request of Px is granted
= (513)2)
Work 2WOorks + Allocation
=_@s3,2) + (2,0,0)| : Rott Nox
|
1B)
Name: Ashutesh views Pah)
Tage
Date
(Sy Next Process.
hew available (13,2).
Need >Available = False
\ (660) 7(532)
| available _(6,3)2)
Availab le
| = (s32) + (2h)
> 43)
S7 Process Pe -
Need < Available = True
+ Available + Allocation _
Ps need (66,0) is compared with
G> Process Pa need (011) is compared with
UNew availabley
Need _< Available
(431) ¢ 7143) >The
Available = Available + Alloc
= (74 3) +00
ation
2)
>(745)
6» One cycle_is completed . so process P,
| is compared with new available,
need (7,43)
Need * Available = True
743) <¢ (45)
17 Process Ps: as
Need < Available =True
AVai lable
Available = Available + Allocation
| = CUS) + (apo) = (155)
Nailable + Allocation, —
(@¢-6) (i Ss) + (302) = lo S74)Name < Ashutuh Vikas
Roll Ne: FQ.
Poi |
| explain dead lock aveidanst cli sple:
» Deadlock avoidance
About the long term
depends on additional infotmattion
resource needs af each
Process. the systern must be able
to_ decide
whether granting a_fesource is safe or not_and
Only mdke the allocation when i+ is safe -
Unsafe
State
safe
state
[peesttock |
6 When a process is created
it must declare
maximum claim, ie the maxinnym number of
is
anit
Tesource . The fesousce
moanyder Can grant
the fequest i€ fesources are available
« For example it
process 1 fequests A resource held
by __ process
2 then makes suse
that Process 2
is not wolting fer resources held by Fie process].
Banker's algorithrn is the deadlock avoidance algorithm.
> Bankets algorithm
is_explained in detait
with
ane example
In
question No. |EXP NO :-9
Use vi editor and perform all editor commandsP NO :- 10
Write and execute shell script by using following control statement features
“if” statement
@localhost
er any numb