What Operating Systems Teach Us About LLM Systems
A tutorial for systems students and machine-learning students alike. Paging, working sets, caching, time-sharing, system calls, protection and distributed computing all return in the design of LLM serving and agent systems, from PagedAttention and prefix caching to continuous batching, speculative decoding, disaggregated serving, MemGPT and MCP, and the places where the analogies break are where LLM systems go beyond them.

Cache answers to expensive computations, rather than doing them over.
When a large language model answers a question, a great deal of machinery runs underneath it that has little to do with machine learning and a great deal to do with operating systems. The model’s weights sit in a memory too small to hold everything we would like to keep there, requests from thousands of users compete for one processor, intermediate results are cached and evicted, work is spread across many machines that fail, and an agent built on the model calls out to tools through an interface that behaves very much like a system call. The engineers who built the systems that now serve LLMs knew this, and they said so in their own papers: the designers of vLLM, a widely used open-source serving engine, describe its memory manager by saying that “one can think of blocks as pages, tokens as bytes, and requests as processes,”1 and they cite the 1962 paper on the Manchester Atlas, the machine for which virtual memory was invented.2 The aim of this tutorial is to make that correspondence explicit and to use it as a way of understanding LLM systems, so that a student who knows operating systems can see what is familiar in a serving engine or an agent harness, and a student who knows machine learning can learn, through the systems that serve the models, the handful of ideas that operating systems have refined over sixty years.
The tour runs from the bottom of the machine to the top, and it begins with two short primers, one for each kind of reader, and with the single physical fact on which everything else depends, namely that fast memory is small and large memory is slow. It then follows memory management, caching, scheduling and distributed computing as they reappear in LLM serving, before turning to agents, where the model starts to play the processor, with its context window as memory and the program that hosts it as the kernel, and to protection and communication, where the analogy is most useful and also breaks most sharply. At each step we will be as interested in where the analogy fails as in where it holds, since the failures, which are few and precise, are exactly the places where LLM systems have had to invent something new, and the last section gathers them into a short account of what systems design offers anyone building an efficient LLM system.
How to read this tutorial
This is a long and technical tutorial, of about fourteen thousand words, thirteen equations and twenty-four figures, and it is not meant to be read in one go. It divides naturally into five sittings, set out in the table below, each of which ends at a point where the argument comes to rest, and an asterism (⁂) in the text marks the end of each of the first four. The first sitting is the foundation and should not be skipped, since the two ideas it builds, the KV cache and the roofline, are used by everything that follows. The later sittings lean on one another only lightly, so that a reader whose interest is agents can go from the first sitting straight to the fifth, and one whose interest is serving can stop after the fourth.
| Sitting | Sections | What it covers | Time |
|---|---|---|---|
| 1 | Two primers, Memory sets the rules | Attention and the KV cache, the memory ladder, and the roofline | 20 min |
| 2 | Moving fewer bytes | The size of the KV cache, grouped-query attention and FlashAttention | 10 min |
| 3 | Paging, Caching | How GPU memory is allocated, shared, reused and evicted | 15 min |
| 4 | Scheduling, Distributed computing | Batching, time-slicing and speculation, then many GPUs and their failures | 10 min |
| 5 | The agent as an operating system, Protection and communication, What systems design offers | Context windows, tool calls and interrupts, prompt injection, multi-agent systems, and the lessons | 25 min |
A few habits make the reading easier, and the first is to skip what is already familiar: a reader who knows operating systems can skip the first primer, which is written for the machine-learning reader, and a reader who knows transformers can skim the second, though not its closing paragraphs, where the KV cache is introduced. The figures carry much of the argument, and a first pass that looks only at the figures and their captions, and at the table that closes the tutorial, gives a fair outline of the whole. Terms that may be new are printed in bold where they first appear, most of them with a definition in the margin, or under the line when the term is tapped on a small screen, and the small numbers lead to the sources collected at the end.
Two primers
For the machine-learning reader, an operating system is easiest to understand as the program that shares scarce hardware among many running programs, called processes, while hiding the hardware’s limits from them. It virtualizes the processor, so that each program behaves as if it had a CPU of its own, by switching rapidly among them; it virtualizes memory, so that each program sees a large private address space, by keeping only the parts in active use in physical memory and moving the rest to disk; and it provides storage that outlives any program through a file system. It also protects programs from one another and the hardware from all of them, so that a program can do anything privileged, such as reading a file or sending a packet, only by asking the kernel through a system call. These are the definitions of a standard free textbook, on which this tutorial leans throughout.3 Every mechanism we will meet, from paging to scheduling to the system call, exists because some resource is scarce and must be shared, and nearly every policy, from which page to evict to which job to run next, is a guess about the future made with incomplete knowledge.
For the systems reader, an LLM is a function that reads a sequence of tokens, which are word fragments, and produces a probability distribution over the next token, and it generates text by sampling a token, appending it to the sequence and running the function again, a loop that is called autoregressive generation. The function is a stack of transformer layers, and inside the model every token is represented by a vector of numbers, so that a sequence of tokens enters each layer as a matrix with rows and columns. The expensive operation inside each layer is attention,4 which lets every token gather information from the tokens before it, and it is carried out by several attention heads working in parallel, each with three weight matrices , and of size , where is the dimension of the head. A head first projects every token into three vectors, a query, a key and a value,
three products of an matrix with a matrix, each of which gives an matrix with one row per token; in the model Llama 3 8B, where and , each of the three weight matrices is . The head then compares every query with every key and uses the resulting scores to average the values:
Here is an matrix whose entry in row and column scores how relevant token is to token , the causal mask puts wherever comes after so that no token can look ahead, the softmax turns each row of scores into weights that sum to one, and multiplying the matrix of weights by the matrix gives every token a weighted average of the values of the tokens up to and including itself. The outputs of the heads are then joined side by side into an matrix and multiplied by one more matrix, and the layer ends with a feed-forward network, a few still larger weight matrices applied to each token on its own, in which most of a model’s weights sit.
The dimensions tell us what generation costs, and why one data structure comes to dominate it. For a prompt of tokens, the multiplications by the weight matrices take on the order of operations in each layer, and the score matrices another . The reply, however, is produced one token at a time, and since row of every matrix above depends only on tokens to , the rows already computed for earlier tokens do not change when a new token is appended. A serving engine therefore keeps the rows of and , for every head in every layer, in what is called the KV cache. The stored keys and values of every token processed so far, in every layer, kept so that a new token need not recompute them.. A new token then needs only a row of its own: a query , which is a vector computed from the token’s own vector , the scores , a vector that reads every cached key, and a weighted average of the cached values. The cost is on the order of operations per layer, where recomputing every row would cost . This one data structure will be at the center of most of what follows, and it gives generation two phases with very different characters. In the prefill phase the engine processes the whole prompt at once, multiplying matrices by matrices to compute the keys and values of every prompt token in one large parallel pass, and in the decode phase it produces the reply one token per step, multiplying matrices by a single vector, and each step reads the entire KV cache built so far and adds one more row to it.
For a machine-learning reader the KV cache is simply memoization, which is exact rather than approximate, since under causal attention a token’s keys and values never depend on the tokens that come after it. For a systems reader it is per-process state that grows by one record with every generated token and whose final size nobody knows in advance, or, in the words of vLLM’s designers, state that “dynamically grows and shrinks over time as the model generates new tokens, and its lifetime and length are not known a priori.”1 Anyone who has written a memory allocator will already suspect what kind of trouble that description promises.
Memory sets the rules
Every idea in this tutorial descends from one physical fact, that fast memory is small and large memory is slow, so that a computer is really a ladder of memories, each rung larger and slower than the one above it. For a CPU the familiar orders of magnitude run from about half a nanosecond for a reference to the L1 cache and 100 nanoseconds for main memory to about 10 milliseconds for a disk seek, some twenty million times slower than the top.5 A GPU has the same ladder at a different scale. NVIDIA’s A100 has “40-80GB of high bandwidth memory (HBM) with bandwidth 1.5-2.0TB/s and 192KB of on-chip SRAM per each of 108 streaming multiprocessors with bandwidth estimated around 19TB/s,”6 and below both lies the host CPU’s memory, at 12.8 GB/s, which the GPU can reach only across the PCIe bus. The link between a GPU and the rest of the computer, far slower than the GPU’s own memory.. The fastest of these tiers, the GPU’s shared memory, is “a small on-chip, programmer-managed highly banked cache,”7 that is, a scratchpad that software must fill explicitly, which makes it much closer to the overlays of early computers than to the transparent caches of a CPU.
The two ladders line up by the part each tier plays rather than by its size. The GPU’s on-chip memory corresponds to a CPU’s caches, and its HBM. High-bandwidth memory: the GPU’s own main memory, where the weights and the KV cache must sit to be used. to main memory, the place where data must sit to be computed on. HBM is small, however, for at tens of gigabytes it is dwarfed by the terabyte or more of memory that a server’s CPUs can address, which is why the KV cache is a memory-management problem at all. The host’s RAM, across a bus from the GPU, then plays the part that the disk plays behind a CPU’s virtual memory, as the backing store to which evicted data is swapped.
The figure at the top of this post turns that ladder into a landscape. It is a memory mountain, the picture made famous by a classic textbook of computer systems,8 which plots how fast a program can read memory against two quantities: how much data the program keeps touching, which is its Working set. The data a program is actively using over a recent stretch of time., and how far apart the words it reads lie, which is its stride. The first axis thus measures temporal locality and the second spatial locality. We measured this one with a short benchmark written after the textbook’s method, on the laptop this post was written on, an Apple M4 Pro whose performance cores have a 128 KB L1 data cache and share a 16 MB L2, and the ridges appear where the textbook says they should. Reads run at up to about 95 GB/s while the working set fits in L1. At a stride of eight words they fall from about 70 GB/s inside L1 to about 18 GB/s once the working set spills into L2, hold there until it passes 32 MB, twice the L2’s nominal size, and then fall to about 14 GB/s from DRAM. The back wall of the mountain is the exception that teaches the most, since a strictly sequential read still runs at about 81 GB/s with a 256 MB working set, because the hardware recognizes the pattern and fetches the next lines before they are asked for, which is called prefetching.
Every ridge of the mountain has a counterpart on a GPU that serves an LLM, as the panel beside it shows, and the correspondence is close enough to be useful. The L1 ridge corresponds to the registers and on-chip memory where FlashAttention. A widely used implementation of attention that computes it in small tiles held in the GPU’s on-chip memory, so that far less data moves to and from HBM. Its result is exact. keeps its tiles, the L2 ridge to the L2 cache that the GPU’s streaming multiprocessors share, the DRAM slope to HBM, from which every decode step reads the weights and the KV cache in full, and the ground beyond the mountain to the CPU memory and storage where swapped-out and tiered KV caches go. The two axes carry over as well. The working-set axis is the batch and its contexts, which is why the number of requests a GPU can serve at once comes down to how much KV cache fits in fast memory. The stride axis is layout: decode can stream its weights at nearly full bandwidth because they lie in order, while a cache scattered across memory pays for every jump. vLLM’s paged Attention kernel. Here, the GPU routine that computes attention. It has nothing to do with an operating system’s kernel., which the section on paging describes, pays for its scattered layout, running 20 to 26% slower than the contiguous kernel of FasterTransformer because every read must first look up its block in a table, and its choice of 16-token blocks is the compromise, “large enough to efficiently utilize the GPU and small enough to avoid significant internal fragmentation.”1
The tool that tells us which rung of the ladder limits a computation is the Roofline model. A chart that bounds a program’s speed by two limits: the processor’s arithmetic rate, and its memory bandwidth times the work done per byte..9 Its central quantity is what its authors call operational intensity, the number of arithmetic operations a program performs for each byte it moves from main memory, and its central claim fits on a single line, “Attainable GFlops/sec = Min(Peak Floating Point Performance, Peak Memory Bandwidth x Operational Intensity)”:
A program whose intensity is low sits on the slanted part of the roof, where performance rises with bandwidth and the arithmetic units wait idle for data, and a program whose intensity is high sits on the flat part, where the processor itself is the limit; the two meet at the ridge point, whose intensity is the peak FLOP. One floating-point operation, such as an addition or a multiplication. FLOP/s measures arithmetic speed. rate divided by the peak bandwidth. Machine-learning writing usually says arithmetic intensity instead, a term the roofline authors avoided on purpose because it traditionally counts traffic between the processor and its caches rather than traffic to main memory, and in what follows intensity always means operations per byte read from the GPU’s HBM.
To place an LLM on the roofline we need only count, for each kind of work it does, the arithmetic performed and the bytes that must be read to perform it, and the multiplications by the weight matrices come first, since they take most of the time in both phases. Consider one weight matrix of size , stored at 16 bits, which is two bytes, per weight, and a batch of token vectors that must each be multiplied by it. Every token needs one multiplication and one addition for every weight, or floating-point operations, so that the batch needs of them, whereas the matrix occupies bytes and has to be read from HBM only once, however many tokens it serves, and the token vectors themselves are negligible beside it so long as is much smaller than . The intensity of the multiplication is therefore
which is simply the number of tokens that share one pass over the weights.10 The ridge point of the hardware then says how many tokens that has to be: Google’s TPU v5e accelerator performs FLOP/s and reads bytes per second from its memory, a ratio of 240 FLOPs per byte, and for an H100 the figure is about 280,10 so that on an H100 a multiplication by the weights is limited by arithmetic only when some 280 tokens or more pass through it together, and by memory bandwidth whenever there are fewer.
The two phases of generation fall on opposite sides of that line, and the count shows why. In prefill the tokens of the prompt pass through every weight matrix together, so that even for a single request, and any prompt of more than a few hundred tokens is compute-bound, or as a standard reference puts it, “During prefill, all matrix multiplications are basically always compute-bound.”10 In decode each request contributes only one token to each step, so that is the number of requests being served together, and a request served alone has an intensity of one FLOP per byte, about 280 times below the ridge, which means that the GPU spends the step reading its weights while more than 99% of its arithmetic capacity stands idle. The only way to raise the intensity is to batch requests, since every request added to the batch puts one more token through the same pass over the weights.
The same count explains a measurement that looks odd at first, that on an A100 “the cost of linear operation for 1 decode token is nearly same as 128 prefill tokens.”11 So long as a pass is memory-bound, the time it takes is the time needed to read the weights, whether it serves one token or a hundred, and it begins to grow with the number of tokens only once the ridge is reached. The A100 has 1/3.43 of the H100’s arithmetic but 1/1.64 of its memory bandwidth,12 which puts its ridge near tokens, so that a pass over one token and a pass over 128 tokens should indeed take about the same time.
Attention behaves differently from the weight matrices, because what it reads from memory is not shared among requests. In a decode step, a head compares the new token’s query with the cached keys and then averages the cached values, each of them a vector of numbers at two bytes apiece, which comes to about floating-point operations performed on bytes, an intensity of one. Serving requests together multiplies the operations by , but it multiplies the bytes by as well, since “every batch item has its own KV cache,”10 and the ratio stays where it was:
Batching therefore rescues the multiplications by the weights but not attention, which remains memory-bound at any batch size, and this is why long contexts, whose caches are large, stay expensive to serve even on a busy GPU. The table gathers the three cases, counted for one weight matrix and for one attention head.
| Work done in one pass | FLOPs | Bytes read from HBM | Intensity |
|---|---|---|---|
| Weights, prefill of an -token prompt | |||
| Weights, decode of requests | |||
| Attention, decode of requests with tokens of context |
This single picture explains why nearly every optimization in LLM serving does one of two things, either raising operational intensity, as batching and Speculative decoding. Letting a small model guess several tokens ahead, which the large model then checks in a single pass. do, or reducing the bytes that must be moved, as Quantization. Storing numbers with fewer bits, trading a little accuracy for less memory., cache compression and smarter attention kernels do. Butler Lampson’s revised hints for system designers give the first lever its cost model: if a batch has a fixed cost and each item a cost , then “the cost per item is f + s/b” for a batch of items, and “Batching increases bandwidth, at the cost of increased latency for the earlier elements in the batch.”13 Decode is the purest example of that trade the field has seen, since the fixed cost of loading the weights is enormous and the cost of each extra token in the batch is small.
Moving fewer bytes
Of the two levers, raising the intensity by batching will occupy the sitting on scheduling, and this one takes up the other, moving fewer bytes, which brings us back to the KV cache, whose size we can now calculate. Each token stores one key and one value vector in every layer, for every key-value head, so that
and for the model OPT-13B it comes to 800 KiB per token, or about 1.6 GiB for a single request of 2,048 tokens.1 The table works the formula for some well-known open models, using their published configurations,1415 a head dimension of 128 and two-byte elements.
| Model | Layers | KV heads | KV cache per token | 4,096-token request | 8,192-token request |
|---|---|---|---|---|---|
| Llama 2 7B | 32 | 32 | 512 KiB | 2 GiB | (4K context) |
| Llama 2 13B | 40 | 40 | 800 KiB | 3.1 GiB | (4K context) |
| Llama 3 8B | 32 | 8 | 128 KiB | 0.5 GiB | 1 GiB |
| Llama 3 70B | 80 | 8 | 320 KiB | 1.25 GiB | 2.5 GiB |
| Llama 3 70B with 64 KV heads | 80 | 64 | 2.5 MiB | 10 GiB | 20 GiB |
The last row is hypothetical, and it shows how much the architecture itself can do. In the attention of the primer every head had query, key and value matrices of its own, an arrangement known as multi-head attention, so that a model with heads caches keys and values for every token in every layer. Grouped-query attention16 keeps all query heads but gives them only key-value heads to share, each of which serves a group of query heads, so that head computes
where is the group to which head belongs, and the shapes are as before, an matrix of queries set against an matrix of keys. The query matrix remains in all, while and shrink to , which in Llama 3 8B, with its 32 query heads and 8 key-value heads, is . The earlier multi-query attention is the extreme case , in which one key-value head serves every query, “greatly reducing the size of these tensors and hence the memory bandwidth requirements of incremental decoding.”17
The change touches each of the quantities we have relied on, and each by the same factor , which is 4 for Llama 3 8B and 8 for Llama 3 70B. The cache holds only what the key-value heads produce, so that the count of key-value heads in the size formula falls from to and the cache shrinks by . The intensity of attention during decode rises by the same factor, because the query heads still perform about operations, while the keys and values they read now come to only bytes:
That is still far below a ridge of a few hundred, so attention remains memory-bound, but a memory-bound operation takes as long as its bytes take to read, and there are now times fewer of them to read in every decode step. The largest effect, though, is on the batch, since a cache times smaller lets times as many requests share the GPU’s memory, and the intensity of the multiplications by the weights, as we saw, is the number of requests that share a pass. The table works these effects out for Llama 3 8B on an 80 GB H100, whose memory delivers 3.35 TB/s,7 serving requests that each hold 8,192 tokens of context.
| Llama 3 8B on an H100 | Multi-head, 32 KV heads | Grouped, 8 KV heads |
|---|---|---|
| KV cache per token | 512 KiB | 128 KiB |
| KV cache of one 8,192-token request | 4 GiB | 1 GiB |
| Intensity of attention in decode | 1 FLOP per byte | 4 FLOPs per byte |
| Time to read that cache, in every decode step | 1.3 ms | 0.3 ms |
| Such requests that fit beside 16 GB of weights | about 15 | about 60 |
| Intensity of the weight multiplications at that batch | 15 | 60 |
Two things stand out in these numbers, and the first is how much the caches come to cost beside the model itself. Reading the weights, 16 GB of them, takes about 5 milliseconds in every step whatever the batch, so that with sixty long requests running the caches cost about 19 milliseconds a step, four times as much as the model, which is the regime one study describes when it says that at large batches and long sequences “the time to load the KV cache dominates.”18 The second is that even sixty requests leave the multiplications by the weights well short of the ridge at 280, so that it is memory, not arithmetic, that limits how many long requests can be served together. The price of grouping is small, since the paper that introduced grouping uptrains existing multi-head models “using 5% of original pre-training compute,”16 and a systems reader should file it as a change to the record format rather than to memory management, although its effect is the same, which is to fit more requests into the same memory.
Grouped-query attention shrinks what decode has to read, and FlashAttention, which we met on the memory mountain in the last section, attacks the other great source of memory traffic, the intermediate results that attention produces in prefill and in training. Written as in the primer, attention over tokens computes three things in turn for each head,
and the straightforward implementation carries them out as three separate steps: it writes the matrix of scores to HBM, reads it back to compute the matrix of weights , writes that out, and reads it back once more to compute the output . The inputs and the output are small, since , , and are each , but the two matrices in between are . For a prompt of 8,192 tokens at 16 bits per number, each of the four small matrices is 2 MiB and each of the two large ones is 128 MiB, for every head in every layer, so that the 32 heads of a single layer of Llama 3 8B would hold 4 GiB of scores between them for one request, a quarter of the size of the model’s weights.
FlashAttention rests on the observation that neither large matrix ever needs to exist in full, because the softmax of a row is a ratio of two sums, and a sum can be accumulated a piece at a time. If the keys and values are cut into blocks and , each small enough to fit in on-chip memory, then for a query the algorithm computes one block of scores, adds its contribution to two running totals, and discards it:
After the last block the output for that query is , which is exactly the weighted average that the full softmax would have given. In practice a running maximum is subtracted from the scores before the exponentials are taken, to keep the numbers in range, which does not change the result, and the causal mask simply leaves out the keys that come after the query. Only the running totals are kept, a single number and a vector of numbers for each query, so that the matrices never leave the chip. The paper argues that “a missing principle is making attention algorithms IO-aware,” and what it supplies is the loop tiling or Cache blocking. Reorganizing a computation into small tiles, so that each tile’s data stays in fast memory while it is in use. that every student of blocked matrix multiplication knows, with a lineage that it traces to the external-memory model of the late 1980s.6
Its effect can be stated in the same quantities that we have used throughout. The first is memory, for the extra memory that attention needs becomes “linear in sequence length”6 where it was quadratic, which removes the 4 GiB per layer of the example above. The second is traffic: standard attention needs on the order of accesses to HBM, while FlashAttention needs on the order of , where is the size of the on-chip memory, and the paper proves that no exact algorithm can do asymptotically better over all sizes of on-chip memory. The saving therefore grows with , and since “For typical values of d (64-128) and M (around 100KB), d² is many times smaller than M,” it is several-fold: the paper measures up to nine times fewer accesses on GPT-2, whose heads have 64 dimensions, and a head of 128 dimensions gains less.6 The third is intensity, which shows what those accesses had been costing. By the same counting as before, the scores and the weighted average take about operations, and the straightforward implementation moves each of the two matrices to HBM and back, about bytes in all, so that
for a head of 128 dimensions, whatever the length of the prompt. That is below the ridge of an A100, at about 134, and far below that of an H100, at about 280, which means that straightforward attention is memory-bound even in prefill, the one phase in which the multiplications by the weights are not. The measurements show where FlashAttention moves it: attention itself ran “up to 7.6x” faster on GPT-2,6 and later versions of the kernel, which reorganize the work further, reach “50-73% of the theoretical maximum FLOPs/s on A100”19 and “740 TFLOPs/s (75% utilization)” on an H100.7 The roofline turns the last figure into an intensity, since running at 75% of the H100’s peak requires at least FLOPs for every byte read from HBM, more than three times the 64 of the straightforward version, so that attention in prefill has moved from the slanted part of the roof to near the flat part.
The two techniques that close this section therefore divide the work between them. FlashAttention removes the quadratic matrices that prefill and training would otherwise write and read back, but it does nothing for decode, where the scores of a step form a single row of numbers and the traffic is the KV cache itself, which is exactly what grouped-query attention shrinks. What remains, once both are in place, is the question of where the cache lives and who may use it, which is a question of memory management and the subject of the next sitting.
Paging comes back for the KV cache
Virtual memory was invented to save programmers labor: the programmers of the Manchester Atlas had been planning “overlays” by hand, deciding which pieces of their program should occupy the small main memory at each moment, and “the Atlas system builders therefore decided to automate the overlaying process,” building a “one-level storage system” that “simulated a large main memory within a small real one.”20 The design dates from the late 1950s, and the paper describing it and the machine’s inauguration both date from 1962.2
The mechanism divides memory into fixed-size pages and keeps, for each process, a page table that maps the pages the program thinks it has onto whatever physical page frames happen to be free, so that a program’s memory need not be contiguous at all. The lookup is done in hardware by the memory-management unit, which keeps recent translations in a small cache called the translation lookaside buffer. Each entry also records whether its page is in memory at all, and a reference to a page that is not raises a page fault, a trap into the operating system, which reads the page in from disk, places it in any free frame, fills in the entry and restarts the instruction, so that a page is loaded only when it is first touched, a policy called demand paging. Fixed-size units eliminate what the textbooks call external fragmentation, in which free space “gets chopped into little pieces” so that a request can fail “even though the total amount of free space exceeds the size of the request,” at the modest price of internal fragmentation, the unused space at the end of the last page.3
Early LLM serving systems managed the KV cache the way computers managed memory before Atlas, reserving for each request “a contiguous chunk of memory with the request’s maximum length (e.g., 2048 tokens),” which wasted memory three ways at once, on slots reserved for tokens not yet generated, on slots that a short reply would never use, and on holes left between requests by the allocator. When the vLLM team measured the result, they found that “only 20.4% - 38.2% of the KV cache memory is used to store the actual token states.”1 Their fix, PagedAttention, is paging transplanted. The KV cache is divided into blocks of 16 tokens, a request’s blocks are allocated only as it grows and can sit anywhere in GPU memory, and a per-request block table maps logical blocks to physical ones, so that the waste is confined to the one partly filled block at the end of each request. The paper’s own figure puts the share of KV memory holding real token states at 96.3%, and its headline result is two to four times the throughput of the systems it compared against at the same latency. Like every speedup in this field, that figure depends on its baseline, which here was two earlier serving systems, NVIDIA’s FasterTransformer and vLLM’s own reimplementation of Orca.
The rest of the operating-systems toolkit came along with paging, so that when a user asks for several samples of a reply, the samples share the prompt’s blocks, which are reference-counted and duplicated only when a sample writes into a shared block. This is copy-on-write, which vLLM’s designers describe as “a copy-on-write mechanism at the block granularity … similar to the copy-on-write technique in OS virtual memory (e.g., when forking a process),”1 and requests that share a system prompt map it the way an operating system maps a shared library into many processes. Under memory pressure vLLM preempts the most recently arrived requests and later restores them, either by swapping their blocks out to CPU memory, which is the textbook technique, or by recomputing their KV cache from the tokens, which no operating system can do. The authors name this as the place where the analogy departs, describing “the recomputation method to recover the evicted blocks, which is not feasible in OS”: a lost page of a program’s memory is gone, but a lost block of KV cache is a memoized function of the prompt and can be rebuilt by running the prefill again, so that eviction becomes a choice between spending PCIe bandwidth and spending GPU arithmetic.
There is a second departure, and it has started an argument that operating-systems students will recognize. vLLM’s paging has no memory-management unit and no translation lookaside buffer, so the translation from logical to physical block happens in software inside a custom attention kernel. The designers of a rival memory manager, vAttention, object that “PagedAttention implements demand paging in user space whereas conventional demand paging is transparent to applications,”21 and they propose instead to reserve contiguous virtual memory for each request and to let CUDA’s own virtual-memory interface commit physical memory on demand, which puts translation back in the GPU’s own hardware, though pages are committed by explicit calls rather than on a fault, reporting up to 1.99 times the decode throughput of vLLM. It is the old question of where paging should live: managing pages in the application buys semantics that a general-purpose kernel cannot offer, such as block-level sharing and recomputation, while leaving them to the platform’s own virtual memory buys simplicity and portability.
Denning’s next contribution is just as relevant to LLM serving, for in 1968 he defined a process’s working set as “the collection of information referenced by the process during the process time interval (t − τ, t),”22 the pages a program actually needs over a recent window, and drew the practical conclusion that “Paging is no substitute for real core.” When too many working sets compete for memory, each process keeps evicting the pages the others need, the machine spends its time moving pages instead of computing, a condition called thrashing, and performance falls off a cliff rather than a slope, so that, in Denning’s words, “It is, therefore, highly desirable first to balance memory, then to balance processor.” The remedy is admission control, which Lampson’s hint “Shed load” states in nearly the same words: “A memory manager can limit the jobs being served so that all their working sets fit in the available memory.”23
LLM serving rediscovered this exactly, and vLLM’s designers describe their own contribution as “increasing memory utilization so that the working sets of more requests fit into memory.”1 A rough calculation shows why batch size in a serving engine is really a working-set question: an 80 GB GPU that holds the 16 GB of Llama 3 8B’s weights has about 64 GB left, which at 128 KiB per token is room for roughly half a million tokens of KV cache shared among all the requests running at once, before other overheads are counted. Admit more requests than that and the engine thrashes, preempting and recomputing instead of generating, and preemption in an LLM server is far more expensive than in a CPU scheduler, since a context switch on a modern processor takes under a microsecond3 while evicting one large request can mean moving more than a gigabyte of state.
Caching answers: prefixes, prompts and tiers
The hint “Cache answers to expensive computations, rather than doing them over,” with which this tutorial began, comes with a warning that matters here: the cache stores a function’s argument and its result, and “when f is not functional (can give different results with the same arguments), we need a way to invalidate or update a cache entry.”23 The KV cache of a prompt prefix sits safely on the right side of that line, because for fixed weights the keys and values are a deterministic function of the tokens, so that a cached prefix can be reused without changing what the model generates. This is why the providers who now sell Prefix caching. Reusing the KV cache of the opening part of a prompt, which an earlier request has already computed. can promise that it “has no effect on output token generation,”24 and also why a cache of whole answers keyed on similar-looking questions would be the non-functional case Lampson warned about. Prefixes are worth caching because they repeat: every request to a chatbot begins with the same system prompt, every turn of a conversation repeats all the earlier turns, and every call an agent makes repeats its instructions and its tool definitions.
Operating systems face the same problem in the page cache, which keeps recently used pages of files in memory, and in every such cache the hard question is what to evict when it fills, since a policy is judged by the misses it causes. The yardstick is Belady’s MIN policy of 1966, which evicts the block whose next use lies furthest in the future and is optimal, but requires knowing the future,25 so real systems use LRU, which evicts the block used least recently and bets that the recent past predicts the near future, which is the bet that locality makes. The figure below runs both on a loop over four blocks through a cache of three. MIN misses six times, four of them the cold misses on first use that no policy can avoid, while LRU misses on all ten references, because in a loop one block larger than the cache the least recently used block is always the one needed next. A block that a running program is still using must also be pinned so that it cannot be evicted, which operating systems do with reference counts, and LRU, MIN and pinning all reappear in what follows.
Two widely used open-source engines cache prefixes in two different ways, one with a tree and the other with hashes. SGLang keeps the KV cache of its requests, running and finished, in a radix tree whose edges are runs of tokens, so that requests sharing a prefix share a path in the tree. It manages the tree as an LRU cache that “evicts the least recently used leaf first,” which keeps shared ancestors alive the longest, while running requests pin their paths, since “A node is evictable if its reference counter is zero.”26 The paper also proves a pleasing result about locality, that scheduling waiting requests in the depth-first order of the tree achieves the best possible hit rate for a batch, provided the cache can hold the longest request, and that its practical scheduler “approaches 96% of the optimal hit rate on average” on benchmarks, and it reports hit rates of 52.4% and 74.1% for two models over a month of real traffic on the public Chatbot Arena site. vLLM instead hashes “each kv-cache block by the tokens in the block and the tokens in the prefix before the block,”27 so that a block’s hash identifies its entire history and identical prefixes find each other by content, which is content-addressed deduplication in the manner of a storage system.
Providers of LLM APIs now sell this mechanism directly, and its pricing makes the systems logic easy to see. As of late November 2026, Anthropic’s prompt caching lets a developer mark up to four breakpoints in a prompt, keeps a cached prefix for five minutes by default, refreshing the timer “for no additional cost each time the cached content is used,” and charges a premium of 1.25 times the normal input price to write a five-minute entry, or twice the price for a one-hour entry, against a tenth of the price, or less on the newest models, to read one.24 A little arithmetic shows that the five-minute cache pays for itself on the very second request, since writing once and reading once costs 1.35 units where sending the prompt twice costs two, while the one-hour cache needs three requests to come out ahead. In systems terms the time limit is a lease and the refresh on every hit makes the cache an LRU cache with a timeout, and hashing each prefix explains the one practical rule developers most need to know, which is that the stable part of a prompt must come first: change a single token near the start, such as a timestamp in the system prompt, and every later block misses. The same documentation notes that “Different organizations never share caches, even if they use identical prompts,” a rule whose security logic we will meet again when we come to protection.
Once a cache outgrows the GPU’s memory, serving systems rebuild the whole memory ladder below it. Mooncake, the platform that serves Moonshot AI’s Kimi assistant, pools the CPU memory, SSDs and network of an entire GPU cluster into a shared store for KV caches, an architecture that, in its authors’ words, “embodies the principle of trading more storage for less computation,” and its trace study finds the hit ratio of an LRU cache rising from 0.34 at 1,000 blocks to 0.55 at 50,000 and then flattening, a knee that marks the working set of the workload.28 The economics of such a tier follow from the fact that the KV cache is derived data, since a block is worth fetching from slower storage only if fetching it is cheaper than recomputing it, which turns the old question of where to keep a page into a comparison between bandwidth and arithmetic that no operating system ever had to make.
A second family of techniques shrinks the cache by throwing parts of it away, and here the theory of caching stops applying cleanly. Classical replacement theory, as the loop earlier in this section showed, measures every policy against Belady’s MIN, and LRU and its relatives are attempts to approximate MIN from the past. The H2O method applies the same thinking to the KV cache, keeping the “heavy hitter” tokens that receive the most attention together with the most recent ones, but it adds a footnote that every student of caching should read twice: “Belady’s Algorithm is optimal for standard cache, but not necessarily for KV cache.”29 The reason is that an evicted token usually has no copy anywhere, so that a miss changes the model’s output rather than merely delaying it, and the future pattern of references, the attention the model will pay, itself depends on what was kept. A second study, StreamingLLM, found that a pure sliding window of recent tokens collapses once the text outgrows it, and that keeping “just 4 initial tokens,” which the model uses as attention sinks, restores stable generation over millions of tokens, with the careful caveat that “We do not expand the attention window size of LLMs or enhance the model’s memory.”30 PagedAttention and prefix caching are lossless, like an operating system’s paging; eviction policies such as these, and quantizing the cache down to two bits as KIVI does,31 are lossy approximations, closer to memory compression with a cost in quality, and the right objective for them is quality under a memory budget rather than a hit rate.
Scheduling: time-sharing, one token at a time
Operating systems learned early that scheduling must balance two goals that pull against each other, the turnaround time of batch jobs, which favors running the shortest job first and batching work together, and the response time of interactive users, a goal that appeared once users “would sit at a terminal and demand interactive performance.”3 The classic failure is the convoy effect, in which “a number of relatively-short potential consumers of a resource get queued behind a heavyweight resource consumer,” and the classic fix is round-robin time-slicing, which preempts the heavy job at regular intervals so that short jobs can finish. With one long job and two short ones, as in the figure below, running them in order of arrival makes both short jobs wait behind the long one, while slicing time into single units lets them finish at times 5 and 6 instead of 10 and 12, at the price of a context switch at every slice.
Early LLM serving was a convoy in exactly this sense: systems batched requests together for efficiency and ran each batch to completion, so that, as the designers of the Orca serving system describe it, “requests that have finished earlier than other requests in a batch cannot return to the client, while newly arrived requests have to wait until the current batch completely finishes.”32 Since replies vary in length from a few tokens to thousands, most of the batch spent most of its time waiting for its longest member.
Orca’s fix, iteration-level scheduling, gave the server the equivalent of a timer interrupt. Its scheduler runs “only a single iteration of the model on the batch,” returns any request that has finished and admits new ones before the next iteration, so that a newly arrived request waits for only one decode step rather than for a whole batch, and every forward pass becomes a quantum boundary at which the schedule can change. Its companion idea, selective batching, batches every operation across requests except attention, whose shapes differ from request to request. Against FasterTransformer on GPT-3 175B, Orca reported 36.9 times the throughput at the same latency, and the technique, now usually called continuous batching, has become the standard way to serve LLMs. Because a reply is a stream rather than a single answer, the field also adopted two latency measures instead of one, the time to first token (TTFT), which reflects queueing and prefill, and the time per output token (TPOT), which reflects decode, together with Goodput and SLO. The request rate a system sustains while still meeting its latency target, known as its service-level objective (SLO)., defined as “the maximum request rate that can be served adhering to the SLO attainment goal (say, 90%).”33
Continuous batching that always lets new prefills in creates a convoy of its own, because a long prompt’s prefill can occupy an entire iteration, and every request already decoding stops producing tokens until it is done, producing what the designers of the Sarathi-Serve scheduler show as “one of the many generation stalls lasting over several seconds in vLLM.”11 They state the dilemma exactly: “Prioritizing prefills optimizes throughput but sacrifices TBT (time-between-tokens) tail latency whereas prioritizing decodes has the opposite effect.” Their solution is the operating-system solution, to cut the long job into slices. Sarathi-Serve gives each iteration a fixed budget of tokens, always includes the requests that are decoding, and fills the rest of the budget with a chunk of a waiting prompt, so that a long prefill is spread over several iterations and the decodes ride along with each chunk. The token budget plays the role of the time quantum, with the same trade: a small budget keeps the gaps between tokens short but makes prefill less efficient. Lampson’s revised hints describe the technique in general terms as fragmenting, which “reduces head-of-line blocking: small jobs stuck behind big ones,”13 and Sarathi-Serve reports 2.6 times the serving capacity of vLLM on Mistral-7B under Tail latency. The latency of the slowest few requests, such as the worst 1%, rather than the average. constraints, and up to 5.6 times on the far larger Falcon-180B, served across several GPUs. Mixing compute-bound prefill chunks with memory-bound decodes is also, in effect, what an operating system does when it mixes CPU-bound and I/O-bound processes to keep every resource busy.
The deeper scheduling question in operating systems is how to schedule well without knowing how long each job will take, which the textbook poses in capitals as “HOW TO SCHEDULE WITHOUT PERFECT KNOWLEDGE?”,3 and it is exactly the LLM server’s question, since nobody knows how long a reply will be until it ends. The classic answer is the multi-level feedback queue, introduced for MIT’s Compatible Time-Sharing System in 1962,34 which in its textbook form starts every job at high priority and demotes the jobs that keep using the processor, as the lower panel of the scheduling figure earlier in this section shows, so that short jobs finish quickly without anyone having to predict which they are. LLM schedulers have borrowed it explicitly, one of them noting that “MLFQ is a classic approach to minimize latency in information-agnostic settings”35 and placing each new request according to the one thing the server does know, the length of its prompt, while other work approximates shortest-job-first by training a small model to rank requests by their likely reply length,36 and the VTC scheduler brings fairness among users from networking by adapting fair queueing to count tokens rather than packets.37
The last scheduling idea borrows from processor design rather than from operating systems, and it begins with the arithmetic units that decode leaves idle, which a server can spend on guesses. Speculative decoding does exactly that: a small, fast draft model proposes several tokens in a row, and the large target model checks all of them in a single parallel pass, keeping the guesses up to the first one it disagrees with and supplying its own token at that point, or one more of its own if it accepts them all. The authors who introduced the method made the analogy explicit: “Speculative execution … is an optimization technique, common in processors, where a task is performed in parallel to verifying if it’s actually needed … A well-known example of speculative execution is branch prediction … In this work, we generalize speculative execution to the stochastic setting.”38 If each guess is accepted with probability , independently of the others, and the draft proposes tokens, the expected number of tokens produced by one pass of the target model is
and they report two to three times faster generation on T5-XXL “with identical outputs.” Lampson had described the pattern in 1983 under the heading “Use hints”: a hint “may be wrong,” so “there must be a way to check its correctness before taking any unrecoverable action. It is checked against the ’truth’,” and a hint is useful only if it is “correct nearly all the time.”23 The analogy breaks in an instructive way, since a branch has one correct outcome while a sampled token has a probability distribution, so that the verification step must accept and reject guesses in a way that leaves the target model’s distribution exactly unchanged, and that rejection rule is the genuinely new idea. Because speculation spends idle arithmetic, its gains should shrink as batching fills the arithmetic units with other work, which is an inference from the roofline rather than a measured result.
Distributed computing: from one GPU to a datacenter
Chunked prefill shares each GPU between the two phases by slicing time; the alternative is to separate them in space. DistServe, a serving system built on that alternative, argues that putting prefill and decode on the same GPUs “not only leads to strong prefill-decoding interferences but also couples the resource allocation and parallelism plans for both phases,” and it serves the two phases on separate pools of GPUs, each sized and parallelized for its own phase, reporting up to 7.4 times as many requests served within latency targets, or targets 12.6 times tighter. The obvious worry is the cost of moving each request’s KV cache from the prefill pool to the decode pool, and it turns out to be small: “even for OPT-175B, the KV Cache transmission only accounts for less than 0.1% of the total latency.”33 A similar system, Splitwise, adds an argument from hardware, observing that the H100 offers 3.43 times the A100’s arithmetic but only 1.64 times its memory bandwidth, so that bandwidth-bound decode can run on older, cheaper machines, and its cluster designs reach “1.4x higher throughput at 20% lower cost.”12 For a systems reader the handoff of the KV cache is process migration with state transfer, and sending it layer by layer while the next layer is still computing is the familiar trick of overlapping communication with computation.
Training or serving a large model also means spreading its work over many GPUs, and each of the six common ways of doing so corresponds to a familiar pattern of parallel computing. Data parallelism copies the whole model onto every GPU, gives each a different slice of the batch and averages the resulting gradients with an all-reduce. Tensor parallelism stripes each weight matrix across GPUs, with the Megatron-LM design arranging the stripes so that each transformer block “requires only a single all-reduce operation in the forward pass,”39 though communicating inside every layer confines it to the fast links within a server. Pipeline parallelism gives each GPU a group of layers and passes their output down the line like an assembly line, at the cost of a “bubble” of idle time while the pipeline fills and drains, a share of roughly when the batch is cut into micro-batches for stages, which GPipe found in its experiments to be “negligible when M ≥ 4 × K,”40 partly because the recomputation it performs in the backward pass can be scheduled into the gap.
The other three ways divide something other than the batch, the matrices or the layers. ZeRO shards the training state, that is the weights, their gradients and the optimizer’s bookkeeping, across GPUs and gathers each piece only when it is needed, which is distributed shared memory with fetch on demand;41 expert parallelism places the specialized sub-networks of a mixture-of-experts model, of which each token uses only a few, on different GPUs, and routes each token to its experts and back with an all-to-all exchange;42 and sequence parallelism, as in Ring Attention, splits a very long sequence across GPUs and passes blocks of keys and values around a ring while computing, which is prefetching over the network.43
Two old laws frame what any of this parallelism can achieve, and the first is usually stated as a formula that Gene Amdahl’s 1967 paper never wrote down, for the paper argued in words that “the effort expended on achieving high parallel processing rates is wasted unless it is accompanied by achievements in sequential processing rates of very nearly the same magnitude.”44 If a fraction of the work is sequential, the speedup on processors is
which can never exceed however many processors are added. John Gustafson replied in 1988 that in practice “the problem size scales with the number of processors,”45 so that people use more processors to do bigger jobs in the same time rather than the same job faster. Both laws apply with full force to agents, whose serial fraction is the chain of dependent model calls and tool round-trips, so that adding sub-agents or GPUs yields diminishing returns unless the Critical path. The longest chain of steps that must run one after another. It bounds how fast the whole job can finish. itself gets shorter, while Gustafson describes what practitioners in fact do with spare capacity, which is to sample more, reason longer and call more tools in the same wall-clock time.
At the scale of today’s training runs, failure is not an exception but a rate: the report on training Llama 3 notes that in synchronous training “a single GPU failure may require a restart of the entire job.”15 In a 54-day snapshot of training its largest model on 16,000 H100 GPUs, the same report recorded 466 interruptions, 419 of them unexpected and about 78% of those caused by hardware, or an unexpected interruption roughly every three hours. The remedy is the one Lampson’s hints list, “Log updates to record the truth about the state of an object” and “Make actions atomic or restartable,”23 which training systems implement as frequent checkpoints, written to the CPU’s memory in seconds and then to durable storage in the background,46 a write-back cache for the state of the job. Serving has its own fan-out arithmetic: if a server is slow one time in a hundred, a request that must wait for a hundred such servers will be slow 63% of the time, and a hedged request, sent to a second server after a short delay, cut the slowest tenth of a percent of latencies in one Google benchmark “from 1,800ms to 74ms while sending just 2% more requests.”47 The same arithmetic governs an agent that waits on many sub-agents.
The agent as an operating system
So far the model has been the workload and the serving system its operating system, but with agents the picture turns inside out, since the model becomes the thing that runs programs, and the people building agents noticed the resemblance at once. In November 2023 a widely shared sketch of an “LLM OS” came with a specification sheet that read “LLM: OpenAI GPT-4 Turbo 256 core (batch size) processor @ 20Hz (tok/s) - RAM: 128Ktok - Filesystem: Ada002,”48 and its accompanying diagram labelled the model as the CPU and the context window as RAM, with embeddings and files as the disk, and the browser and other models as the network. The context window is the agent’s working memory: everything the model can attend to at a given moment, its instructions, its tool definitions, its notes, the conversation and the results of its tool calls, must fit there, and everything else must live outside it and be brought in when needed. This is a second analogy, one level above the hardware of the earlier sections, and its tiers are defined by access rather than by speed: whatever is in the context window the model can use directly, while anything else must be fetched with a tool call, however fast the machine that holds it, which is why a vector store kept entirely in RAM still plays the part of the disk.
An agent system called MemGPT turned this picture into a mechanism, treating the context window as main memory, “analogous to main memory/physical memory/RAM,” and the stores outside it as disk, and managing the boundary much as a paging system would. When the prompt passes a warning threshold, such as 70% of the window, the system inserts a “memory pressure” warning so that the model can save what matters, and at the flush threshold it evicts messages amounting to about half the window into a running summary while keeping the originals in a searchable recall store. On a benchmark that required remembering details across long conversations, GPT-4’s accuracy rose from 32.1%, when it was given a lossy summary of the earlier conversations, to 92.5% with MemGPT.49 Yet the analogy breaks at the word that mattered most to the designers of Atlas, automatic, since in MemGPT “Memory edits and retrieval are entirely self-directed”: apart from the emergency flush, the model itself decides what to save and what to bring back by calling functions, which is closer to the hand-planned overlays that virtual memory abolished than to demand paging.
Context engineering. Deciding what goes into a model’s context window at each step., as the practice of managing a model’s context is now called, inherits the same hand-managed character. Current guidance sets the goal of finding “the smallest possible set of high-signal tokens,” a working-set definition in all but name, and recommends compaction, the summarizing of a long context into a short one, while warning that “overly aggressive compaction can result in the loss of subtle but critical context whose importance only becomes apparent later.”50 Compaction is lossy replacement with no backing store, and newer designs restore the virtual-memory principle of never discarding the original: one recent design for managed agents keeps every event in a durable session log, because “It is difficult to know which tokens the future turns will need,”51 and lets the harness read back slices of it on demand.
The deepest break in the memory analogy concerns uniformity, since every byte of a computer’s RAM is equally present but a model’s context is not: a well-known study found that performance was often “highest when relevant information occurs at the beginning or end of the input context,” and that GPT-3.5-Turbo, given the relevant document in the middle of its input, did worse than it did with no documents at all, when it scored 56.1% from memory alone.52 No operating system has memory that is resident yet partly ignored depending on where it sits, and that is why a larger context window is not the agent’s equivalent of more RAM.
The most literal version of the analogy, AIOS, builds an actual kernel for agents, with system calls, FIFO and round-robin schedulers, and a context manager that can snapshot and restore a model’s generation, and its headline result is instructive: the gain of up to 2.1 times in throughput that it reports came from scheduling, “which prevents unnecessary trial-and-error attempts by avoiding prompts that cannot be loaded onto the GPU,”53 that is, from Denning’s admission control rather than from smarter agents.
The tool call is the agent’s system call, and the mechanism it copies is worth seeing whole. In an operating system a program requests a privileged operation, such as reading a file, by placing the number of the call and its arguments where the system’s conventions require and executing “a special trap instruction” that “simultaneously jumps into the kernel and raises the privilege level.”3 The jump cannot land just anywhere, since the hardware sends it to a handler that the kernel registered at boot in a trap table. The kernel then checks the arguments, because it trusts nothing the program supplies, performs the operation, often through a device driver, and executes a return-from-trap instruction that lowers the privilege level and resumes the program with the result, so that the trap is the single guarded door between untrusted code and the machine.
An agent works the same way: the model stops generating with a structured request to call a tool, the host program, which plays the kernel, executes it, and the result is appended to the context, or, as one provider’s documentation puts it, “Claude responds with stop_reason: "tool_use" and one or more tool_use blocks. Your code runs the operation and sends back a tool_result.”54 The tool’s JSON schema is its Application binary interface (ABI). The exact low-level convention by which programs and the system pass calls and data to each other., the stop is the trap, and the result is the return value. The analogy breaks in three places worth remembering. The model is stateless between calls, so that its entire memory, the conversation, is sent again with every request, which is a large part of why prefix caching matters so much for agents. The boundary between the model and the host is not enforced by hardware, so the host must treat every argument as potentially hostile. And the system-call table itself lives in the scarce memory, since every tool definition occupies context: one provider found that letting the model discover tools as files of code on demand, instead of loading every definition up front and passing every intermediate result through the context, cut one worked example from 150,000 tokens to 2,000, a saving of 98.7%.55 Running independent tool calls in parallel, as current APIs allow, is the agent’s version of batched I/O.
If tool calls are system calls, then the Model Context Protocol (MCP). An open standard through which an agent’s host connects to outside tools and sources of data., introduced in November 2024 as “a new standard for connecting AI assistants to the systems where data lives,”56 is a driver interface. Hosts, clients and servers exchange structured messages, servers expose tools, resources and prompts, and the specification says that it “takes some inspiration from the Language Server Protocol,” while the project’s own site calls it “a USB-C port for AI applications.” The host plays the kernel, since it “Enforces security policies and consent requirements” and keeps each client connected to exactly one server.57
For the design of the tools themselves, the best guidance is older than any of this. The Unix philosophy, as the foreword to the 1978 Unix issue of the Bell System Technical Journal summarized it, advised: “(i) Make each program do one thing well … (ii) Expect the output of every program to become the input to another, as yet unknown, program. Don’t clutter output with extraneous information. Avoid stringently columnar or binary input formats. Don’t insist on interactive input.”58 Each of these maxims applies to tools built for an agent, and “Don’t insist on interactive input” is precisely the rule that keeps an unattended agent from blocking forever. Current guidance on building agents supplies the vocabulary that completes the mapping, distinguishing workflows, “systems where LLMs and tools are orchestrated through predefined code paths,” from agents, “systems where LLMs dynamically direct their own processes and tool usage,”59 a distinction that corresponds to the one between a batch job with a fixed control flow and a process whose control flow is decided as it runs. Lampson’s warning about layers applies to agent frameworks built on top of other frameworks: “If there are six levels of abstraction, and each costs 50% more than is ‘reasonable’, the service delivered at the top will miss by more than a factor of 10.”23
A system call carries control from a program into the kernel at a moment the program chooses, and an interrupt carries it there too, but at a moment the program does not choose. When a device such as a disk, a network card or the timer needs attention, it raises an interrupt, and the processor finishes the instruction it is executing, saves the state of the running program and jumps to the handler that the kernel registered for that interrupt, in the same table that holds the handlers for traps; the handler does its work and returns, and the program, when it next runs, continues without knowing that it was stopped.8 The timer interrupt is what lets an operating system take the processor back from a program that never makes a system call, and so it is what makes the preemptive schedules of the section on scheduling possible.3 Because other work waits while a handler runs, kernels keep handlers short, and Linux divides one into a top half that runs at once and does only what cannot wait, such as taking data off the device, and a bottom half that runs afterward, with interrupts enabled again, and does the rest.60
Processes receive a software counterpart of the interrupt, the signal, and it differs from the hardware kind in the way that matters most for agents, since a signal is acted on only in the receiving process’s own context. The kernel marks it as pending and delivers it when the process next passes from kernel mode back to user mode, as when a system call returns or the process is scheduled to run again, so that a signal waits for as long as its target is not running or has blocked it, and the process’s handler runs only on delivery. A process may catch SIGINT, which typing Ctrl-C sends, and decide for itself what to do about it, but it can neither catch nor ignore SIGKILL, which the kernel carries out whatever the process would prefer.8
Serving engines and agents both receive events of these kinds, and in neither does the model handle an event at the moment it arrives. Serving engines do not stop a forward pass midway, so a newly arrived request, a cancelled one or a KV cache that has run out of blocks is dealt with at the next iteration boundary, which iteration-level scheduling brought to within one decode step: the boundary that played the timer interrupt’s role in the section on scheduling is also where every other event is handled, and the engine polls at safe points rather than being interrupted. An agent’s events arrive as text in its context. MemGPT made the correspondence explicit, since in it “events trigger LLM inference,” and its events include “user messages,” “system messages (e.g. main context capacity warnings),” such as the memory-pressure warning described earlier, and “timed events that are run on a regular schedule,” while a model that yields instead of asking to run again does not run “until the next external event trigger (e.g. a user message or scheduled interrupt),”49 just as a process waiting for I/O sleeps until its device interrupts. A coding agent shows both kinds of event. In Claude Code the Escape key, like an interrupt, stops “the current response or tool call mid-turn so you can redirect,” keeping the work done so far, while a message typed while tool calls are running is held, as a pending signal is, until Claude Code “passes it to Claude as soon as those tool calls finish, within the same turn.”61
The division of work is the kernel’s, with the harness as the top half and the model as the bottom half: the harness acts at once, stopping a stream, killing a tool or declining to start the next one, and records what happened, while the model decides what the event means only on its next turn, when it reads that record. The analogy breaks over force. A program cannot decline the timer interrupt and a process cannot catch SIGKILL, but an event that reaches the model as text is a request, which the model weighs against everything else in its context and may misread or ignore. Whatever must happen regardless of what the model thinks, such as a deadline, a spending limit or a stop, therefore has to be enforced by the harness, and only what can safely be left to judgment should be sent to the model as a message, which is another instance of the lesson that the next section draws for protection.
Protection and communication
The classic principles of protection, set out in 1975, translate to agents almost word for word.62 The principle of least privilege holds that “Every program and every user of the system should operate using the least set of privileges necessary to complete the job,” and the principle of complete mediation that “Every access to every object must be checked for authority,” with a warning that “proposals to gain performance by remembering the result of an authority check be examined skeptically,” which applies directly to the “always allow” settings of today’s coding agents. The principle of least common mechanism, that every shared mechanism “represents a potential information path between users,” explains why vLLM can Salt. Extra data mixed into a hash, so that the same input gives different hashes for different users. its prefix-cache hashes to separate Tenant. One of several customers who share the same system. and why providers never share caches across organizations, since a cache hit observed by one user could reveal what another user’s prompt contained.
The attack that makes these principles urgent is Prompt injection. Text planted in content that an agent reads, which the model mistakes for instructions., and researchers showed in 2023 that “LLM-Integrated Applications blur the line between data and instructions” and that “processing retrieved prompts can act as arbitrary code execution.”63 An email, a web page or a document that the agent reads can contain text that the model follows as if it were an instruction from the user. Operating systems have met both halves of this attack before. The first is the confused-deputy problem, in which a program with authority is tricked into using it on behalf of someone who lacks it. It is named after a compiler on a commercial time-sharing system, which was allowed to write in its own system directory, where it kept statistics, and that directory also held the billing file, so that a user who named the billing file as the destination for the compiler’s debugging output had it overwrite the billing records, since the compiler could not tell whose authority it was using.64
The second half is code injection, in which a program reads bytes supplied by an attacker into memory as data, for instance by overflowing a buffer on the stack, and is then tricked into jumping to them as code. Operating systems answer the confused deputy with capabilities, which name an object and grant the right to use it in a single token, so that a user can pass along only the rights the user holds, and they answer code injection by marking data pages as Non-executable (NX) bit. A hardware flag marking a page of memory as data that must never be run as code., so that injected bytes stay data however they arrived, while hardware Privilege rings. Levels of trust enforced by the processor, which keep ordinary programs from doing what only the kernel may do., which separate the kernel from user programs, limit what any code that does run can reach.
Prompt injection is the place where the analogy breaks most sharply, because in an agent the component that decides which privileged actions to take, the model, is the same component that untrusted data can subvert. The model is a deputy that receives its orders and its data through one channel and so cannot tell whose authority a request carries, and natural language has no equivalent of a non-executable bit, since any sentence the model reads can act as an instruction.
The designs that hold up therefore move enforcement out of the model and into deterministic code, as an operating system never trusts user programs to police themselves. The “Dual LLM” pattern gives untrusted content only to a quarantined model that “does not have access to tools,” while a privileged model plans the actions and a controller, “which is regular software, not a language model,” passes the untrusted results along as opaque variables.65 A later design, CaMeL, whose name stands for “CApabilities for MachinE Learning,” extracts the program’s control flow from the trusted request alone, so that “untrusted data retrieved by the LLM can never impact the program flow,” and enforces capability policies on every tool call, at a measurable price in usefulness, solving 77% of the tasks in the AgentDojo benchmark with provable security against 84% for an undefended system.66 Production systems lean on the operating system itself, running the agent’s code in sandboxes built from the same confinement mechanisms that isolate ordinary processes,67 and keeping credentials where the sandboxed code cannot reach them at all.51
Multi-agent systems revive the oldest pattern of concurrent programming, and the operating-system version is worth recalling first. A process that wants help calls fork, which creates a child process with its own copy of the parent’s address space, so that neither sees the other’s later writes, and the parent later joins its children by waiting for each to exit, so that the slowest child sets the pace. Processes that must exchange data have two choices: passing messages through the kernel, as with a pipe, which copies the data but lets each side see only what it is sent, or mapping the same physical pages into both address spaces, which shares the data without copying but obliges the writers to coordinate.
When one agent spawns others, the same questions return, and one production multi-agent research system is a fork-and-join program: a lead agent plans the research and spawns sub-agents that search in parallel, each in its own context window, which acts as a separate address space, and each returns a condensed summary to the lead, which is message passing. Its builders report that the arrangement “outperformed single-agent Claude Opus 4 by 90.2% on our internal research eval,” at a steep price, since “multi-agent systems use about 15× more tokens than chats,” where a single agent uses about four times as many. The trade between message passing and shared memory reappears in its usual form, since relaying everything through the lead loses detail like a game of telephone, so its builders recommend having sub-agents “store their work in external systems, then pass lightweight references back to the coordinator,” which is passing by reference through shared storage. The join has a Straggler. The slowest of a group of parallel tasks, which holds up everything that waits for the group. problem, since “the entire system can be blocked while waiting for a single subagent to finish searching,” which is exactly where the tail-at-scale arithmetic and its hedged requests apply.68
The failures of multi-agent systems look less like the Deadlock. A standstill in which each task holds something another needs, so that none can go on. of the textbooks, with their circular waits over locked resources, than like Livelock. Tasks that stay busy reacting to one another, yet never make progress. and lost messages. A study of more than 1,600 traces from seven multi-agent frameworks classified failures such as step repetition, ignoring other agents and being unaware of stopping conditions, and concluded that they “often stem from system design issues, not just LLM limitations.”69 The remedies are the watchdogs of operating systems, maximum iteration counts, timeouts and budgets, together with a principle from networking. The end-to-end argument holds that a function “can completely and correctly be implemented only with the knowledge and help of the application standing at the end points,” so that checks lower down are useful only “as a performance enhancement.”70 For an agent, the end-to-end check is whether the tests actually pass or the booking is actually confirmed, and no amount of reliability in the model can replace it. Its authors also warn that “the application itself may accidentally originate duplicate requests, in its own failure/retry procedures,” which is the case for making every tool with side effects idempotent, so that a retried call cannot book the flight twice.
Durable execution. Recording each step of a long task, so that it can resume after a crash instead of starting again. completes the picture, by making an agent restartable in the way that a log makes a database restartable. The managed-agents design mentioned earlier, whose authors recall that “Decades ago, operating systems solved this problem by virtualizing hardware into abstractions—process, file,”51 splits an agent into an append-only session log, a harness and a sandbox, so that a crashed harness can be replaced and resume from the last event in the log, which is recovery by replaying a log, the idea behind Write-ahead log. A record written before each action is taken, from which the state can be rebuilt after a crash., brought to agents.
What systems design offers efficient LLM systems
The most transferable lesson of this tour is a method rather than any single mechanism, and every successful system we have met followed it. First find the scarce resource, and the roofline is the tool for that: it says that decode is starved for memory bandwidth rather than arithmetic, which is why batching, caching and compression pay off and why buying faster arithmetic alone does not. Then put a layer of indirection in front of the scarce resource, as the block table does for GPU memory, the radix tree for repeated prefixes and the session log for an agent’s context, since indirection is what lets a system share, move, evict and recompute without the program noticing. Finally, measure, on real traces where possible and against an offline optimum where one exists: vLLM’s designers began by measuring that earlier systems kept real data in only a fifth to two fifths of their KV memory, SGLang’s proved a scheduling order optimal and then measured their practical scheduler at about 96% of that optimum, and Mooncake’s traced real traffic to find where the hit-ratio curve flattens. Lampson’s hints, written for the operating systems of 1983, compress the same lessons into slogans that an LLM engineer can use unchanged: batch to raise throughput, cache answers that are expensive and exact, use hints that are checked against the truth, shed load when working sets no longer fit, and log updates so that any action can be restarted.
It would be easy to conclude from all this that operating systems now have little to offer LLM systems directly, since hardly any mechanism in this tutorial belongs to an operating system: vLLM translates blocks inside an attention kernel rather than in the GPU’s own page tables, prefix caches and KV tiers are run by the serving engine rather than by the kernel’s page cache, and an agent’s scheduler, memory and permissions are ordinary code in its harness, apart from its sandbox, which reuses the operating system’s own confinement. The better reading is that the principles largely carry over while the mechanisms are rebuilt one layer up, closer to the application, because only there is the knowledge that makes them work well, such as which blocks belong to a shared prefix, how long each prompt is, and that a lost block can be recomputed from its tokens. Databases made the same move more than four decades ago, when their builders found the operating system’s buffer cache, with its LRU replacement, ill suited to the way databases read their data and kept buffer pools of their own in user space,71 and the end-to-end argument of the previous section makes the kindred point that some functions can be implemented completely and correctly only with the application’s knowledge. The argument over where the KV cache’s page table should live, described in the section on paging, is the same question argued again, with the same trade between the application’s knowledge and the platform’s simplicity.
The places where the analogy breaks are not embarrassments for it; they are where LLM systems have gone beyond operating systems, and they mark the open problems. Because the KV cache is derived data, eviction is a choice between moving bytes and recomputing them, a trade-off that operating systems never faced and that now runs through preemption, offloading and disaggregation. Because a lossy cache has no backing store, Belady’s optimality no longer holds, and the right objective is the model’s output quality under a memory budget. Because the context window is memory whose reliability depends on position, more of it is not simply better, and managing it well is closer to choosing a working set for a reader than to allocating pages. And because the component that chooses privileged actions in an agent can be subverted by the data it reads, protection cannot live in the model and must live in deterministic code around it, which is the one lesson of operating systems that has no exception, that the component that data can subvert cannot be the one that enforces the rules.
| Operating-systems idea | In LLM serving | In LLM agents | Where the analogy breaks |
|---|---|---|---|
| Virtual memory and paging | PagedAttention’s blocks and block tables | Context window as RAM, MemGPT’s tiers | Translation in software; agent paging is self-directed, like overlays |
| Copy-on-write, shared libraries | Shared prompt blocks, forked samples | (none) | Little difference |
| Working sets and admission control | Batch size bounded by the KV cache | Smallest set of high-signal tokens | Context reliability depends on position |
| Caching and replacement | Prefix caches, tiered KV stores | Provider prompt caching | KV can be recomputed; lossy eviction leaves Belady behind |
| Time-sharing and scheduling | Continuous batching, chunked prefill, MLFQ, fair queueing | Schedulers over agent calls | Output length unknown; preemption moves gigabytes |
| Speculative execution | Speculative decoding | (none) | The branch is a probability distribution |
| System calls | (none) | Tool calls through the host | No hardware boundary; the caller resends all its state |
| Interrupts and signals | Events handled at iteration boundaries | Messages passed as text between model calls; Esc handled by the harness | An event that reaches the model is a request, not a forced switch |
| Protection | Per-tenant cache isolation | Sandboxes, capabilities, consent | The decision-maker can be subverted by data |
| IPC and fault tolerance | KV transfer, checkpoints | Sub-agent messages, session logs, idempotent tools | Failures look like livelock more than deadlock |
Serving systems have passed through batch processing, time-sharing, paging, caching and distribution in about four years, and the newest of them now look much like a mature operating system for a single kind of program. Agent systems stand roughly where the time-sharing systems of the 1960s stood: memory is still often managed by hand, protection is being added after an attack that exploits its absence, and durable logs are only now arriving. If the history of operating systems is any guide, and this is a prediction rather than a finding, agent memory will move toward transparent management by the harness over a log that is never discarded, and agent security toward privilege rings built in ordinary code, so that the most useful thing a student can bring to the design of LLM systems may well be a good course in operating systems.
All figures were drawn for this tutorial, and the memory mountain was measured for it on an Apple M4 Pro; the thrashing curve is illustrative, and the KV-cache table is computed from the models’ published configurations. Provider prices were checked in November 2026 and change often.
Bibliography
W. Kwon et al., “Efficient Memory Management for Large Language Model Serving with PagedAttention,” SOSP 2023. arXiv:2309.06180 ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎
T. Kilburn, D. B. G. Edwards, M. J. Lanigan and F. H. Sumner, “One-Level Storage System,” IRE Transactions on Electronic Computers EC-11(2), 1962. ↩︎ ↩︎
R. H. Arpaci-Dusseau and A. C. Arpaci-Dusseau, Operating Systems: Three Easy Pieces, Arpaci-Dusseau Books. ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎
A. Vaswani et al., “Attention Is All You Need,” NeurIPS 2017. arXiv:1706.03762 ↩︎
J. Dean, “Designs, Lessons and Advice from Building Large Distributed Systems,” keynote at LADIS 2009, slide “Numbers Everyone Should Know.” Slides ↩︎
T. Dao et al., “FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness,” NeurIPS 2022. arXiv:2205.14135 ↩︎ ↩︎ ↩︎ ↩︎ ↩︎
J. Shah et al., “FlashAttention-3: Fast and Accurate Attention with Asynchrony and Low-precision,” 2024. arXiv:2407.08608 ↩︎ ↩︎ ↩︎
R. E. Bryant and D. R. O’Hallaron, Computer Systems: A Programmer’s Perspective, Pearson. The memory mountain on this page was measured with our own benchmark following the book’s method. ↩︎ ↩︎ ↩︎
S. Williams, A. Waterman and D. Patterson, “Roofline: An Insightful Visual Performance Model for Multicore Architectures,” Communications of the ACM 52(4), 2009. Technical report ↩︎
J. Austin et al., How To Scale Your Model, Google DeepMind, 2025, part on transformer inference. ↩︎ ↩︎ ↩︎ ↩︎
A. Agrawal et al., “Taming Throughput-Latency Tradeoff in LLM Inference with Sarathi-Serve,” OSDI 2024. arXiv:2403.02310 ↩︎ ↩︎
P. Patel et al., “Splitwise: Efficient Generative LLM Inference Using Phase Splitting,” ISCA 2024. arXiv:2311.18677 ↩︎ ↩︎
B. W. Lampson, “Hints and Principles for Computer System Design,” 2020. arXiv:2011.02455 ↩︎ ↩︎
H. Touvron et al., “Llama 2: Open Foundation and Fine-Tuned Chat Models,” 2023. arXiv:2307.09288 ↩︎
Llama Team, AI @ Meta, “The Llama 3 Herd of Models,” 2024. arXiv:2407.21783 ↩︎ ↩︎
J. Ainslie et al., “GQA: Training Generalized Multi-Query Transformer Models from Multi-Head Checkpoints,” EMNLP 2023. arXiv:2305.13245 ↩︎ ↩︎
N. Shazeer, “Fast Transformer Decoding: One Write-Head is All You Need,” 2019. arXiv:1911.02150 ↩︎
R. Pope et al., “Efficiently Scaling Transformer Inference,” 2022. arXiv:2211.05102 ↩︎
T. Dao, “FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning,” 2023. arXiv:2307.08691 ↩︎
P. J. Denning, “The Locality Principle,” Communications of the ACM 48(7), 2005. PDF ↩︎
R. Prabhu et al., “vAttention: Dynamic Memory Management for Serving LLMs without PagedAttention,” ASPLOS 2025. arXiv:2405.04437 ↩︎
P. J. Denning, “The Working Set Model for Program Behavior,” Communications of the ACM 11(5), 1968. PDF ↩︎
B. W. Lampson, “Hints for Computer System Design,” Proceedings of the 9th ACM Symposium on Operating Systems Principles, 1983. PDF ↩︎ ↩︎ ↩︎ ↩︎ ↩︎
Anthropic, “Prompt caching,” Claude documentation, accessed November 2026. ↩︎ ↩︎
L. A. Belady, “A Study of Replacement Algorithms for a Virtual-Storage Computer,” IBM Systems Journal 5(2), 1966. ↩︎
L. Zheng et al., “SGLang: Efficient Execution of Structured Language Model Programs,” NeurIPS 2024. arXiv:2312.07104 ↩︎
vLLM project, “Automatic Prefix Caching,” design documentation, accessed November 2026. ↩︎
R. Qin et al., “Mooncake: Trading More Storage for Less Computation — A KVCache-centric Architecture for Serving LLM Chatbot,” FAST 2025 (paper); the trace study is in the arXiv version. ↩︎
Z. Zhang et al., “H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models,” NeurIPS 2023. arXiv:2306.14048 ↩︎
G. Xiao et al., “Efficient Streaming Language Models with Attention Sinks,” ICLR 2024. arXiv:2309.17453 ↩︎
Z. Liu et al., “KIVI: A Tuning-Free Asymmetric 2bit Quantization for KV Cache,” ICML 2024. arXiv:2402.02750 ↩︎
G.-I. Yu et al., “Orca: A Distributed Serving System for Transformer-Based Generative Models,” OSDI 2022. Paper ↩︎
Y. Zhong et al., “DistServe: Disaggregating Prefill and Decoding for Goodput-optimized Large Language Model Serving,” OSDI 2024. arXiv:2401.09670 ↩︎ ↩︎
F. J. Corbató, M. Merwin-Daggett and R. C. Daley, “An Experimental Time-Sharing System,” AFIPS Spring Joint Computer Conference, 1962. ↩︎
B. Wu et al., “Fast Distributed Inference Serving for Large Language Models” (FastServe), preprint, 2023. arXiv:2305.05920 ↩︎
Y. Fu et al., “Efficient LLM Scheduling by Learning to Rank,” NeurIPS 2024. arXiv:2408.15792 ↩︎
Y. Sheng et al., “Fairness in Serving Large Language Models,” OSDI 2024. arXiv:2401.00588 ↩︎
Y. Leviathan, M. Kalman and Y. Matias, “Fast Inference from Transformers via Speculative Decoding,” ICML 2023. arXiv:2211.17192 ↩︎
M. Shoeybi et al., “Megatron-LM: Training Multi-Billion Parameter Language Models Using Model Parallelism,” 2019. arXiv:1909.08053 ↩︎
Y. Huang et al., “GPipe: Efficient Training of Giant Neural Networks using Pipeline Parallelism,” NeurIPS 2019. arXiv:1811.06965 ↩︎
S. Rajbhandari et al., “ZeRO: Memory Optimizations Toward Training Trillion Parameter Models,” SC 2020. arXiv:1910.02054 ↩︎
D. Lepikhin et al., “GShard: Scaling Giant Models with Conditional Computation and Automatic Sharding,” 2020. arXiv:2006.16668 ↩︎
H. Liu, M. Zaharia and P. Abbeel, “Ring Attention with Blockwise Transformers for Near-Infinite Context,” 2023. arXiv:2310.01889 ↩︎
G. M. Amdahl, “Validity of the Single Processor Approach to Achieving Large Scale Computing Capabilities,” AFIPS Spring Joint Computer Conference, 1967. ↩︎
J. L. Gustafson, “Reevaluating Amdahl’s Law,” Communications of the ACM 31(5), 1988. ↩︎
Z. Jiang et al., “MegaScale: Scaling Large Language Model Training to More Than 10,000 GPUs,” NSDI 2024. arXiv:2402.15627 ↩︎
J. Dean and L. A. Barroso, “The Tail at Scale,” Communications of the ACM 56(2), 2013. ↩︎
A. Karpathy, “LLM OS” post on X, 11 November 2023, and the talk “Intro to Large Language Models,” November 2023. ↩︎
C. Packer et al., “MemGPT: Towards LLMs as Operating Systems,” 2023. arXiv:2310.08560 ↩︎ ↩︎
Anthropic, “Effective context engineering for AI agents,” September 2025. ↩︎
Anthropic, “Scaling Managed Agents,” April 2026. ↩︎ ↩︎ ↩︎
N. F. Liu et al., “Lost in the Middle: How Language Models Use Long Contexts,” Transactions of the ACL 12, 2024. ACL Anthology ↩︎
K. Mei et al., “AIOS: LLM Agent Operating System,” COLM 2025. arXiv:2403.16971 ↩︎
Anthropic, “Tool use with Claude,” Claude documentation, accessed November 2026. ↩︎
Anthropic, “Code execution with MCP,” November 2025. ↩︎
Anthropic, “Introducing the Model Context Protocol,” November 2024. ↩︎
Model Context Protocol specification, revision 2026-07-28, and the project’s introduction. ↩︎
M. D. McIlroy, E. N. Pinson and B. A. Tague, “UNIX Time-Sharing System: Foreword,” Bell System Technical Journal 57(6), 1978. ↩︎
Anthropic, “Building effective agents,” December 2024. ↩︎
R. Love, Linux Kernel Development, 3rd ed., Addison-Wesley, 2010, chapters on interrupt handlers and on bottom halves. ↩︎
Anthropic, “Interactive mode,” Claude Code documentation, accessed November 2026. ↩︎
J. H. Saltzer and M. D. Schroeder, “The Protection of Information in Computer Systems,” Proceedings of the IEEE 63(9), 1975. ↩︎
K. Greshake et al., “Not What You’ve Signed Up For: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injection,” AISec 2023. arXiv:2302.12173 ↩︎
N. Hardy, “The Confused Deputy (or why capabilities might have been invented),” ACM SIGOPS Operating Systems Review 22(4), 1988. ↩︎
S. Willison, “The Dual LLM pattern for building AI assistants that can resist prompt injection,” April 2023. ↩︎
E. Debenedetti et al., “Defeating Prompt Injections by Design,” 2025. arXiv:2503.18813 ↩︎
Anthropic, “Beyond permission prompts,” on sandboxing Claude Code, October 2025. ↩︎
Anthropic, “How we built our multi-agent research system,” June 2025. ↩︎
M. Cemri et al., “Why Do Multi-Agent LLM Systems Fail?,” NeurIPS 2025. arXiv:2503.13657 ↩︎
J. H. Saltzer, D. P. Reed and D. D. Clark, “End-to-End Arguments in System Design,” ACM Transactions on Computer Systems 2(4), 1984. ↩︎
M. Stonebraker, “Operating System Support for Database Management,” Communications of the ACM 24(7), 1981. DOI:10.1145/358699.358703 ↩︎