0
$\begingroup$

hi i read a paper and some section it's not clear for me please help me to understand it.. paper topic: A Deadlock Prevention Algorithm for The TwoPhase Locking Protocol Based on Petri Net

basic concept: if you know what is 2PL skip read this section

What is 2PL protocol? Answer: in database When Two Transaction run concurently and request Read or Write on Same Data 2Pl helps to do correctly with 2 types of Locking Shared Lock(called SLock) and Excluvily Lock (Called XLock)

conditions: in share lock transaction can only read Data no access to write or update

in exclusive lock transaction can read and write somthing on Data

1)every Transaction can only one time request shadred or exclusive lock on specific Data(example D)

2)if a data has share Lock another transaction can lock it as as share lock for read it concurently

if Data locked as XLock another transaction can not do share or exclusive until current transaction unlock it

How do It by example? suppose D data and Two Transaction T1 and T2

T1          T2
slock(D)    
Read(D)     slock(D)  // it can get lock bcs type is shadred Lock
            read(D)
            xlock(D) // it cannot ask Lock bcs T1 don't unlock yet. therofore must wait
            (1)wait

unlock(D)           
            //now can
            XLock(D)

above.show easy example of two-phase lock there is a problem : deadlock .see below example

T1              T2
slock(D)    
Read(D)         xlock(D2)
                read(D) // it can bcs its type is shadred Lock
                xlock(D) // it can not ask Lock bcs T1 don't unlock therofore must wait
                *wait..*
Slock(D2) //can not bcs T2 lock it as XLock     
*wait..*
unlock(D)           

You can see T2 wait for unlock D from T1 and T1 wait for unlock D2 form T2 both Transaction cannot complete and stays at wait forever(Daedlock) because paper content invole math formula i share images of it for you to see .. in image link i put some part of paper related my problem please see image perfectly then answer my Quesetion 2PL using Petri Nets

in picture: Q1:there is Z function i can not found what is it and output it? does for t11:Z(t11) =s1??

Q2:i read more and more 100 hundred times algorithms but i don't understand step 3 and step 4 what say please explain for me.

Q3:i draw rechability graph of model in pepaer for M and N transaction mention in paper

when i follow t11 t12 t13 t21 t22 t23 path output is diffrent by paper result why? in my mind : t11 is slockM t12 is Xlock M t13:Unlock of share lock in M t21 :Xlock N t22:Slock N T23 : UnlockX in N

then must be : Slock M Xlock M Unlock M Xlock N Slock N unlock X while paper says another order whyyy?

i draw reachabilty graph with software pipe. Please help me analysis algorithm (what is Sloca A ??? they are M , N i'm confuse)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.