LinuxCNC · master 2.10.0~pre1 · animated sheet

Command flow — from G-code to motor

The official architecture diagram, still published in the Code Notes, carries two annotations on the link between task and motion controller: “NML?” and “FIFOS?”. The authors were marking their own uncertainty. This sheet answers: it is neither — it is a single slot under a mutex, and the real queues are elsewhere. That image has been in the repository unchanged since 2012-11-19 (commit b60c20198e); its content is plainly older, but nothing in the repository dates it further back. Hover any block for detail.

source: read from the repository
HEAD caa13ca6 · 9 442 objects
audited: 3 August 2026

Which LinuxCNC is this?

Everything here describes master, which is unreleased — the newest tag in the repository is v2.9.10. One difference matters in practice: the commit that moved all I/O handling out of the iocontrol process and into milltask (764655eb4d, 2023-05-16) carries no tag and exists only on master. If you run 2.9.x, iocontrol is still a separate process on your machine. Everything else on this sheet — HAL, the emcmot segment, the queues, the servo cycle — holds for 2.9 as well.

Sheet 1

Command path & feedback loop

continuous trace · animated pulses
User space — processes, messages, no deadline Real-time boundary — emcmot shmem · key 100 Real time — motmod · servo-thread · hard deadline Hardware — HAL components and I/O cards HAL — 2 MiB shared memory · key 0x48414C32 · pins ▸ signals ▸ threads EtherCAT — a third path, absent from this repository: the lcec driver lives in linuxcnc-ethercat/linuxcnc-ethercat and plugs in right here, through HAL. LinuxCNC ships no EtherCAT code — only the initf hook that lets it activate cleanly. encoder feedback → process_inputs status & error return
real-time block user-space block queue / ring — dashed outline hardware amber pulse = command · cyan pulse = feedback
Selected block
— hover the sheet —
Every block carries its exact role and the source file that implements it. The pulses follow the real trace: a command descends, status climbs back.
Capacity
Detail A

The servo cycle

control.c:209-277
servo period 1 ms
    head++ on entry, tail = head on exit — the seqlock that lets user space read without ever blocking real time.
    Detail B

    The seven position representations

    after the official Code Notes
    Command — descending Measurement — climbing PID → HAL → motor → encoder physical loop, outside the controller inverse kinematics cubic interpolator · cubic.c + backlash, screw comp, home offset − offset, comp, backlash forward kinematics encoder read next setpoint — trajectory planner
    Items 1, 2 and 7 advance at the trajectory rate; 3 to 6 at every servo period. The cubic interpolator is what bridges the two.
    Detail C

    Actual buffer capacities

    linear scale · values read from the headers
    0512 KiB1 MiB1.5 MiB2 MiB

    The spread is the point: the trajectory queue and the HAL block each weigh a thousand times the NML channels. The dialogue between operator and machine fits in a few kilobytes; it is looking ahead of the motion that costs memory.