2 ms·
I thought fork was copy on write nowadays.
by thanatos519 2y ago
I thought fork was copy on write nowadays.
- layer8 2y agoIt is, but “write” doesn’t have an error code it can return on out-of-memory. The whole crux of overcommit is that the affected process doesn’t get a chance to gracefully fall back or shutdown on OOM conditions at defined places in the code (like at invocations of malloc).
- wmf 2y agoFork is copy-on-write. The problem is that there's no way for fork() to know how much memory the child process needs. It might call exec() immediately, using very little memory. It might keep running, mostly sharing pages with the parent. It might touch every memory page, requiring a lot of memory.