From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f8c9b,13007e6f500d17dd X-Google-Attributes: gidf8c9b,public X-Google-Thread: fc89c,13007e6f500d17dd X-Google-Attributes: gidfc89c,public X-Google-Thread: 10650a,13007e6f500d17dd X-Google-Attributes: gid10650a,public X-Google-Thread: fee84,13007e6f500d17dd X-Google-Attributes: gidfee84,public From: andrewg@microlise.co.uk (Andrew Gierth) Subject: Re: out of swap -> killing inetd Date: 1996/07/10 Message-ID: #1/1 X-Deja-AN: 167493712 x-nntp-posting-host: microl.demon.co.uk references: <4rr9md$gsc@xensei3.xensei.com> <4rt691$2jl@sun.rhbnc.ac.uk> x-mayan-date: Long count = 12.19.3.5.10; tzolkin = 13 Oc; haab = 13 Tzec organization: Microlise Engineering Ltd. x-attribution: AG newsgroups: comp.unix.internals,comp.unix.osf.osf1,comp.unix.questions,comp.unix.programmer >>>>> "Bob" == Bob Vickers wrote: Bob> It is almost certainly directly related to your swap mode. In Bob> immediate swap mode an error occurs at malloc time if swap space Bob> is unavailable, and a well written process can easily recover Bob> from this. In deferred mode the malloc succeeds but random Bob> errors occur later on when the process tries to write to the Bob> memory. This is the penalty you pay for the disc space saving Bob> which deferred mode gives you. >>>>> "Peter" == Peter da Silva writes: Peter> That's pretty broken. It should be possible to simply allocate Peter> memory pretty close to real memory + swap without problems, Peter> and then have malloc (actually, sbrk()) and friends generate Peter> errors at that point. I don't see why it should ever be Peter> necessary to kill random processes. Errors can only be reported by sbrk() when swap-space allocation is being done early. The whole point of deferred swap allocation is *not* to allocate swap space simply because sbrk() has been called; this allows, for example, the use of sparse-memory algorithms (without requiring gigabytes of swap). The early allocation scheme has some particular disadvantages; on most systems I've encountered it was always necessary to configure substantially more swap that could ever actually be used, simply to ensure that memory *could* be allocated for things that, in fact, were never going to consume swap space. With deferred allocation, swap space is reserved when pages are actually referenced. Since there is no obvious mechanism for the kernel to report an out of memory condition on what is, after all, an innocent memory access by the program, there is little choice except to kill the process (or some other process, to free up some swap space). I'm not familiar with Digital Unix (last time I used it it was called Ultrix :-), but I have had the usual amount of fun with deferred swap allocation on AIX. AIX has a particular order of preference for which processes it kills when running low on swap, and also has the ability to set early allocation on a per-process basis, with these processes being exempt from paging-space kills. The whole immediate vs deferred allocation thing is a tradeoff, anyway. Having it optional seems to me to be a reasonable behaviour. I am less impressed by the apparent majority of implementations that appear to have simply rejected deferred allocation out of hand. -- Andrew Gierth (andrewg@microlise.co.uk)