Menu

[Solved]-Q2 Deadlock Free Two Phase Locking Know Discussion Notes Two Phase Locking 2pl Protocol En Q37220838

Q2. Deadlock-free Two-Phase Locking. As we know from the discussion of (and notes on) the two-phase locking (2PL) protocol fo

Q2. Deadlock-free Two-Phase Locking. As we know from the discussion of (and notes on) the two-phase locking (2PL) protocol for ensuring that concurrent execution of transactions is serializable, 2PL is prone to deadlocks (1) Show that the transactions below may lead to deadlocks when 2PL is used. To do this you need to show a specific ordering of acquiring locks on variables x, y, and z that lead to a deadlock Transaction A ( read x; Transaction B ( read z; read y; write xi write yi else f write z; One approach to preventing deadlocks is to insist that requests for resources by a set of competing processes follows a specific monotonic order. For example, given a set of records R1, R2, Rn, if a process needs to request record Ri and Rj where i<j, then the process must request Ri and then Rj (and not the other way around, even if Rj is needed first). So, if there are (say) 3 resources (R1, R2, and R3) in the system, and a process needs to use all three resources, then it must request them in a monotonic order (R1, followed by R2, followed by R3) even if the process needs these resources in a different order. This means that sometimes, a process may have to request a resource well before it needs it. (2) Prove that if a set of processes follow the above approach in acquiring resources, they would neverget into a deadlock. Hint: You can easily prove the statement by contradiction The approach proposed above is to be used as a mechanism that ensures that deadlocks are not possible when two-phase-locking (2PL) is used for concurrency control amongst a set of transactions (3) Rewrite the transactions shown in part (1) in such a way that prevents deadlocks as discussed above (assuming 2PL is used for CC) (4) What are the advantages of using this deadlock prevention approach compared to using a deadlock avoidance approach such as the Banker’s algorithm? Hint: Think about the overhead involved in following each approach (5) What are the disadvantages of using this deadlock prevention approach? Hint: Think about how using this approach affects the levels of concurrency that are possible in the system Show transcribed image text Q2. Deadlock-free Two-Phase Locking. As we know from the discussion of (and notes on) the two-phase locking (2PL) protocol for ensuring that concurrent execution of transactions is serializable, 2PL is prone to deadlocks (1) Show that the transactions below may lead to deadlocks when 2PL is used. To do this you need to show a specific ordering of acquiring locks on variables x, y, and z that lead to a deadlock Transaction A ( read x; Transaction B ( read z; read y; write xi write yi else f write z; One approach to preventing deadlocks is to insist that requests for resources by a set of competing processes follows a specific monotonic order. For example, given a set of records R1, R2, Rn, if a process needs to request record Ri and Rj where i

Expert Answer


Answer to Q2. Deadlock-free Two-Phase Locking. As we know from the discussion of (and notes on) the two-phase locking (2PL) protoc… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *