00:01
Hello students, here is a pseudocode algorithm that enables the people to rent and return the boats using the two -phase locking protocol while avoiding a deadlock.
00:13
So here in the algorithm follows the two -phase locking protocol where the resources are acquired in the first phase and released in the second phase.
00:25
So you can see here in the first step one there is a here is we performing the step one where the reservoirs two oras and the required number of the life jackets.
00:40
So to avoid the deadlocks resources are always acquired in a predefined order as the oras, life jackets and then boats by acquiring the resources in a fixed order.
00:57
So the deadlock situation such as the critical dependency are prevented.
01:02
So in this case the ordered ensures that the oras and the life jackets are always they are always acquired before reserving a boat.
01:14
So the algorithm ensures that the resources are released in the opposite order of an accretion which prevents the deadlock.
01:23
As you can see here first one the in the first step we perform the reserves.
01:30
So in the first step one reserve we perform the reserve for the two oras and the required number of the life jackets.
01:41
So in a step two you can see here the lock boat one this it also performs it reserves for two oras.
01:52
So this it is the step two it performs the reserve for reserve a boat it reserves a boat.
02:05
So in a step three it then write the boat in step three it writes the boat writes the boat boat.
02:18
Whereas in step four in the last step it performs the unlocks resources step four minus the unlock resources unlock resources fine...