11 ms·
n.b. turning over-commit off comes with its own set of problems, such as causing programs to fail long before all memory has really been exhausted. For example
by joosters 7y ago
n.b. turning over-commit off comes with its own set of problems, such as causing programs to fail long before all memory has really been exhausted.
For example, fork() will have to ensure that there is enough memory for a complete copy of the running process. If you have a large process, e.g. using 4GB of a 8GB machine, then fork() won't be able to run, even if you just want to fork and run a tiny program.
With over-commit turned on, the fork() would work (because of copy-on-write) and the program could then happily exec() the new program.
The work-around is to allocate huge amounts of swap space so that the OS can be confident that it can reserve all the potentially required memory from fork(), even if it never normally has to use all that memory.
- caf 7y agoOr if you're just forking to exec a tiny program, use vfork().
- deleted 7y ago[deleted]
- convolvatron 7y agocow is orthogonal to overcommit
- kj4ips 7y agoRedis is an example of this. When redis saves in the background, it will for and use COW to shapshot a point in time, while the main redis thread keeps going with the normal redis. If you disable overcommit, redis can fail to fork, when there is actually sufficient memory to save the db.