Date: Mon, 27 Apr 1998 23:32:55 -0400 (EDT) From: "Adrian T. Filipi-Martin" <atf3r@cs.virginia.edu> To: "David E. Cross" <dec@phoenix.its.rpi.edu> Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: SIGDANGER Message-ID: <Pine.SOL.3.96.980427231203.3622N-100000@mamba.cs.Virginia.EDU> In-Reply-To: <Pine.BSF.3.96.980427163110.29482B-100000@phoenix.its.rpi.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 27 Apr 1998, David E. Cross wrote: > I was recenlty shown AIX's SIGDANGER (33). It is a signal that the kernel > issues to [some] running processes when it gets dangerously low on space, > by default SIGDANGER causes programs to die, freeing up memory, system > critical processes and server processes woulf be compiled to ignore > SIGDANGER. This seems like a very good idea, could it be done in FreeBSD? > I remember someone talking about changing the signal structs to be an > array of INTs, instead of just an int to accomidate more than 32 signals. > > Thoughts? I always thought SIGDANGER was considered the worst of all bad ideas. It greatly reduces determinism because when you over allocate memory and then discover that you are short on memory the process that is SIGDANGERED is randomly chosen randomly from the offending process group. It may not even be a process that improves the situation when dead. The best example of this was create 50 of the following processes: /* sleeper.c */ #include <unistd.h> int main() { for(;;) sleep(30); return 0; } Then run the following: /* danger.c */ #include <stdlib.h> const int TwoGB = 2*1024*1024*1024; const int TwoMB = 2*1024*1024; int main() { char *p = (char *) malloc (TwoGB); for (i = 0; i < TwoGB; i += TwoMB) p[i] = 0; return 0; } When I ran this basic example on an AIX box years ago, a buch of the sleepers get killed before the danger process does. Why kill them? They have only minimal resources allocated. I believe it also breaks the POSIX definition of malloc(3), if I am not mistaken. Perhaps IBM had this ammended after introducing this misfeature. Caveat: I haven't messed with AIX boxes in a few years, so things may have improved, but I am naturally pessimistic when it comes to vendors fixing "great ideas". Adrian -- adrian@virginia.edu ---->>>>| If I were stranded on a desert island, and System Administrator --->>>| I could only have one OS for my computer, Neurosurgical Visualization Lab ->>| it would be FreeBSD. Think about it..... http://www.nvl.virginia.edu/ ->| http://www.freebsd.org/ 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?Pine.SOL.3.96.980427231203.3622N-100000>