The algorithm
Maintain two orders:
Regular serial, depth-first, left-to right execution.
At each spawn, follow spawn thread before continuation
thread
Right-to-left execution.
At each spawn, follow continuation thread before spawn
thread
Claim: Two threads e1 and e2 are parallel if and
only if e1 precedes e2 in one order, and e2
precedes e1 in the other.