Concurrency & Deadlocks
6 min read.
Step through shared and exclusive locks, two-phase locking, what breaks when a lock is released early, and how a circular wait becomes a deadlock.
Think of it this way: Imagine two people needing a hammer and nails to work. Person A grabs the hammer. Person B grabs the nails. Person A waits for the nails, and Person B waits for the hammer. Neither can proceed. That is a deadlock.
Two transactions and one row, A. A lock says who may read or change it.
Check your understanding
Answer from memory before you scroll back up. Pulling an idea out of your head is what makes it stay there.
Growing or shrinking phase?
Sort each action into the phase of two-phase locking where it is allowed.
Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.
Growing phase
Drop items hereShrinking phase
Drop items hereQuiz
23 questionsIf Transaction A holds a Shared Lock on Row 1, what happens if Transaction B requests an Exclusive Lock on Row 1?
Done with this lesson?
Sign in free to keep your progress, streak and quiz scores.