Running out of memory
The standard memory allocation policy is to over-commit, which means that the kernel will allow more memory to be allocated by applications than there is physical memory. Most of the time, this works fine because it is common for applications to request more memory than they really need. This also helps in the implementation of fork(2)
: it is safe to make a copy of a large program because the pages of memory are shared with the copy on write flag set. In the majority of cases, fork
is followed by an exec
function call, which unshares the memory and then loads a new program.
However, there is always the possibility that a particular workload will cause a group of processes to try to cash in on the allocations they have been promised simultaneously and so demand more than there really is. This is an out of memory situation, or OOM. At this point, there is no other alternative but to kill off processes until the problem goes away. This is the job of the out of...