IS633 Discussion 11
Problem 1: Does the following schedule satisfy two-phase locking protocol?
|step||T1||T2||T1 Phase||T2 Phase|
|3||A := A – 50||Growing|
|12||B : = B + 50||Shrinking|
Two-phase locking protocol is pretty simple. It just takes the transaction and divides it into two parts; growing and shriking phases. The Growing phase is where the transaction can obtain but not release locks. The Shrinking phase is where may release but not obtain locks. The shrinking phase always follows the growing phase.
As you can see from the above table each transaction clearly has a growing phase followed by a shrinking phase. This means that our table satisfies two-phase locking protocol!
Does the following schedule have a deadlock?
Deadlocks occur when two processes are waiting for resources which the other process is currently holding that resource.
That is what is occuring here;
- T1 is holding resource A which T3 is waiting for
- T3 is holding resource C which T2 is waiting for
- T2 is holding resource B which T1 is waiting for