Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

12 C,3,4,6 7)

Cs16 C4,6 2 Page No.


Date

Vnit 4

Dead lock deleclion 2àeloveNy

when this dechnique isuSe the System


does nat aHe to p0 eventdeadl0ck aOm
CCU1ug
t leSS hcm OcCua2e ta1eS to delo4
then t s Sdme aeiom ecaven
Epdmthai
aleacl
ollock_dedecion w t h cneTes 1yares
Cach uPE
To
dedect_dead lack im a $Ste
th_can esouares eaCh u
COm ComStut e s ounle
qaaph
i hese
aphLontains ane 0 mme
Lyclesa degdock exils
amu notesSJhat_15 paa af_cucle is
deadleck
1f mo Cucle xids fhe s4Stemis n0
dead ock

Considez Susienm with sevem_2aa


paa ceS
Ce S S _ H
2 6 3escunces R
Lthestade _efwhich
esoune aa e CoaaCnils_dln df
hich
Cns Coanentl4 beinq39led SC

I Pod CeSs_A holds R wants Ss


I PoccesS halds nothn buyt an!s-

halds mcthiT9 but_an CS


Page No
Date

Paccess D holdsU wnis SPT


iu
Iv Paccess E holds P anS V

holds w Wants
P'o0 reS5
holds V
PacCes S

sySem deadlock 2E S0 hich


In this aDeinvolved

Poaces5

= T

9
p 02ph
aaesounte
heneexids a Cycle in
aSShoudm in above Etg
the gven
leadlock_im
whene exits
Sysiem
Page No
Date

-As pao.cessD E2_6


a a e fhee in
theneia th
deadleck.
ucle fhey_aae muolued in

a d e i e c tdeadlock with
Thealqonitham
aes.oushe_0 each Hme

foa each made im the qaaphFen0m the


Fallesin9 5steps eithACSfhe

Saaim modes
L Taitailies L o the em1 i5t P_dest
qll the aocs 5ummgaked-
A d d the Cuaaent made_fo end _of_L2
chekto SeeIE the made appe aies
wo tmes f 4 d p e s thethe gaaph
Comtams_aCyClesS alanathmm
dcominates
Eacm the givennodeeifthene
amy nmonked aulgdluý adeg f Sga
am
4oslep 5 els e ga to tep_6
Piuk 4 ummaned autacu ame qt aan1m
maJadol themfollouding to fhe
MLD Cu ent_m o de g o fo Sip 3-
if these mode is the inilia noden
acph does motContain gn4C 2

allaoaitbnderminates_othenuise ehau
a dead £_emovei e o back
t h e pLViSe_m.ode makethatdne

the Cuatcnt moole g to Step 3


Page No.
Date

Recovei foOm deqdlock

falloaing aoe the ays OF_aecovey


oleqdlock faom

TRecovey haough pa.empHon


T Aecavenuthadugh RollbaLek
T Recave.ny thodugh Klling paocesses-
Recoveu haouah_paeempHn
im Some Case it_is possible fo take a
ge60ugce_awas am it 's CUa2rent gWmfn-
fempa2a a lu gue i t a_agmoth er anceSs
The abilitu fo takeaeSolnce quo u
the paCe S haue another poceSs use it pe
the glmq it badk without the paocess
maticimg sdepemed on h e mqtsne o f
OeSoUDCe
ecovPHu- this Was isdifhcul ozimpOssible

