"Inside core.async Channels" by Rich Hickey (2014)

Rich Hickey discusses the design of core.async channels, emphasizing the importance of separation of locks and flags, understanding the API, and the limitations of handlers.

Key takeaways
  • Rich Hickey emphasizes the importance of designing core.async channels with no global mutexes, instead relying on SLF (Separation of Locks and Flags) to avoid locking intersection problems.
  • He explains that handlers are wrappers around callbacks, managed by the channel, and cannot be directly accessed.
  • The alt operation is introduced as a way to park threads requesting a task, allowing the thread that requests it to complete first.
  • He highlights the importance of understanding the API and its limitations, such as the ability to complete pending operations when a channel is closed.
  • The speaker mentions that there are situations where a global mutex might be needed, but alternatives like sliding buffers and windowed buffers can be used to avoid locking.
  • Regular metrics are recommended to monitor the performance of the systems, such as buffer sizes, queue sizes, and the number of active threads.
  • Completion and rendezvous operations are fundamental to core.async, but making them atomic requires careful consideration of the implications on the system.
  • The speaker emphasizes the importance of protocols and their role in the channel’s API.