Concurrent State Machines with Cats Effect
summary
Shows how to build a coordinating component by composing Cats Effect primitives: Ref for atomic state updates (mutual exclusion) and Deferred for signaling (serialization). Implements a concrete countdown latch with waiters and notifiers, storing state in a Ref, completing a Deferred when count reaches zero, and launching parallel workers and periodic readers to demonstrate correctness. Claims this recipe generalizes to queues, semaphores and circuit breakers and the latch example runs and behaves as expected.
AI-written summary · about
chapters (33)
- 0:00Intro
- 1:10State Machines
- 2:12Concurrency
- 4:49Coordination
- 7:25Queue Circuit Breakers
- 8:15Agenda
- 9:57Synchronization
- 11:52Synchronization Flavors
- 13:18Mutual Exclusion
- 14:33Synchronized Keyword
- 15:31Vocabulary
- 16:25Demo
- 16:48Cats Effect
- 19:22Counter
- 19:57Worker
- 20:30View
- 23:01Love State Machine
- 23:20The Big Idea
- 24:59Concurrent State Machines
- 28:13Recipe
- 28:57Countdown Latch
- 30:10Code Example
- 31:40Coordination Interface
- 33:10State
- 36:44Decrement
- 37:52Countdown
- 38:20Review
- 41:21Conclusion
- 42:36QA
- 44:47Concurrent State Machines Recipe
- 47:30concurrency in other languages
- 50:49cancellation logic
- 52:39history of cats effect
