2008/8/12 Juan Fco. Giordana <[EMAIL PROTECTED]> > Morgan Wesström wrote: > >> If I follow this advice, what happens when I compile something like >> Open Office which allocates 3-4GB in /var/tmp during compilation and >> I only have 2GB physical RAM in the computer? >> > > If all the Virtual Memory (VM = RAM+SWAP) is exhausted the kernel will try > to kill the process that is consuming most of it. Daniel Robbins explains > precisely that behaviour in this article: > > http://www.funtoo.org/en/articles/linux/ffg/3/ > > "So, the kernel mistakenly attacks the biggest VM-hog of a process it can > find, which is generally your X server if you happen to be running one. So, > your X server dies, and the root cause of the low-VM condition (tmpfs) isn't > addressed. Ick." > > See "Avoiding low VM conditions". > > if you're still using something the kernel won't kill nothing. the behaviour you're referencing is the kernel cached pages. when you use something you load it into memory. after you finish using it then the kernel will continue to hold the pages in ram as cached pages, if you have enough space to be able to speed up the eventual future reuse of that particular object. when the ram is over certain quota the kernel will free some pages based on different criteria like the oldness of the page or on how many times that particular page has been used. for example if you use libdvdcss to decode a dvd you'll have it in ram. let's assume that you then load another library and use that library 30 times. then you'll reuse libdvdcss again and then start a program that will consume quite some ram space, like openoffice. the kernel will free the libdvdcss from ram and cache it into the swap partition mantaining the other library into ram if possible, cause it has been used more than once. this is a mere and very simple example of how the kernel frees the ram space. as for processes that are in use, from my knowledge, the kernel will not kill anything unless the process doesn't reply to its interrupts.
-- dott. ing. beso