Kecovenythaaugh Rollbatk
TEthehe susiem desigmensKno th t
deadlock qe ightly to hoppenthe
ohaVe- pao Ce Sse S che(k.
hqt-
check pomHinq a_pao Ce5s meqnas
hleSo
i Statei5 witten_ do a
that it CGm be e stqatedL letten
efteN-
tis
when_a deadlock_ 15 detected neealeekL
a s u f o See_wich_aeSduNCe aae-

because he chec point (on


State
maqe esouCe -
10 de he 3eCovey paoceS5that_o
own
ameecle d_aesduace1s a0ledback_a
pojnt n ime befoae alquided
aesauates bs siaatinq GolieN_check_Poi7
poin
Recove fhaaugh kllimq paO CeSses
The Simplest_a4 do baeak acleaollock
is foKIL one morepaoceSS .

Ome ossibilits 15 lo_killed a Poocess


he CucleiE
ifthes.e_does mot have
have
cam be aepected untl he cydle
Cucle
js baaken

Deadlack Aveidanle
The Sustem mus_be_ablc_o decide
wheathez qaemtmq a aeSouIce
At als make theallocatom_When_
it issafe.

Safe p nsafe stale i

we Cam avaid deadlock_amu f


artaim into
ovqilable im Qdvqm Ced
a stade is said ta be 5afe
if thene-
isSmMt Sledulimq 0dd es in
every hich
Pole ss Cam u n to
all of complete_e
hemSuddenlu aeqt thrne
maximYm mumber_à-
es ouD Ce
immediately
|Page No.
Date

safe Has Ma Has may


Ha max
A3 A3 A
ple
B 2 O

C2+ c27 LC
Faee : 3 faee : Foee :5
Ca)_ Co Cc)
Hos max
Has maX
A3 A 3
co
Fnee O faeez
Cd Ce

the clbove example slba.S hat_paocess H_has


thaee inítam.ces of he aresoune but may
dequae fotqlof Nine
PaocessB has fuo m914 equune 4
&esouHLeS. has
latal
Hotal_af lo instamce5of the
2e5.0N ce exit ith Seve e SUn ces
hene aae haee SHl faee
These Gnexample_oE Safe_stafe -
OF
becquSe thene exits a Seguiemce
CeSS
alloc aHoms which allow5 all pao
do Compleje
(Page No.
Date

Has m aX Hos max


cafeHas maM Has m

A 3 A4 A 4 A 4
2 4 LC2+ C 2
C2 c2+|
foe e s3 free 2 2 faee face4
Ca)
Ca Cc)

Hrnein fiqae DAe cm See fha1 desoue


Gae vailahle wnenee 2Spaacess A_pàoces
Cbath aequinestotalS desoyy cSJesPectae
Thusthene is no qeaents OFEeach paace
o
to be
be mpleted in fhe syStemtheacfor_
the system is in cns.af e_State

The_diffesen/e bet asgfe stgt e umsqhe


stale iSthq Faa Safestate h e System
5ysttn
Com egenduthat all 20LesseS will finish,-
faom am umsqteSteie no Suchgeatntly-
lem be qivem

anten' salgoaithm £or simgle oesou2Ce

a sche.culing algoaithmthot Cqmquoid _eea


Lack
ack 1S Knclan QS bgmken's_algo9ith m-
it is am extcnsion_of deqdlock_detecho)
qlgoathm
T i5model_on he wayCL
Smq
Smql tf e a m
Bum c mighB de a
with_c qad up
custorn tr Owhom he is
iS 0inted-
3@nted
ammoumt_oE l0 am.
Date

the
algoaithmcheck
e geS+ fo see iE gd
@mtin the
loes ieaas-foamUmSGEe
he aequestis stoe_if it
denight.
TE 9aanhnq
aeaequestle ads to_
Safesate,it 15_ Cona-ieol Out
folloinq example shovs foua.
A B C O_each _Customer
has been a0npeel
Cetam_no af co Edit Umits qa0nfelL

A A A
BO
2 5
2 4 C24
D |4 7
faee10 faee 2 faee L
Ca Cb) Cc

Hene the bamken's_ hos 26eaved lo units


foa_himseE

q5 ShoLinin abave £q Ca) Cb he


Systemn iS m Safe Stote be caluse aften
dynamiC_alloc ahim_boe e deSoV DLes, eq(h
280cesS ill be Completed_ SuCCessf ully.

he qvailqble EdLe
as Shodn im_fq ) nat
15
reso Utes nlu_ane_which

am O
Capqble afCampletin4-
he 4 poess-
msafe S t a t e
these le qds to a
Page No

Dale

