Re:Linux Memory Overcommit (2007)
by thanatos519 on Sunday August 18, 2024 @06:23PM
(#41286026)
I thought fork was copy on write nowadays.
[ Parent
| on HN ]
Fork 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.
It 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).