Messages in this thread | | | Date | Mon, 19 Jul 1999 09:20:47 -0400 (EDT) | From | "Richard B. Johnson" <> | Subject | Re: OOM |
| |
On Sat, 17 Jul 1999, Richard Johnson wrote:
> > I don't like the idea of killing off tasks that request resources > > that are not presently available. >
On Sat, 17 Jul 1999, Rik van Riel wrote:
> Have you thought about the problem at > all? >
Yep. And so did the guy who designed VAX/VMS. Now VMS is not Unix so there will be differences. Under VMS, a program was executed in the context of the current process. You did not have to fork/overwrite as you do in Unix. Therefore, if a process existed, it did not have to create another process in order to run some executable. This helped save on memory usage although Linux fork() and vfork() can usually work without allocation of any additional memory except stack.
The idea is the notion of a 'swap' file as well as a 'page' file. Linux uses a 'page' file, even though it's called a swap file. When memory is low, the kernel will stop allocating new pages to a process. Instead, it will swap existing pages to disk on a per process basis. In principle, a process might allocate 1 Gb of buffer, but always be using the same one physical page. The result is that a memory hog goes slower and slower, being I/O bound. Other tasks are unaffected except for some slowness of the kernel because of its increased work load.
Once the swap file is exhausted, the task(s) needing additional memory will sleep until memory is available (if ever). The result is that the kernel is never "out of memory". Instead, it's "out of swap". There is a difference. Tasks that don't need great gobs of memory continue. The memory hog can be seen and killed by its owner if necessary.
Certainly if a memory hog needs more memory than the virtual memory available on a system, it can't run on that system. It should not be allowed to compromise the system. Further, the kernel should not kill that task. Doing so will prevent the sysadmin from finding the problem since the evidence will be destroyed. Instead, `ps` would show something like this:
FLAGS UID PID PPID PRI NI SIZE RSS WCHAN STA TTY TIME COMMAND 140 100 71 1 0 0 12232 0 do_swap_pa S ? 0:02 (mem)
Cheers, Dick Johnson FILE SYSTEM MODIFIED Penguin : Linux version 2.2.6 on an i686 machine (400.59 BogoMips). Warning : It's hard to remain at the trailing edge of technology.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |