On Saturday 23 January 2010 22:10:51 Roman Gelfand wrote: > What happens when debian is out of memory?
The Linux kernel has two main ways to deal with an OOM situation. The most commonly encountered in the oom-killer. Sometimes, a request for a memory mapping is assigned an address, but is not immediately reserved in physical RAM. (This is called an "overcommit".) When a new page is accessed, an RAM assignment is allocated. If there is no space in RAM, swappable pages are written to disk and freed from RAM to mark room. If there is no swap space available, the oom-killer chooses a process (based on a number of heuristics) and terminates it rather aggressively, freeing the memory allocated for it. This choose+terminate process may be repeated until the currently running process is terminated (and therefore, doesn't need the memory), or the paging request can be satisfied. Also encountered is a more "traditional" memory allocation failure. In this case the kernel receives a request for more memory and attempts to allocate it RAM immediately. If the RAM can be allocated without involving the oom- killer, the request succeeds. Otherwise, the system call fails and the application may handle it "gracefully" (or not; application specific). > Does it freeze? The kernel will not. It may terminate if process 1 is killed, but it should not freeze. Applications could. They might be waiting for data from a process the oom-killer terminates. The might enter a loop expecting the system call to succeed after some period of time. > Is there > any trace of memory glut in log files? I believe the oom-killer does emit a syslog message when it terminates a process. There is no message from the kernel when the memory allocation system call fails, the application is expected to handle any reporting that needs to be done in that case. Check the manpage for proc in section 5. It describes various kernel settings. The two most applicable to memory management in low-memory situations are /proc/sys/vm/overcommit_memory and /proc/sys/vm/overcommit_ratio. I detest the very idea of "overcommit" which arguably violates several decades of C, POSIX, and SUS documentation. So, I prefer /proc/sys/vm/overcommit_memory = 2 and /proc/sys/vm/overcommit_ratio between 80 and 100, inclusive. -- Boyd Stephen Smith Jr. ,= ,-_-. =. b...@iguanasuicide.net ((_/)o o(\_)) ICQ: 514984 YM/AIM: DaTwinkDaddy `-'(. .)`-' http://iguanasuicide.net/ \_/
signature.asc
Description: This is a digitally signed message part.