High-performance C++17 header-only IPC (Inter-Process Communication) library built on POSIX shared memory and lock-free queues.
- Lock-free queues — SPSC, MPSC, and MPMC implementations for shared memory
- Zero-copy messaging — pass data between processes without serialization overhead
- Shared memory segments — lifecycle-managed POSIX shared memory with reference counting
- Synchronization primitives — futex, eventfd, spinlock, and configurable wait strategies
- Channel abstraction — compile-time dispatch over queue mode (SPSC / MPSC / MPMC)
- CUDA helpers — optional GPU-accelerated batch CRC32 and memory transfers (stubs)
- Compiler: C++17 (GCC 9+, Clang 10+)
- Build system: CMake 3.20+
- Platform: Linux (x86-64, aarch64)
- Kernel: Linux 4.0+ (for
futexsyscall andeventfd) - CUDA: optional, CUDA 11+ toolkit if enabling
IPC_HAS_CUDA
cmake -B build -S .
cmake --build build./build/hello_world./build/ipc_tests./build/bench_latency
./build/bench_throughput#include "ipc/queue/spsc_queue.hpp"
struct Message { uint64_t id; char data[56]; };
constexpr size_t CAP = 1024;
size_t mem_size = ipc::queue::SPSCQueue<Message>::RequiredMemory(CAP);
std::vector<char> mem(mem_size);
auto* queue = ipc::queue::SPSCQueue<Message>::Create(mem.data(), CAP);
// Producer
Message msg{42, "hello"};
queue->TryPush(msg);
// Consumer
Message received{};
if (queue->TryPop(received)) { /* use received */ }#include "ipc/ipc.hpp"
// Process A (owner)
auto ch = ipc::channel::Channel<MyMsg, ipc::QueueMode::SPSC>::Create("/my_channel");
auto producer = ch.GetProducer();
producer.Send(msg);
// Process B (client)
auto ch = ipc::channel::Channel<MyMsg, ipc::QueueMode::SPSC>::Connect("/my_channel");
auto consumer = ch.GetConsumer();
auto msg = consumer.Receive();// Single producer, single consumer
ipc::channel::Channel<T, ipc::QueueMode::SPSC>
// Multi producer, single consumer
ipc::channel::Channel<T, ipc::QueueMode::MPSC>
// Multi producer, multi consumer
ipc::channel::Channel<T, ipc::QueueMode::MPMC>include/ipc/
├── channel/ Channel, Producer, Consumer APIs
├── queue/ SPSC, MPSC, MPMC lock-free queues
├── shm/ Shared memory segment, lifecycle, allocator
├── sync/ Spinlock, futex, eventfd, wait strategies
├── util/ Backoff, cache-line alignment, perf counters
└── vcokg_adaptor/ Platform/atomic/concurrency abstraction layer
src/ Compiled sources (segment, futex)
tests/ Unit tests and benchmarks
examples/ Hello world demo
cuda/ Optional CUDA batch operations
- All queue
TryPush/TryPopoperations are lock-free and thread-safe within their documented discipline SPSCQueuerequires exactly one producer and one consumer threadMPSCQueuesupports multiple concurrent producers, single consumerMPMCQueuesupports multiple concurrent producers and consumers- Shared memory segments are safe for multi-process access via atomic reference counting
MIT