Moving beyond fork() + exec()
Li Chen's proposed spawn templates aim to speed repeated process launches, but reviewers say the larger goal should be a cleaner replacement for fork()+exec().
Intelligence analysis by GPT-5.4 Mini

LWN reports on a kernel patch set that tries to optimize repeated launches of the same executable by caching setup in a spawn template. Reviewers like the direction, but several argue the real fix is a new process-creation model that avoids fork() altogether.
Starting a program on Linux is like photocopying a whole notebook just to use one blank page. This idea tries to keep a shortcut ready for the same program, while some developers say the better plan is to stop photocopying the notebook at all.
Analysis
What the proposal does
Li Chen's patch set introduces a new idea called spawn templates. The kernel would create a template for a specific executable, either from a file descriptor or an absolute path, and cache information that helps future launches of that program run faster.
When an application wants to start a new instance, it would supply the arguments, environment, and a list of actions describing things like closing or duplicating file descriptors, opening files, changing directories, or adjusting signal handling. The new spawn_template_spawn() call would then use the cached template to carry out the launch more efficiently than the usual fork() followed by exec() sequence.
What reviewers thought
The article says the proposal is not expected to be accepted as written, but it may still help point toward a future process-creation primitive. The reported benchmark improvement is about 2%, which is modest, but could matter for software that repeatedly launches the same executable.
Mateusz Guzik argued that the core issue is not just making fork()+exec() a little cheaper. In his view, the real problem is the fork step itself, and the better long-term answer is a fresh process that starts out empty rather than copying the parent.
Christian Brauner was more receptive to the general direction, describing a builder-style API for exec as not unreasonable. He suggested that a future design might build on pidfd ideas, possibly by creating an empty process and then configuring it through new calls before execution. He also said an important goal would be supporting posix_spawn() from user space.
Bigger picture
The discussion is less about one patch set and more about whether Linux should keep refining the old fork/exec model or move toward a new primitive that makes process setup explicit and cheaper from the start.
Key points
- Li Chen proposed spawn templates to speed repeated launches of the same executable.
- The kernel would cache setup details for an executable and reuse them on later spawns.
- The proposal covers arguments, environment, file-descriptor actions, and signal-related setup.
- Reviewers said the patch set is interesting but does not remove the cost of fork().
- Several commenters argued for a new process-creation primitive, possibly based on pidfd ideas.
If the idea keeps evolving, it could reduce the overhead of starting the same program over and over again. It could also help shape a cleaner future API that makes process setup more explicit and easier to optimize.
The current design may be too limited if it only shaves a small amount off the existing fork()+exec() path. Reviewers also suggest the real cost is still in fork(), so a template-based approach could end up being a partial fix rather than the right long-term answer.
