Concurrent programs are notoriously hard to reason about. Two threads share memory, each step of one can interleave with any step of the other, and a bug may appear only in one exotic scheduling order out of millions.
In 1983 the computer scientist Cliff Jones published a strikingly simple fix. Instead of trying to enumerate every possible interleaving, he asked each thread to sign a two-clause contract:
- Rely — what the thread assumes the environment (all other threads) will do to shared state.
- Guarantee — what the thread promises it will do to shared state, no matter how the environment behaves within the rely condition.
If every thread's guarantee is at least as strong as every other thread's rely, the contracts are consistent and you can verify each thread in isolation — no global interleaving enumeration needed. The method is called Rely-Guarantee (R-G) reasoning, and it scales to real operating-system kernels and processor pipelines. See also program equivalence for a related angle on formal reasoning about programs.
Comments
Loading comments...