Diagrid

The Evolution of AI Agents · Chapter 4 of 7 · Stage 4 — The Unix & Linux event loop · 1980s–2000s

The Linux Event Loop: Making the Loop About Waiting for Work

Mark Fussell

Mark Fussell

Co-Founder & CPO, Diagrid · September 3, 2026

The Unix & Linux event loop at a glance · 1980s–2000s

What owns the control flow
The kernel, via readiness notification
What it added
Efficient waiting - one process, many concurrent sources of work
What it could not do
Wait for anything longer than the process itself lived
Agent equivalent
An async agent awaiting many concurrent tool calls

An event loop is a cycle in which a process waits for the operating system to report which sources of work are ready, handles them, and goes back to waiting. Unix and Linux refined it with select, poll and epoll, making servers efficient at waiting on thousands of connections at once. Waiting is also what production AI agents spend most of their time doing.

Unix and Linux Made the Loop About Waiting for Work

The Unix and Linux world introduced another important variation: the server loop. A classic server spends much of its life waiting, like watching out a window waiting for a leaf to fall. It waits for a connection, reads a request, processes it, writes a response, and then goes back to waiting.

In its simplest form:

while (running) {
client = accept(server_socket);
request = read(client);
response = process(request);
write(client, response);
}

The model is almost comically simple:

A simple Unix server loop: accept a connection, read the request, process it, write the response, then return to waiting.
A simple Unix server loop: accept a connection, read the request, process it, write the response, then return to waiting.

But that pattern became the basis for an enormous amount of server software. As systems scaled, the loop became more sophisticated. As a flashback to the 80s Unix gave us select, then poll, and Linux gave us epoll, in the early 2000s, allowing one process to wait efficiently for activity across many file descriptors.

Conceptually:

The Linux epoll event loop: one process waits on many file descriptors and the kernel reports which are readable, writable, errored or hung up.
The Linux epoll event loop: one process waits on many file descriptors and the kernel reports which are readable, writable, errored or hung up.

That model sits underneath a huge amount of modern infrastructure. The key idea is that the process does not need to continuously ask every possible source of work whether something has happened. It can suspend, wait for the runtime to tell it what is ready, handle that work, and then return to waiting. In a sense, this is yet another step in the same historical direction: the runtime knows about external activity, and application logic wakes up when something meaningful has happened.

Side note. Much like Windows, Node.js later made the event loop a mainstream application-level concept, but the underlying model is much older and much deeper than Node.

Why this matters if you are building agents

Waiting is the dominant activity of a production agent. It waits on model inference, on tool calls, on rate limits, on approvals, on humans. The epoll insight - do not burn a thread to wait, let the runtime wake you when something is ready - is the correct instinct, and every serious agent runtime applies it.

But epoll waits inside a process. Long running workflows in agent-land routinely need to wait longer than any process should be asked to live. When the wait is two days and the container ships a new release on Tuesday, readiness notification is not enough on its own.

Frequently asked questions

About the author

Mark Fussell — Co-founder and Chief Product Officer of Diagrid and co-creator of Dapr. He was a Windows 3.0 developer in the early nineties — the message loop in Chapter 2 is his, not a history lesson — and has spent the three decades since on distributed systems, most recently making them durable for agents.

LinkedIn

Read next

Chapter 5 arrives at 2014, and the loop that stopped asking what happened and started asking what outcome it was trying to reach.

Chapter 5: The Kubernetes control loop

All seven chapters are live.

Read The Evolution of AI Agents end to end, or get the next special project when it ships.