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 virus categories include any virus that uses one or more techniques to hide itself?
A) Boot sector viruses B) Ransomware C) Macro viruses D) Stealth viruses
Write a sed program named div that copies a file to standard output, copies the first five lines to a file named first, and copies the rest of the file to a file named last.
What will be an ideal response?
The ________ property defines the stacking order for elements
Fill in the blank(s) with correct word
A ____ is one that appears as a folder and is accessed through a path like any other folder.
A. mounted folder B. mounted drive C. dynamic folder D. linked folder