Subject: Re: No swap?
To: Alfred Perlstein <bright@mu.org>
From: Andy Isaacson <adi@hexapodia.org>
List: tech-kern
Date: 04/08/2002 19:03:20
On Mon, Apr 08, 2002 at 01:39:04PM -0700, Alfred Perlstein wrote:
> * eeh@netbsd.org <eeh@netbsd.org> [020408 12:42] wrote:
> > So. getting back to the original point, if you really are locking up
> > due to lack of pages, there is nothing that can be done because you 
> > simply need more memory than you have on that machin.
> 
> There's actually a couple of things one can do:
> 
> 2) implement something like AIX's 'SIGDANGER', to inform processes
>    when memory is low, processes with a handler installed will then
>    try to reclaim resources and probably be on the low list for being
>    shot down when the actual shortage does occur.

I like it; "If you implement a SIGDANGER handler and you free at least
one page when the handler runs, you are exempt from being reaped [in the
first round at least]."

(Note that it should not be "and you free at least one page _in the
handler_" because the signal handler must simply set a flag and return
to the normal applicaition flow; the handler should not do free()
directly.)

This can trivially be used to implement the "Please don't kill me, I'm
important" flag you mentioned in 1).  Now we just need to prevent random
netscape-style applications from doing this.

-andy