Which of the following best describes a deadlock situation in a database?
Think about transactions waiting for resources held by others.
A deadlock occurs when two or more transactions are waiting for each other to release locks, causing an indefinite wait.
Which technique is typically used by database systems to detect deadlocks?
Think about graphs representing waiting relationships.
Databases use wait-for graphs to detect cycles, which indicate deadlocks.
When a deadlock is detected in a database, what is the usual action taken by the system?
Consider how the system can resolve waiting cycles.
To resolve deadlocks, the system aborts one or more transactions to free locks and break the cycle.
Consider two transactions T1 and T2. T1 holds a lock on resource A and waits for resource B. T2 holds a lock on resource B and waits for resource A. What does this scenario represent?
Think about circular waiting conditions.
This is a classic deadlock where two transactions wait indefinitely for each otherβs locks.
Why is it generally more difficult for database systems to prevent deadlocks than to detect and resolve them?
Consider the trade-offs between safety and performance.
Deadlock prevention restricts how transactions acquire locks, limiting concurrency and reducing system throughput, making it harder to implement effectively.