Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!caen!rphroy!hobbes.cs.gmr.com!tkacik From: tkacik@hobbes.cs.gmr.com (Tom Tkacik CS/50) Newsgroups: comp.sys.3b1 Subject: Re: swap space Message-ID: <55913@rphroy.UUCP> Date: 13 Jun 91 15:26:29 GMT References: <1991Jun9.170520.4087@yenta.alb.nm.us> <1991Jun11.030216.6155@ceilidh.beartrack.com> <1991Jun13.065207.10089@ucunix.san.uc.edu> <1991Jun13.122803.25362@ims.alaska.edu> Sender: news@rphroy.UUCP Reply-To: tkacik@hobbes.cs.gmr.com (Tom Tkacik CS/50) Organization: G.M. Research Labs, Warren, MI Lines: 43 Nntp-Posting-Host: hobbes.cs.gmr.com In article <1991Jun13.122803.25362@ims.alaska.edu>, floyd@ims.alaska.edu (Floyd Davidson) writes: |> In article <1991Jun13.065207.10089@ucunix.san.uc.edu> adams@ucunix.san.uc.edu (J. Adams - SunOS Wizard) writes: |> >In article <1991Jun11.030216.6155@ceilidh.beartrack.com> dnichols@ceilidh.beartrack.com (DoN Nichols) writes: |> > In fact, a new process will not be |> >allowed to run if it cannot fit in the virtual space available. It will |> >be killed in the memory allocation stage. If you examine the kernal .o |> >files, you will see that the only swapping program is vmswap.c. This |> >program manages/shares the same virtual address space as vmpage.c. |> |> I don't know one way or the other on this. Does it kill the new |> process or kill an old process? I know if existing processes |> ask for more memory and swap space is full it will start killing off |> processes. But I don't know what the algorithm is. When a process asks for more memory than there is virtual memory, (via malloc, or sbrk(2)), an error will be returned, and the process will not get any bigger. It will not be killed by the kernel either, it will usually call exit by itself, or fail with a segmentation violation as it mindlessly tries to use the NULL pointer returned by malloc. (Of course, a proper program will try to clean up after itself and handle the lack of memory in a graceful fashion.:-) I believe that if there is still plenty of virtual memory but very little swap space left, if a program then calls malloc (or sbrk) the same error will be returned, and the program will not grow. I do not think that a running program will be killed because there is not enough memory to grow into, it simply will not be allowed to grow anymore. If a new process tries to start running, and there is no more memory, the kernel will not let it run. I do not think that it will start and then be killed by the kernel. The kernel should never just start killing off processes when swap space runs out. Individual processes will start to die off as they need more memory and cannot get it. -- Tom Tkacik GM Research Labs tkacik@hobbes.cs.gmr.com tkacik@kyzyl.mi.org