From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,e9baf10a5806cc9d X-Google-Attributes: gidfee84,public X-Google-ArrivalTime: 1994-02-17 11:27:17 PST Path: gmd.de!xlink.net!howland.reston.ans.net!europa.eng.gtefsd.com!news.umbc.edu!cs.umd.edu!not-for-mail From: harry@cs.umd.edu (Harry Mantakos) Newsgroups: comp.unix.osf.osf1 Subject: Re: Swap space full problems Date: 17 Feb 1994 14:27:17 -0500 Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Distribution: world Message-ID: <2k0gel$gkj@krishna.cs.umd.edu> References: <2jgkk3$pqd@decuk.uvo.dec.com> <2jh8je$fd@usenet.pa.dec.com> <2ju8pj$qlg@huon.itd.adelaide.edu.au> NNTP-Posting-Host: krishna.cs.umd.edu In article <2ju8pj$qlg@huon.itd.adelaide.edu.au> andrewr@itd.adelaide.edu.au (Andrew Rutherford) writes: > On the overcommit machine, it allocated more memory than existed, >tried writing to a page of it, and the kernel killed it. System returns >to normal after a five minute hang. > > On the eager allocation machine, it chewed up all memory it could, >then the malloc's must have started failing, but it didn't die as a result >of it - we wouldn't have known what the problem was if not for the other >machine - the only way out was the panic button, as we couldn't run >anything else as there was no memory availible. I don't think this is a typical situation. The process on the second machine should have exit()'ed after a failed malloc, sort of sounds like someone didn't check a malloc() return value. With the more traditional allocation scheme, swap is reserved as memory is allocated, this insures that you will only run out of swap when memory is being allocated, as in when a process is first starting up or when it is doing a malloc(). With deferred swapping the system will honor requests for any amount of virtual memory, and swap will be assigned only as those allocated pages of memory are actually accessed. Deferred swapping is more efficient, because pages that are never used never take up any swap. However the system will make commitments for more virtual memory than it actually has, and when it actually does run out of swap, processes will fail on memory accesses rather than just on malloc, or fork/exec. To check this out, I turned on deferred swapping on an alpha here (running OSF/1 V1.2) and ran a few instances of a process that malloc's a 50 meg chunk, then goes through and touches each page one by one. With 80 meg of swap, the system cheerfully promised out 200 meg of virtual memory. When the system started running out of swap (as the processes started accessing their promised pages), the machine turned into a battleground, my editor sessions croaked, shells quit, and windows started disappearing. With deferred swapping turned off, the processes that were eating up all the memory would have just failed on the malloc(). So, of course it's a trade-off. With deferred swapping you can use the swap you have more efficiently (by never reserving swap for pages that never get accessed). However things are uglier when you actually do run out of swap. Processes get killed at "random" moments with no chance to exit gracefully (and maybe clean up after themselves in some fashion). Also, since it isn't the malloc()s that are failing, the processes that die aren't necessarily even the ones eating up all the memory. -harry ------------------------------------------------------------------------------ Spoken: Harry Mantakos Domain: harry@cs.umd.edu UUCP: uunet!mimsy!harry Phone: 301-405-2750 USPS: U of Maryland, CS Dept., College Park, MD 20742