On Thu, 14 Feb 2008 16:45:02 -0000, Douglas A. Gwyn <[EMAIL PROTECTED]>
wrote:
[EMAIL PROTECTED] wrote:
for (;;)
fork();
In genuine UNIX(tm) systems, there is a per-user process limit,
so eventually the fork requests start failing. However, this
program keeps trying to fork, so if you kill off some of the
child processes it will spawn replacements.
That is not limited to UNIX proper. FreeBSD (and relatives, I suppose) all
have the /etc/login.conf where one can set limits on virtually all aspects
of user priviliges (cputime, filesize, datasize, stacksize, coredumpsize,
memoryuse, maxproc, openfiles, sbsize, etc) for arbitrary user classes. I
think it will be possible to kill the spawned children, because they are
all bound to have pids larger than a certain number.
I do not know if Linux has similar facilities. As for Plan 9, the book by
Francisco Ballesteros mentions a piece of code worse than the above and
points out that the only way to get rid of it would be to reboot the
system (which is quite as funny as the "bootsplash: silent mode," by the
way).
----snippet----
/* rabbits.c */
#include <u.h>
#include <libc.h>
void
main(int, char*[])
{
// just like rabbits...
while(fork())
;
exits(nil);
}
----snippet----
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/