The question
Can a general-purpose operating system be a microkernel whose servers never block, with every wait moved out to the client, and still keep a useful POSIX environment?
Syx is built around the migrating-thread call: in an invoke, the client's own thread enters the server and runs the handler there. No server thread is woken, nothing is queued in the kernel. It also moves a problem into the servers: a handler is not a thread of the server, it is a borrowed client.
Why handlers must not sleep
While it runs, a handler holds its client's thread and one of the server's sixteen invoke stacks. If it sleeps — for the disk, a timer, another server — it keeps both, and three things go wrong:
- Stacks run out. Every other client of that server waits for a stack or fails (ADR 0015).
- The client is stuck. It cannot be interrupted while it is inside the server: a signal waits for the return.
- Deadlock. A wait inside a handler that depends on another request to the same server never ends.
Syx removes the cause instead of handling each case: a handler answers at once, and anything that must wait is completed
later on an OPERATION object that the client waits on,
outside every server, at IPC level 0. Since ADR 0027 the kernel
refuses a sleeping wait in a handler with
KERR_INVOKE_WAIT_IN_HANDLER.
The rule pays off beyond the servers that follow it. Once no handler sleeps, the threads holding a server's stacks need only the CPU to finish, so a client that finds no free stack can simply wait for one, in FIFO order, with no risk of deadlock (ADR 0028). Before, it had to fail.
What it costs
The rule is not free, and the records say so:
- Two-step requests. A request that may need the device has a synchronous form that answers “would block” after starting the work, and an asynchronous form completed on an operation (ADR 0025).
- Server threads after all. A server that starts work needs threads of its own to finish it: a watcher loop and a few workers with a bounded queue. Past the bound a request is answered busy and the client retries.
-
The client does the waiting. The POSIX layer waits on
operations with deadlines and makes the wait interruptible by signals;
a blocking
readon a pipe is an invoke answeredIO_PENDING, then a wait on the operation. -
A long road. Pipes and
wait4, the terminal, then the filesystem were converted one at a time, with a kernel inventory of every wait made in a handler, before the rule could be enforced. The decision log tells it in ADRs 0015 to 0028.
Why a POSIX environment
A model of waiting is only tested by programs that wait in every way they can. Small test programs do not; real software does. So Syx emulates the Linux i386 syscall ABI for programs linked with musl, and runs GNU software on it, cross-compiled with small patches per package.
Building GNU make inside Syx is the hardest of these tests today.
configure alone runs hundreds of processes; the build
reads files through the filesystem servers and pages executables in
from them; and make -j4 drives its jobserver with
pselect with SIGCHLD in the mask: pipes,
signals and interruptible waits at once (ADR 0024). It runs as one
of the regular tests.
The recording → What runs, in full →
What Syx is not
- Not Linux. It emulates Linux for POSIX programs. Whatever exists only because Linux programs expect it lives in the emulation layer, never in the kernel or the native services.
- Not production-ready. One architecture (IA-32), one CPU, no networking, one user. Developed and tested under QEMU.
- Not a performance claim. Performance has been measured only to find bottlenecks, mostly under emulation. No comparison with other systems is made.
- Not verified. No formal verification and no real-time guarantees are claimed.
The full list is on the status page.
How it is developed
Changes to the kernel interface, to locking or to object lifetimes are written down first as architecture decision records, reviewed, then implemented in numbered steps. Records name the issue ids they close, and implementation commits name the record and step they carry out.
- 28 ADRs so far, from fsref semantics to the FIFO hand-off of invoke stacks. See the decision log.
- One issue list with stable ids by area (kernel, POSIX, filesystem, terminal, libraries, drivers, build). Fixes cite them.
- Four test platforms on one runner: native kernel and library tests (ntest), POSIX programs (ptest), bash scripts (btest) and the Linux Test Project programs (ltest), all run headless under QEMU on a throw-away disk image. The kernel log is checked for errors on every run.
- A documented kernel ABI: every kcall, its registers, error codes, blocking behaviour and execution-time class, including the behaviour that is known to be wrong.
- Measurement first. Performance work starts from the built-in profiler, not from guesses.