70 likes | 340 Views
wait-die wound-wait schemes use transaction timestamps for the sake of deadlock prevention Both in wait-die and in wound-wait schemes, a rolled back transaction is restarted with its original timestamp. Older transactions have precedence over newer ones, and starvation is hence avoided.
E N D
wait-die wound-wait schemes use transaction timestamps for the sake of deadlock prevention Both in wait-die and in wound-wait schemes, a rolled back transaction is restarted with its original timestamp. Older transactions have precedence over newer ones, and starvation is hence avoided. Deadlock Prevention Strategies R McFadyen ACS 4902
wait-die scheme older transaction waits for a younger transaction to release a data item. Younger transactions never wait for older ones; they are rolled back instead. a transaction may die several times before acquiring needed data item Deadlock Prevention Strategies R McFadyen ACS 4902
wound-wait scheme older transaction wounds (forces rollback) of younger transaction instead of waiting for it. Younger transactions may wait for older ones. may be fewer rollbacks than wait-die scheme. Deadlock Prevention Strategies R McFadyen ACS 4902
T1 Begin transaction Read_item(customer ‘A’) Write_item(customer ‘A’) Read_item(order ‘123’) Write_item(order ‘123’) Deadlock Prevention Strategies • What occurs in the following schedule for • wait-die? • wound-wait? T2 Begin transaction Read_item(customer ‘A’) R McFadyen ACS 4902
T1 Begin transaction Read_item(customer ‘A’) Write_item(customer ‘A’) Read_item(order ‘123’) Write_item(order ‘123’) Deadlock Prevention Strategies • What occurs in the following schedule for • wait-die? • wound-wait? T2 Begin transaction Read_item(customer ‘A’) R McFadyen ACS 4902