Notes: Parallel Proofs for Parallel Programs
Languages and concurrent programs
Zac Kinkaid -- U. Toronto
Notes legibility estimate: LOW
Automatic analysis of algorithms
We'd like to know things like "What numeric types are used here? Are these array accesses in-bounds?"
Today: Proving the absence of faults in multi-threaded programs.
Multi-threaded programs are a great target for automated analysis, since they're so notoriously difficult for humans to reason about.
History:
- Floyd -- program invariants
- Ashcroft, Manna -- extended Floyd to multithreaded programs by treating a multiprogram as a nondeterministic single-threaded program -- difficulty: doesn't scale in #threads
- ??, Reese -- (for data-independent threads) Prove each thread correct individually; then check that the reasoning doesn't interfere across threads -- difficulty extending to data-dependent threads, which requires some cleverness, which is difficult to automate
in common: attempts to reason about multi-threaded code using (extensions of) sequential reasoning
The big problem
Given (program, property), does property(program) hold?
Problem!
Turing: Halting indeterminacy
Rice's Theorem: Every nontrivial property is undecideable
Solution
Allow either one-sided error or indeterminacy/divergence
Example
x = 2; y = 1 while(y != 0): y = randInt() mod x x = y + 2
Consider let the set of reachable states be points on the integral lattice; while we can't compute anything meaningful on all of them, we can reason about geometric supersets of them (here, the set \(y-x\leq1\))
Invariants from Constraints
Write a constraint system defined by program structure; prove by induction that the invariants continue to hold
Again, this extends badly
Data-flow graphs
Draw some sequential graphs side-by-side; add additional cross-thread dataflow links (aware of active synchronization). Think: When you're imposing synchronization on your programs, you're really pruning unwanted dataflow.
Multiple-threading: Need to add data-flow links within threads