$ show riyaneel/Tachyon
Tachyon is a high-performance, cross-language IPC library that provides a lock-free, single-producer single-consumer (SPSC) ring buffer over POSIX shared memory. It achieves sub-100 nanosecond round-trip times by using zero-copy payloads, futex-based blocking, and a handshake protocol that transfers anonymous memory file descriptors via Unix domain sockets. The library exposes a C API and ships idiomatic bindings for Python, Rust, Go, Java, Kotlin, C#, and Node.js/TypeScript, all sharing the same core C++ implementation. It supports both unidirectional publish-subscribe and bidirectional RPC patterns, with batch operations, NUMA binding, and configurable polling modes. The codebase is production-grade: it includes extensive fuzz testing, architecture decision records, seccomp BPF profiles, a monitoring CLI tool, and a mature release pipeline publishing to all major package registries. The design is notable for its minimal syscall footprint on the hot path (only futex), careful cache-line alignment, and a no-serialization contract that lets consumers read payloads directly from shared memory.
The LLM identified 3 files worth highlighting for reuse:
The core SPSC ring buffer implementation. It manages a fixed-capacity shared memory region with two atomics (head and tail) to coordinate a single producer and single consumer without CAS loops or slot-state bytes. Supports batch acquisition (acquire_rx_batch) and commit, skip markers for variable-length messages, and RPC metadata packing. The design is cache-line aligned (64-byte headers) and uses futex-based blocking with a configurable spin-then-wait strategy. This component is self-contained, well-documented, and could be extracted into any project needing ultra-low-latency inter-process messaging.
Abstraction over POSIX shared memory creation and attachment. On Linux it uses memfd_create with MAP_POPULATE and MADV_DONTFORK for anonymous, pre-faulted memory; on macOS it falls back to shm_open with immediate unlink. The class handles capacity calculation (power-of-two), alignment, and provides a raw pointer to the mapped region. It is a clean, reusable utility for any project that needs to allocate and share memory between processes without filesystem artifacts.
Implements the one-shot Unix domain socket handshake that transfers the shared memory file descriptor via SCM_RIGHTS. The server creates a listening UDS, the client connects, and after exchanging a versioned handshake struct (with flags for NUMA binding, polling mode, etc.), the server sends the memfd fd. The socket is then closed and all subsequent communication happens through shared memory. This pattern is reusable for any IPC system that needs to bootstrap shared memory access securely and efficiently.