Low-Latency Systems Protocol Repository¶
-
:material-airplane:{ .lg .middle } Aerospace Protocols
ARINC 429, 664 (AFDX), 653 (APEX), 665, 615A bit-level codecs and deterministic Ethernet for avionics systems.
-
:material-ethernet:{ .lg .middle } High-Performance Networking
Raw sockets, epoll reactors, zero-copy I/O, and DPDK sub-microsecond packet processing on commodity hardware.
-
:material-chip:{ .lg .middle } Embedded Hardware
UART, SPI, I2C, CAN Bus, GPIO direct register access via Linux device files with DMA-aware buffering.
-
:material-factory:{ .lg .middle } Industrial Automation
Modbus RTU/TCP, EtherCAT, PROFINET field-bus and industrial Ethernet protocols for real-time control.
Quick Start¶
# Clone and build everything
git clone https://github.com/GauravAgarwalGarg/Protocols.git
cd Protocols
make all
# Run a specific module test
./build/arinc429_demo
./build/ring_buffer_demo
# Build with debug symbols
make debug
# Static analysis
make lint
Design Philosophy¶
| Principle | Implementation |
|---|---|
| First Principles | Direct syscalls, no wrappers (Boost, Qt, etc.) |
| Zero Allocation | Pre-allocated pools, no malloc in hot path |
| Lock-Free | Atomics with explicit memory_order_acquire/release |
| Cache-Conscious | 64-byte aligned structures, no false sharing |
| Deterministic | Bounded loops, no unbounded recursion |
| Production-Ready | -Wall -Wextra -Werror, static analysis clean |
Performance Highlights¶
| Module | Throughput | Latency (p99) |
|---|---|---|
| Ring Buffer (SPSC) | 18.4 M ops/sec | < 28 µs |
| SPSC Queue (zero-copy) | 27.7 M ops/sec | < 805 ns |
| Memory Pool (MPMC) | 9.7 M ops/sec | |
| epoll Reactor | 199 events/100ms | 1ms timer accuracy |
Requirements¶
- OS: Linux kernel 5.4+ (for io_uring, PACKET_MMAP, CAN FD)
- Compiler: GCC 11+ or Clang 14+ (C11 and C++20)
- Dependencies: None only libc, libpthread, and kernel headers
- Privileges: Root or
CAP_NET_RAWfor raw socket modules
Repository Structure¶
Protocols/
├── src/
│ ├── aerospace/ # ARINC 429, 664, 653, 665, 615A
│ ├── network/ # Raw sockets, epoll, zero-copy, DPDK
│ ├── embedded/ # UART, SPI, I2C, CAN, GPIO
│ ├── concurrency/ # Ring buffer, SPSC queue, memory pool
│ ├── transport/ # TCP, UDP multicast, QUIC
│ └── industrial/ # Modbus, EtherCAT, PROFINET
├── docs/ # This documentation (MkDocs)
├── tests/ # Integration test harnesses
├── build/ # Compiled binaries
├── Makefile # Root build orchestrator
└── mkdocs.yml # Documentation config