Re: Memory size?

From: Michael Wojcik (mwojcik_at_newsguy.com)
Date: 06/09/04


Date: 9 Jun 2004 15:50:52 GMT


In article <ca6ujf$6mh$7@sunnews.cern.ch>, Dan.Pop@cern.ch (Dan Pop) writes:
>
> IIRC, AIX actually sent a signal to the program, when this happened.
> If you didn't catch it and take whatever measures were appropriate,
> you have only yourself to blame.

Correct. When paging space runs low, AIX sends SIGDANGER to every
user process. A few seconds later, if memory consumption has not
been reduced, it begins to send SIGKILL to those processes which *did
not catch SIGDANGER* and are consuming the most virtual memory. It
only begins killing processes which received SIGDANGER and caught it
if the low-memory condition continues.

Processes can also poll for low-paging-space conditions using the
psdanger system call.

In other words, there's ample opportunity for every program to detect
the low-memory condition and take appropriate action, like
checkpointing its state and perhaps releasing some memory. The
latter is more feasible for some programs than for others, of course,
but most AIX programs can trivially return some memory to the system
using the mallopt function with the M_DISCLAIM command, which tells
the malloc subsystem to return freed pages to the OS (via the
disclaim system call). This is completely transparent to the
application - they remain mapped in the app's address space, and will
be reallocated from the VMM pool if and when they're needed to
satisfy future malloc requests.

This is all in the AIX documentation. Much of it is right in the
malloc man page.

Frankly, I'd be pretty suspicious of any application that runs for an
hour without checkpointing, as in Richard's example. Low virtual
memory is hardly the only condition which might interrupt it.

-- 
Michael Wojcik                  michael.wojcik@microfocus.com
I will shoue the world one of the grate Wonders of the world in 15
months if Now man mourders me in Dors or out Dors
   -- "Lord" Timothy Dexter, _A Pickle for the Knowing Ones_