the bamken's_alqoaifhm_Comsides
Heae
each est accugaing checks_is
gaanhn tleads to a SateStafe

I f it_cloes hen fhe 2equleSt_I5g80nted_p


it is
aesouD/e aa qllocafed ofhtuhuiS.e itis
postpomd unil aten

Deadlock Paevenlion
Mon

TEwe Can_easye that atlist_one_og the 4


Comdihon Stuhsfs_hemdeadlo ck
will be mpossible

7FollaLainq ane 4Laus- n pa even} deadlock

L AHacking the mutuolerclusiom londihan


1 AHacking the hal o aait_Comdihiorn_
Tii AHacking the mo phe empHon_Lomd1Hin

Attackimq the00utua erclusion_c0mditon


20esauae isa
Sign_ exclusively
o a Singq aacess we wil meyenn
have a deadlock.
T iscleanthat foll gding O _paal SS
to Dnte om HHe paimteD t the
Same meuwlL ead to paoblems-
oid
he mainidea behim d hese is to vo
a61nginq eSOUNre_ahem that
abst neccesS aAY tay_0 ma Ke SuD h a
CLS c oocesSeS a_possb le Cam dlaim he
Fage No.
Date

Atta chinng- the hald 2 a t Camdihon


e a t pcess hqt hold
a o caa mq_ha aesaunce s
m0ne0 ESOUNce we Cam
eleminate deacdlocks

Omeuau _alheiwe h£ 5e goalis fo deqiae


ql pOCes5e5fo equest qll heinb
esoNe S_befone Stea Hne he fx er Uhm-

If eveaythim 9 15 Qvailable the pao cess wilI ebe


allocaed whateven tneedsOmdcam un
je Comple Hon

TE0me od mone_2esounes geDusy mathimg


w he qllo Cated. he paocess Walt

A majoa Phoblem_ ith hS_qppoaach is


_mms es.alnles
manu p30les5eS_dont_mo Ho
de quine umhl fhes have tanted
the
h e l l

LwGy to baeqk fo_walt h o l ol_


AA_dEF paoLes5 equestin9
Condihon 1s o equine
fempG dodu ae lleaSe-
esounte Hnst
Cogaectls_hold E
G h e aesoLn leS j t t méed_

qe evenythimg t neea
hem_tays to
al_at_ones
tacking the mopaeenmptiln CCmditiCm

This Jechnique s Possibilty i f n e paa.cessh


ha
beenassign_ a p2inier EiSin the midde
E painimg i s cutp fonCiblydakim
the paimle S taicklu

Not al De sauNles _an be viziugliged foa y


aec0ads im he daiabase o dablés nside_he
0s must be locked lo be uSed f i L l l
LoPate chanqe of deadlock

ttackimq the ciaculan wat_Londihon


The ciacslun a t COmdithcn Can be eleminiat
im dff

Oneuaay iSSimiluo hae yle that a


Pnatessis Canecded to aSimg4l aeSalnce
a t anmu mom emd iE tmeed s_q Selond.
0ne
0me i must elase thefiast 0me

mothen_ wau Lo avoid Ctacula wauj5 F.


Paaviee CL
Calbau numbeaimq ofall
h e desoLnles CS shoun i n 9
givem

Tonageseten
_5CemneT
Rul plotHer
lape pniven.
T1 - Rom
Page No.
Date

NeLO he
e ule 15PoocesS Cum Ofqs_est deSoUDce_
heneveD Loamt_to butql aequest must be
nAUMDICal ond eN_foa eXq, paocess_
made
Fiast a paintea_ hem Q aD
mayaequest
it may mdt_deques4 fias- a
daiveb
_ploten Pthem pimden

Y
degdlock afvent com be
be
Dif 9ppoaa lhes to
tofollouwina dable
50meaised f n t o

HppaOalh
Conehdn

Spoo eveythimoq
Mutua exclusiom

all esaNDLL3 inlhal4-


Reque3t
Hold Loat
Take eSornces quq
Nopzeem pian

CiaclaD oait-

You might also like