A Reddit user under the nickname SIIMUCH, who is also an Embedded Developer and Software Engineer, presented their own open project — the Corundum HFT library. It is designed for ultra-fast inter-process communication (IPC) on Linux and demonstrates results that are hundreds of times superior to standard OS solutions.

Why a new tool was needed

The developer faced the task of optimizing the transmission of high-frequency telemetry — for example, for reliable and fast communication between a background monitor daemon and a graphical interface (GUI).

As the author notes in their Reddit post, traditional approaches such as sockets and regular channels are forced to constantly copy memory through the operating system kernel and perform a large number of system calls. In the high-load domain, this creates noticeable delays.

How Corundum HFT works

The library's architecture is completely free of these shortcomings thanks to a number of technical solutions.

The root of the system is based on the shm_open segment, which is shared by both processes. The writer forms the message (crd_reserve) directly in shared memory, and the reader (crd_read) uses it in place without any additional copying in either direction.

Using memory barriers (memory_order_acquire / release) completely eliminates heavy mutexes on the hot path. The parties synchronize via a single acquire load and a single release store.

The hot path consists of several inline functions in the header. The library never calls dynamic memory allocation (even during setup).

For optional blocking (crd_wait), the process sleeps on the futex only when the reader is actually sleeping, whereas crd_notify costs only one memory barrier.

Productivity and capabilities

Thanks to this architecture, the one-way latency is only 25–75 nanoseconds (for comparison: in conventional pipes this figure reaches ~22 microseconds, which makes the new development up to 800 times faster).

  • the buffer unit is designed for a "single writer — single reader" scheme;
  • records have variable length (up to half the buffer capacity), are aligned to 8 bytes, and never cross the end of the buffer (they lie as a single contiguous block);
  • allows preparing and publishing (or reading and dismissing) multiple posts at once;
  • the reader checks the header of each record, protecting the system from a faulty or malicious writer. The slot of a failed writer is freed automatically;
  • The core is written in pure C11, and for C++ a convenient wrapper is provided in C++17 with RAII support, in-place object construction (try_emplace), and typed zero-copy reading (msg.as()).
  • The kit also includes the corundum-inspect tools (for checking buffer occupancy and connected processes) and corundum-bench (for comparing performance with pipes and Unix sockets).

    The developer notes that the project is fully open, has test coverage (CI for x86-64 and arm64), and is accompanied by several documentation pieces (including a detailed rationale for the order of operations in docs/DESIGN.uk.md).