Skip to content

Instantly share code, notes, and snippets.

View hdonnay's full-sized avatar

Hank Donnay hdonnay

View GitHub Profile

Do You Like DAGs?

Understanding Communicating Sequential Processes, (Directed) Acyclic Graphs, and the select Operator

After much discussion with Roger Peppe (@rogpeppe) following my speech at gophercon, I thought it might be best to clarify my thoughts on and understanding of how to avoid deadlocks in go (using CSP, DAG's and select).

Damian Gryski (@dgryski) provided a link to a nice summary of the conditions necessary for a deadlock:

  1. mutual exclusion
  2. hold and wait or partial allocation
  3. no pre-emption
  4. resource waiting or circular wait