#deterministic #communication #networking #scheduler #precise-timing

bin+lib deterix

Deterministic network emulator with microsecond timing precision

6 releases

new 0.1.5 Nov 4, 2024
0.1.4 Nov 4, 2024
0.1.2 Oct 31, 2024

#401 in Network programming

Download history 408/week @ 2024-10-29

417 downloads per month

GPL-3.0 license

395KB
965 lines

Deterix: Deterministic Network Emulator with Microsecond Timing Precision

Deterix is a lightweight network emulator written in Rust for building distributed applications that require precise timing control. It provides time-slotted communication with <1µs jitter on COTS hardware running Linux with PREEMPT_RT patch.

Features

  • Time-slotted communication (TDMA)
  • Microsecond timing precision (<1µs jitter)
  • No GC interruptions
  • Zero-copy packet handling
  • Distributed architecture

Network Architecture

Overview

The network operates on a Time Division Multiple Access (TDMA) protocol with Node 0 serving as the network orchestrator. Key architectural features include:

  • Distributed time synchronization with <1µs precision
  • Deterministic slot-based communication
  • Dynamic network formation and management

Slot Structure

|<------------------------ SLOTFRAME (8 slots) ------------------------>|
+--------+--------+--------+--------+--------+--------+--------+--------+
| Slot 0 | Slot 1 | Slot 2 | Slot 3 | Slot 4 | Slot 5 | Slot 6 | Slot 7 |
| IDLE   | DEDIC  | DEDIC  | DEDIC  | SHARED | SHARED | SHARED | SHARED |
| -/-    | 1/2    | 2/3    | 3/1    | */0    | */0    | 0/*    | */0    |
+--------+--------+--------+--------+--------+--------+--------+--------+


|<----------------------------- Single Slot ----------------------------->|
+-------+-----------------------------------+---------------------+-------+
| CLEAR |               TX/RX               |         ACK         | GUARD |
|  10%  |                50%                |         30%         |  10%  |
+-------+-----------------------------------+---------------------+-------+

Example transmission-slot chart showing two nodes join and synchronize with orchestrator and send 10 data packets in their dedicate slots.

Time Synchronization

  • Node 0 (Orchestrator)

    • Provides network-wide time reference using system clock
    • Manages slot timing and synchronization
    • Broadcasts periodic sync messages
  • Other Nodes

    • Maintain synchronized local clocks
    • Update timing based on sync messages
    • Calculate slot boundaries locally

Network Operations

Network Formation

  1. Initialization Phase

    • Node 0 starts as orchestrator
    • Dedicated join slots are reserved in each slotframe
    • New nodes begin in unsynchronized state
  2. Join Process

    New Node                  Node 0 (Orchestrator)
       |                              |
       |------ Join Request --------->| (in shared slot)
       |                              | - Records node and add schedule
       |                              | - Prepares timing info
       |<----- Join Response ---------|
       |                              |
       |- Synchronize local clock     |
       |- Start normal operation      |
    

Communication Protocol

  1. Slot Assignment

    • Deterministic sender/receiver pairs per slot
    • Scheduled transmission windows
    • Guard bands prevent overlap
  2. Transmission Process

    • Reliable delivery with ACK mechanism
    • Automatic retransmission
    • Sequence number tracking

Implementation Details

  • Core Components

    • TX/RX Queue Management
    • Slot Ticker System
    • Zero-copy Packet Pool
    • RT Thread Scheduling
  • Performance Features

    • Thread affinity optimization
    • RT scheduler prioritization
    • Efficient buffer management
    • Microsecond-precision timing

LICENSE

GPL-3.0

Dependencies