When You Know Access Pattern in Advance
Like following a family tree - you can only access children after accessing parents.
Tree Protocol Rules:
-
First lock can be on any item
-
To lock item Q, its parent must already be locked
-
Can unlock anytime
-
Once unlocked, cannot relock the same item
Example Tree:
A
/ \
B C
/ \ /|\
D E F G H
Valid Sequence:
- T10: Lock(B) → Lock(E) → Lock(D) → Unlock(B) → Unlock(E) → Lock(G) → Unlock(D)
Benefits:
-
✅ Deadlock-free
-
✅ Earlier unlocking possible
-
❌ May need to lock unnecessary items