[olpc-software] graceful handling of out-of-memory conditions

Ronald G Minnich rminnich at lanl.gov
Fri Mar 17 15:35:05 UTC 2006


Joshua N Pritikin wrote:
> Jim wants to the window manager to decide policy on out-of-memory
> conditions. Alan Cox says the kernel is doing the best it can and
> suggests auditing callers of malloc.  Of course this is too much
> work, even for the small set of preinstalled OLPC software.  Here an
> alternate idea:
>  (outlines a neat idea)

so, I'm a plan 9 kinda guy nowadays. My first reaction was this:

you have a file you can open (obviously, it's not really a file, but a 
path to a kernel device of some sort). It can only be opened once. You 
have to have permissions to open it, since it's a file ...

When the file is opened, OOM conditions in the kernel cause the kernel 
to send OOM messages that can be read from the file. Writes to the file 
of 'kill xyz' will result in xyz being killed.

No LD_PRELOAD wrapper needed. The daemon can be simple or complex. It 
can, in the limit, be a shell script, or even a bidirectional 'cat'.

Joshua, I think this is the spirit of your proposal without the unix 
domain socket or the PEERCRED needed. It's not a unix-way to do things, 
but it might be useful anyway.

This is how a number of systems work on Plan 9, including factotum, and 
it's dead simple to program to.

thanks

ron




More information about the olpc-software mailing list