The Gateway to Computer Science Excellence
+1 vote
46 views
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
in Databases by Junior (593 points)
edited by | 46 views

1 Answer

+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.

by Boss (23.5k points)

No related questions found

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,321 answers
198,398 comments
105,150 users