edited by
252 views
1 votes
1 votes
True and  false

Wound-Wait  algorithm always start with new time stamp after killing.

Wait-Die  algorithm always start with new time stamp after killing .

pls explain both algorithm
edited by

1 Answer

2 votes
2 votes

Let there be 3 transactions T1, T2 and T3. Let their respective timestamp be 1,2,3. This implies that T1 is an older transaction, T2 has come after it and T3 is the most recent one.

Wound and Wait :

1. Lower timestamp gets higher priority.

2. Highest priority transaction kills the lower priority transaction otherwise waits.

So here the order of priority is T1>T2>T3.

Suppose T2 holds a data item A.

Case 1: T1 wants to acquire A. T1 being a higher priority transaction(older one) will kill(wound) T2 to take over the possession on A.

Case 2: T3 wants to acquire A. T3 being a lower priority transaction will allow T2 to continue while T3 waits.

Wait and Die :

1. Lowest timestamp gets higher priority.

2. Highest priority transaction waits for an object if it is held by newer transaction.

Again consider the same scenario where T2 holds item A.

Case 1: T1 wants A. It does not kill the newer one and instead waits for T2 to finish.

Case 2: T3 wants A. But here it is not allowed to take A and sadly T3 dies ( :P ). T3 now restarts with new timestamp.

No related questions found