Date: Tue, 28 Apr 1998 14:55:36 -0600 From: Lyndon Nerenberg <lyndon@ve7tcp.ampr.org> To: "David E. Cross" <dec@phoenix.its.rpi.edu> Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: SIGDANGER Message-ID: <199804282055.OAA16644@ve7tcp.ampr.org> In-Reply-To: Your message of "Tue, 28 Apr 1998 12:17:40 EDT." <Pine.BSF.3.96.980428121410.15319C-100000@phoenix.its.rpi.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
>>>>> "David" == David E Cross <dec@phoenix.its.rpi.edu> writes:
David> Default should be as it is on AIX, to terminate the
David> process.
Folks, the default (AIX 4.2) is to *ignore* the signal:
The system monitors the number of free paging space blocks and detects
when a paging-space shortage exists. When the number of free paging-space
blocks falls below a threshold known as the paging-space warning level,
the system informs all processes (except kprocs) of this condition by
sending the SIGDANGER signal. If the shortage continues and falls below
a second threshold known as the paging-space kill level, the system
sends the SIGKILL signal to processes that are the major users of
paging space and that do not have a signal handler for the SIGDANGER
signal (**the default action for the SIGDANGER signal is to ignore the
signal**). The system continues sending SIGKILL signals until the number
of free paging-space blocks is above the paging-space kill level.
[Above quoted from the AIX system doc]
Processes in AIX will eventually die from SIGKILL, the same as any other
UNIX that overcommits. If you don't do something explicit with SIGDANGER
you'll never know it's there. (It has to behave this way to maintain
backwards source compatibility.)
AIX provides a pssignal() subroutine that can be used to query the state
of the paging space. (pssignal manpage appended to the end of this message.)
Limited user-space control of the swapspace allocation policy is available:
If the PSALLOC environment variable is set to early, then every
program started in that environment from that point on, but not
including currently running processes, will run in the early
allocation environment. In the early allocation environment,
interfaces such as the malloc subroutine and the brk subroutine
will fail if sufficient paging space cannot be reserved when the
request is made.
I *especially* like their suggested method of changing the
policy from within a running program:
Programming Interface
The programming interface that controls the paging space allocation
mode uses the PSALLOC environment variable. To ensure that an application
always runs under the desired mode (with or without early paging space
allocation), do the following:
1. Use the getenv subroutine to examine the current state of the
PSALLOC environment variable.
2. If the value of the PSALLOC environment variable is not the value
required by the application, use the setenv subroutine to alter
the value of the environment variable. Since only the execve
subroutine examines the state of the PSALLOC environment variable,
call the execve subroutine with the same set of parameters and
environment received by the application. When the application
reexamines the state of the PSALLOC environment variable and finds
the correct value, the application continues normally.
3. If the getenv subroutine reveals that the current state of the
PSALLOC environment variable is correct, no modification is needed.
The application continues normally.
Are these guys for real?
If anything, a process should be able to change it's allocation
policy through vmadvise(), although I'd hate to contemplate what
sort of kernel mods would be required. And no matter how this is
implemented, any form of overcommit should be *disabled* by default.
Any system that ships out-of-the-box with broken malloc() and sbrk()
is pretty lame ...
--lyndon
psdanger Subroutine
Purpose
Defines the amount of free paging space available.
Syntax
#include <signal.h>
int psdanger (Signal)
int Signal;
Description
The psdanger subroutine returns the difference between the current
number of free paging-space blocks and the paging-space thresholds
of the system.
Parameters
Signal Defines the signal.
Return Values
If the value of the Signal parameter is 0, the return value is the
total number of paging-space blocks defined in the system.
If the value of the Signal parameter is -1, the return value is the
number of free paging-space blocks available in the system.
If the value of the Signal parameter is SIGDANGER, the return value
is the difference between the current number of free paging-space
blocks and the paging-space warning threshold. If the number of free
paging-space blocks is less than the paging-space warning threshold,
the return value is negative.
If the value of the Signal parameter is SIGKILL, the return value
is the difference between the current number of free paging-space
blocks and the paging-space kill threshold. If the number of free
paging-space blocks is less than the paging-space kill threshold,
the return value is negative.
Implementation Specifics
This subroutine is part of Base Operating System (BOS) Runtime.
Related Information
The swapon subroutine, swapqry subroutine.
The chps command, lsps command, mkps command, rmps command, swapon
command.
Paging Space Overview in
Subroutines Overview and Understanding Paging Space Programming Requirements
in AIX Version 4 General Programming Concepts: Writing and Debugging
Programs.
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199804282055.OAA16644>
