Cooperative Concurrency in Crystal with Fibers and Channels
Crystal schedules lightweight fibers cooperatively on a single OS thread. Learn how to pass messages between fibers with Channel(T) and avoid stalling the scheduler.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
Crystal schedules lightweight fibers cooperatively on a single OS thread. Learn how to pass messages between fibers with Channel(T) and avoid stalling the scheduler.
Learn how to identify and resolve ThreadPoolExecutor starvation where tasks remain pending despite low CPU usage, using thread dumps, metrics, and proper tuning strategies.
Architecture notes on Clojure's STM with refs: requirements, minimal design, trust boundaries, operational instrumentation, failure modes, and when to choose alternatives like atoms or core.async.
Processing thousands of URLs sequentially is slow, but spawning a task per URL can overwhelm your system. Task.async_stream offers bounded concurrency with streaming results and explicit error tuples.
Choose WAL for concurrent reads, rollback for simple single‑writer setups; see trade‑offs and how to enable safely.
Memcached's `gets` and `cas` commands provide optimistic concurrency control for read-modify-write operations. Learn how they prevent lost updates, where they fall short, and how to verify the behavior locally.
Use STM to build thread‑safe backends: atomic, composable transactions, avoid deadlocks, and monitor retry rates.
When you need to limit concurrent access to a shared resource, semaphores let you count permits instead of just locking. This guide shows how to use counting semaphores for rate‑limiting, highlights pitfalls like lost permits, and gives a concrete example in Java.
A decision guide for stopping Go HTTP servers without dropping in-flight requests or leaking goroutines. Compare Shutdown, Close, and signal.NotifyContext with a bounded drain pattern.