Write an algorithm that checks whether the concurrently executing transactions are in deadlock.
What will be an ideal response?
Boolean function deadlock_detection
Input: A table called WaitForTable containing
transactionId; dataItemLocked; dataItemWaitingFor
Output: Boolean flag indicating whether system is deadlocked.
begin
deadlock = FALSE;
transactionStack = NULL;
for next transaction in WaitForTable while not deadlock
begin
push next transactionId into transactionStack;
for next dataItemWaitingFor of transaction on top of stack and
not deadlock and not transactionStack = NULL
begin
dNext = next dataItemWaitingFor;
find tranId of transaction which has locked dNext;
if tranId is in stack
then
deadlock = TRUE;
else
push transId to transactionStack;
end
pop transactionStack;
end
return deadlock;
end
You might also like to view...
Which of the following is used to filter incoming and outgoing traffic?
a. IDS b. IPS c. Firewall d. DMZ
Answer the following statements true (T) or false (F)
1) You cannot validate values assigned to properties using an object initializer. 2) Methods that overload binary operators must take two arguments. 3) Operators should be overloaded to perform actions similar to those that they normally perform on objects of simple types. 4) At least one argument of an operator overload method must be a reference to an object of the class in which the operator is overloaded.