<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Ring-Buffer on Jasper</title><link>https://jasper-aa64.github.io/tags/ring-buffer/</link><description>Recent content in Ring-Buffer on Jasper</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Tue, 27 Oct 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://jasper-aa64.github.io/tags/ring-buffer/index.xml" rel="self" type="application/rss+xml"/><item><title>Trading System Notes #18: Thread-Safe Queues</title><link>https://jasper-aa64.github.io/posts/thread-safe-queue/</link><pubDate>Tue, 27 Oct 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/thread-safe-queue/</guid><description>From one mutex to many producers: condition variables and lost wakeups in a blocking queue, rte_ring&amp;rsquo;s two pairs of indices and in-order publishing, Disruptor&amp;rsquo;s availability flags, and whether a full queue should block, drop, or overwrite.</description></item><item><title>Trading System Notes #5: An SPMC Broadcast Ring in Shared Memory</title><link>https://jasper-aa64.github.io/posts/spmc-shared-memory-broadcast-ring/</link><pubDate>Sun, 04 Oct 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/spmc-shared-memory-broadcast-ring/</guid><description>Market data has one producer and several consumers, each of which must see every message, and the producer is the hot path that may not wait for anyone. The answer is a broadcast ring: every slot carries its own sequence stamp, readers keep private cursors, and the producer overwrites the oldest slot without ever reading reader state. The price moves to the readers — overruns are silent, a re-check after reading can&amp;rsquo;t catch a half-written slot unless the writer invalidates the stamp first, and readers that catch up take the line the producer writes next, so every flat-out write costs more. Moving the ring into shared memory adds three more rules: nothing inside it may be a pointer, the first lap pays a page fault every 32 messages, and a restarted reader loses everything unless it saved its cursor.</description></item><item><title>Trading System Notes #4: Lock-Free Queues and Micro-Batching</title><link>https://jasper-aa64.github.io/posts/lock-free-queue-logger-micro-batching/</link><pubDate>Sun, 20 Sep 2026 00:00:00 +0000</pubDate><guid>https://jasper-aa64.github.io/posts/lock-free-queue-logger-micro-batching/</guid><description>A lock-free SPSC queue works because every shared variable has exactly one writer: each side updates only its own counter and merely reads the other&amp;rsquo;s. The rest is keeping that property from being quietly undone — a shared element count both cores fight over (subtract two counters instead), a full-check that reads the other core on every call (cache the other side&amp;rsquo;s cursor, which can only be wrong in the safe direction), a mirrored mapping that removes the wrap-around seam, and a logger that pushes one character per slot (thirty slots for one log line, five as text runs). It ends with the vocabulary that keeps lock-free claims honest: SPSC is wait-free only through a fail-fast interface, finite steps are not finite time, and a bounded queue must always choose between dropping and blocking.</description></item></channel></rss>