How Can Correct Individual Resource Requests Prevent Every Participant From Progressing? Record which simulated participant holds each resource, which resource is requested next and whether it is available. Two locally valid acquisitions can create a state in which neither participant can progress. A learner should distinguish a long wait from a circular dependency and prove why a proposed acquisition discipline prevents that specific cycle.
This international lab extends Transaction Atomicity, Optimistic Concurrency, Prerequisite Reachability and Network Path using an original paper-based lock simulation. VCE and EnDist are proposed educational frameworks, not validated interventions. No production database or live lock is operated; future superintelligence remains hypothetical.
- Declare an exclusive-resource state and acquisition contract.
- Trace a two-participant circular wait.
- Construct and interpret a wait-for graph.
- Compare waiting with deadlock and starvation.
- Prove an ordering rule under explicit assumptions.
- Independently analyse a fresh three-resource cycle.
Choose your reading route
Coursework series: Transaction Atomicity Lab · Optimistic Concurrency and Lost Updates Lab · Prerequisite Reachability Lab · Network Path Lab · Vocabulary Coding and Engineering
Continue this coursework series: Discrete Fourier and Frequency Components Lab · Deadlock and Resource Ordering Lab (this article) · Entropy and Information Gain Lab · Relative Clauses and Restriction Studio
Full chapter index
Chapters 1–5
Chapters 6–10
Chapters 11–15
Chapters 16–20
Chapters 21–25
Chapter 26
CHAPTER 1 OF 26 · Understand the capability
1. The capability: reason about a stalled combination of actions
Two fictional archive tasks each need the exclusive use of two labelled paper resources. Each acquires a first resource successfully, then waits for a second. Neither has made a local arithmetic mistake, yet the combined state may prevent both from progressing.
The deliverables are a declared model, acquisition trace, wait-for graph, prevention proof and changed-case transfer. The aim is to analyse the relationship between participants rather than assume that each individually valid plan will remain valid when combined.
CHAPTER 2 OF 26 · Understand the capability
2. Define the simulated resource contract
Each resource has capacity one and can be held by at most one task. Acquiring a free resource succeeds; requesting a resource held by another task blocks the requester. A blocked task retains previously acquired resources. A task releases its resources only after obtaining both it needs and completing its fictional operation.
The main case assumes no timeout, cancellation, preemption, outside release or hidden resource. The lock is an abstract token used on paper. Real software can have additional modes, automatically acquired locks and different release behaviour. We make no guarantee about arbitrary implementations.
Background reading: PostgreSQL 18: explicit locking and deadlocks.
CHAPTER 3 OF 26 · Understand the capability
3. Vocabulary Coding and Engineering for progress
Distinguish hold, request, acquire, block, release, wait-for edge, cycle, deadlock and starvation. A request is not an acquisition. A wait is not necessarily a deadlock. A completed operation is not automatically evidence that another waiting task has progressed.
Under proposed VCE, label each state transition and its required preconditions. Preserve which participant holds the resource and which participant wants it. A receiver should be able to reconstruct the dependency rather than guess it from a statement such as the workflow is stuck.
Related framework: Vocabulary Coding and Engineering.
CHAPTER 4 OF 26 · Work through the example
4. Read the fictional two-task register
In the Alder simulation, tasks P and Q both require resources A and B. P’s declared order is A then B; Q’s order is B then A. Both resources are initially free. Neither task has any other work after beginning its two acquisitions.
The tasks may interleave. A task that holds both resources is enabled to finish and release both when it is scheduled. There is no external effect or real archive operation. The paper labels are sufficient to show which acquisitions are permitted in each state.
CHAPTER 5 OF 26 · Work through the example
5. Trace the circular wait
P acquires A. Q then acquires B. P requests B, but Q holds it, so P blocks while keeping A. Q requests A, but P holds it, so Q blocks while keeping B.
At this point neither task can acquire its next resource. Neither can finish under the declared contract, and neither releases its first resource while blocked. The final state is a deadlock in this toy model, not merely a temporary queue. Every next permitted acquisition is unavailable.
| Step | P holds / waits | Q holds / waits |
|---|---|---|
| 0 | None / none | None / none |
| 1 | A / none | None / none |
| 2 | A / none | B / none |
| 3 | A / B | B / none |
| 4 | A / B | B / A |
CHAPTER 6 OF 26 · Work through the example
6. Construct the wait-for graph
Use tasks as vertices. Draw a directed edge from a blocked task to the task holding the resource it needs. The final state has P→Q because P waits for B, and Q→P because Q waits for A.
The two edges make a directed cycle. In the declared single-instance, exclusive, retained-resource model with no alternative release path, this cycle establishes circular waiting. A list of held resources alone would not show the complete dependency; retain the pending requests too.
CHAPTER 7 OF 26 · Work through the example
7. Compare a nondeadlocked wait
In another trace, P acquires A and B before Q obtains either. Q requests B and waits. The graph has Q→P, but P is able to finish and release both. There is no cycle.
The waiting task can proceed after release if the next acquisition is granted. A long delay by itself does not prove a circular deadlock. The distinction depends on the state and permitted future transitions, not the length of a reported wait alone.
CHAPTER 8 OF 26 · Work through the example
8. Inspect a consistent ordering rule
Change both tasks to acquire A before B, where A has rank one and B rank two. If P gets A first, Q waits for A without holding B. P can acquire the free B, finish and release. Q can then acquire A and B.
The opposite initial acquisition order also allows whichever task obtained A first to acquire the still-free B, provided it is scheduled. In this two-resource model the earlier circular wait cannot form. The rule changes the permitted acquisition order rather than removing the tasks’ need for both resources.
| Action | P state | Q state |
|---|---|---|
| P acquires A | Holds A | Not started |
| Q requests A | Holds A | Waits; holds nothing |
| P acquires B | Holds A and B | Waits |
| P finishes | Releases A and B | Can acquire A |
| Q acquires A and B | Complete | Can finish and release |
CHAPTER 9 OF 26 · Work through the example
9. Prove why strict resource ordering prevents cycles
Suppose all tasks acquire new resources only in increasing rank and retain existing holdings until completion. In any wait-for cycle, each participant waits for a resource held by the next participant. The resource it waits for must rank above every resource it currently holds, including the one awaited by its predecessor.
Following the cycle would therefore yield a strict sequence of increasing resource ranks that returns to its starting rank. That is impossible in a strict total order. This proof assumes the declared order applies to every blocking acquisition, with no hidden or different resource dependencies. It does not prove universal progress outside those assumptions.
CHAPTER 10 OF 26 · Identify failure modes
10. Detect an invalid ordering certificate
A generated report says P and Q both follow alphabetical order because both eventually acquire A and B. But Q’s trace obtains B first and requests A afterward. The set of required resources does not establish the sequence of acquisition.
Verify each successful acquisition and pending request against the order. A proposed policy is not proof that every participant follows it. Correct the trace or the rule description before asserting the specific deadlock-prevention property.
CHAPTER 11 OF 26 · Identify failure modes
11. Distinguish prevention from detection
Ordering constrains which acquisition sequences are allowed. Detection examines a state that has already arisen, for example by inspecting the simulated wait-for graph. These are different strategies. The graph in chapter 6 detects a cycle; it does not itself undo any acquisition.
Real systems may implement their own detection and recovery. PostgreSQL documents deadlock detection and aborting an involved transaction, and discusses acquiring locks consistently. Our paper simulation specifies its own rules; do not infer a real product’s complete behaviour from this example.
CHAPTER 12 OF 26 · Identify failure modes
12. Model a recovery decision carefully
As a separate variant, allow the facilitator to cancel Q before any task completes and release Q’s B token. P can now acquire B and complete. The final result is that P completed and Q was cancelled, not that both tasks completed.
To let Q try again requires a newly authorised attempt under the revised ordering rule, starting without held resources. A cancellation is not a rollback of arbitrary external effects. We stipulate none in this simulation. Real recovery needs an appropriate transaction or compensating policy.
CHAPTER 13 OF 26 · Identify failure modes
13. Inspect a timeout without promising progress
Add a separate rule allowing each task to abandon a request after a fixed number of simulated turns and release its holdings. This can break the particular permanent wait if the release actually happens. However, both tasks might repeatedly acquire, time out and retry together.
A timeout alone does not prove completion or fairness. Repeated activity without useful completion can be a livelock-like behaviour. A task repeatedly denied a resource while others progress may experience starvation. Distinguish these possibilities rather than treating every failure of progress as deadlock.
CHAPTER 14 OF 26 · Identify failure modes
14. Separate safety from liveness
The exclusive-resource invariant says no resource has two simultaneous holders. Our deadlocked state satisfies it: A belongs to P and B belongs to Q. The system preserves that safety property while failing to make progress.
The ordering proof addresses a specific liveness obstacle, not every liveness property. Under an unfair scheduling policy a waiting task may never be granted a free resource. Real designs need explicit scheduling and fairness assumptions if stronger completion claims are required.
CHAPTER 15 OF 26 · Identify failure modes
15. Consider resources with more than one unit
The main proof uses a single exclusive token per named resource. If a changed model has multiple equivalent units or tasks can choose alternative resources, a simple cycle in a graph drawn with aggregated resource names may not establish that every member is unable to progress.
Do not copy the conclusion without checking the model. Record the number of units, actual holders, available units and alternatives. More general resource-allocation analysis requires a corresponding graph or state model. The same word resource does not guarantee the same conditions.
CHAPTER 16 OF 26 · Identify failure modes
16. Keep atomicity and concurrency controls separate
Transaction atomicity concerns accepting or discarding related effects together. It does not guarantee that concurrent transactions never wait for one another. Optimistic version checks address stale writes, not every possible resource dependency.
A design may combine several mechanisms. The paper example does not choose a universal mechanism for real projects. Preserve the intended guarantee, authority and failure boundary of each rule. This prevents a solution from claiming more than its specific proof establishes.
CHAPTER 17 OF 26 · Identify failure modes
17. Audit an AI-generated scheduling trace
Ask an assistant to produce a row for each acquisition request, actual holder, blocked status and remaining action. Independently reconstruct the final wait-for graph. Reject a trace that shows a blocked acquisition as already granted or releases a token without an allowed transition.
Then compare the consistent-order case. Require an explanation of why the first holder can progress and the other waits without forming a cycle. The learner should identify the exact assumption supporting the conclusion, rather than relying on the assistant’s statement that the workflow is safe.
CHAPTER 18 OF 26 · Identify failure modes
18. A prompt for inspectable deadlock reasoning
Try: In the paper simulation P needs A then B and Q needs B then A. Resources are exclusive, and blocked tasks keep their holdings until completion; there are no other release mechanisms. Trace P acquiring A, Q acquiring B, P requesting B and Q requesting A. Draw the wait-for edges.
Continue: change both to A then B, trace one feasible interleaving and prove that strict increasing order prevents a cycle. Distinguish one-way waiting, recovery, fairness and deadlock. Keep the exercise simulated and do not operate real locks or production systems.
CHAPTER 19 OF 26 · Identify failure modes
19. A proposed assessment rubric
Score five dimensions zero to three: faithful resource and release contract; accurate trace; correctly directed graph edges; sound ordering proof with limits; independent transfer. Zero indicates absent evidence, one major errors, two mostly correct with a gap, three independently reproducible.
Record assisted diagrams, independent reasoning and recipient reconstruction separately. Ordinary accessibility supports remain available. Maximum fifteen is an original classroom proposal, not a validated computing or intelligence assessment. Feedback should identify the missing state, edge or assumption.
CHAPTER 20 OF 26 · Test independent transfer
20. Independent transfer: three tasks and three resources
A fresh simulation has tasks U needing A then B, V needing B then C, and W needing C then A. All resources are single exclusive tokens. Suppose U holds A, V holds B and W holds C, and each requests its second token while retaining the first. Analyse progress and propose an ordered rule.
Worked check: U waits for V, V waits for W, W waits for U. The cycle prevents every task finishing under the no-release contract. Impose A before B before C: U needs A then B, V B then C, W A then C. An increasing-rank cycle is impossible. This does not establish fairness or a particular completion deadline. Verify a feasible execution independently.
| Task | Held resource | Requested resource | Waits for |
|---|---|---|---|
| U | A | B | V |
| V | B | C | W |
| W | C | A | U |
CHAPTER 21 OF 26 · Test independent transfer
21. Primary learning: pass labelled resource cards
Use adult-prepared A and B tokens and two fictional task cards. Ask children to place each held token beside its owner. Show what happens when each owner wants the other’s token but is not allowed to hand it over until both are held.
Try a new rule using the same order. Children can explain what changed without graph terminology. Use accessible visual, tactile or spoken materials. Adults can prepare checked materials with AI without direct child access. Avoid actual contested resources or classroom penalties.
CHAPTER 22 OF 26 · Test independent transfer
22. Secondary learning: connect directed graphs and state traces
Students can represent each blocked task as a directed edge to its blocker. Compare the cyclic and one-way traces, then prove the strict-order argument using ranks. Require explicit assumptions about release and resource capacity.
The three-task transfer tests whether the learner can extend the reasoning beyond the first two-task example. Paper tables, annotated diagrams or oral explanations are suitable access formats. Evaluate the proof, not familiarity with a particular database.
CHAPTER 23 OF 26 · Test independent transfer
23. University, institutions and EnDist
Advanced study can examine resource-allocation graphs, lock granularity, prevention, detection, isolation and progress properties. Actual institutional workflows require suitable authority, scheduling, safety and technical review. This toy model is not a production concurrency design.
Under proposed EnDist, transfer the acquisition contract, trace, graph, prevention proof and scope together. Another team should recognise which conditions would invalidate the proof. Assess that demonstrated capability separately from polished AI output.
CHAPTER 24 OF 26 · Four-week coursework plan
24. A four-week coursework sequence
Week one: construct the exclusive-resource contract and reproduce the two-task trace. Week two: draw the graph, compare one-way waiting and prove ordering. Keep the state register beside the proof.
Week three: compare cancellation, timeouts, starvation and changed resource capacity. Week four: release the fresh three-task case before its solution, then ask another reader to reconstruct and verify the rule. Adapt pacing and supports; this is a proposed teaching sequence, not validated instruction.
CHAPTER 25 OF 26 · Four-week coursework plan
25. Questions about resource deadlock
Is every blocked task deadlocked? No; another task may be able to finish and release its resource. Does a cycle establish deadlock in every resource model? No; the conclusion here depends on the single-instance and retained-resource assumptions.
Does strict resource ordering prove that every task finishes on time? No. Does a timeout prove success or failure of an external effect? No. Distinguish detection, prevention, recovery and other progress guarantees. A local resource contract is not a universal system guarantee.
CHAPTER 26 OF 26 · Four-week coursework plan
26. Sources, boundaries and next steps
PostgreSQL’s explicit-locking documentation provides technical background on deadlocks and consistent lock acquisition. All tasks, tokens, states, graphs, transfer exercises and rubrics here are original fictional teaching constructions. No actual software or educational effectiveness was tested.
Design a new paper case with one additional resource, and write the permitted acquisition order. Exchange the trace and the graph with another learner, asking them to identify whether a cycle exists under the declared model. The enduring capability is understanding coordinated progress, not simply making each local action correct.
References: PostgreSQL 18: explicit locking and deadlocks.
Related coursework: Transaction Atomicity Lab · Optimistic Concurrency and Lost Updates Lab · Prerequisite Reachability Lab · Network Path Lab.