Browse documentation

How programs talk to each other

Short messages for control, shared rings for bulk data.

Programs in DurgX are separate, so they need a way to exchange information. There are two ways, built on the same idea.

1. Quick messages

For short control messages: up to four values passed directly in CPU registers. No memory is touched. The caller sends a message and waits for the reply. Use this to ask a server to do something small.

2. Shared rings for bulk data

For streams such as disk requests, network packets and camera frames. Two programs share a block of memory organised as two queues: a submission queue (requests) and a completion queue (results). The sender adds an entry and the receiver picks it up. Large payloads are never copied through the ring. The entry only points to a page of memory that both sides can see.

  • Fast: no copying in the fast path.
  • Lock-free: several threads in one program can submit at the same time.
  • Wake-up only when needed: the sender asks the kernel to wake the receiver only when the queue goes from empty to non-empty. A busy driver can poll instead and skip the kernel entirely.

See Sending data with rings for the code.

Try it

Step the ring below and watch entries move from sender to receiver.

Zero-copy shared ring

Lock-free SQ between two address spaces. Entries carry a Frame capability — payload bytes never move.

PRODUCERdriver tasktail (atomic)0CONSUMERserver taskhead (atomic)00tail▸12345670/8SQ occupancyshared physical Framememcpy bytes: 0
producer
consumer
pushed
0
completed
0
RingNotify
0
RingFull
0
SqEntry { … }  // waiting for first push

CQ · latest completions

—