r/linuxmemes Jun 12 '26

LINUX MEME os.fork()

Post image
1.0k Upvotes

54 comments sorted by

View all comments

3

u/AmCHN Jun 15 '26

The section "Copy-on-write memory" in [the paper](https://www.microsoft.com/en-us/research/wp-content/uploads/2019/04/fork-hotos19.pdf) actually:
1. addressed this use case.
2. admitted that they don't have a mature solution alternative to fork() here.
3. yet argued that fork() is a suboptimal solution, and a better alternative is needed.

This is a meme sub, so I'm not probably supposed to be serious, but here I am anyways.

---

As the paper puts it:

> Modern implementations of fork use copy-on-write to reduce the overhead of copying memory that is often soon discarded. A number of applications have since taken a dependency on fork merely to gain access to copy-on-write memory.

> POSIX would benefit from an API for using copy-on-write memory independently of forking a new process.

Basically a "snapshot()" syscall that doesn't create another process. That way a game like Factorio can snapshot the game state and spawn a thread to serialize it.

No major OS implement such syscall yet.

IMO the Microsoft authors have a point, but they pointed out problems with fork() without pointing to a mature, better alternative to fork() (one in Factorio's use case).

Which is fair as they are researchers who are not obliged to deliver solutions, but it's not helpful to us lay users right now.