lkml.org 
[lkml]   [1999]   [Apr]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: forking
On Tue, 20 Apr 1999, Greg Lindahl wrote:

> > Ok then, we seem to be looking at a 2.2.x problem, what regarding, I
> > don't know. It's not in 2.0.x (I've pushed my box into the 512 range on
> > 2.0.36 and then received the "cannot fork"). Suggestions so far have
> > been memory fragmentation and insufficient procs. Anyone else have
> > ideas?
>
> Actually, I've always had a problem like this on 2.0.x. I have a
> 64-node cluster, and I frequently run scripts which fork 128 processes
> at a time. These scripts occasionally get 'cannot fork', with no
> resource starvation evident... I wrote some test programs but wasn't
> able to get a nice, repeatable behavior.
>

I get 501 on my system.

#include <stdio.h>
#include <unistd.h>
#include <signal.h>
#include <wait.h>

void reap(int unused)
{
while(wait3(&unused, WNOHANG, NULL) != -1)
;
}
main()
{
int i = 0;
(void)signal(SIGCHLD, reap);
for(;;)
{
switch(fork())
{
case 0:
pause();
exit();
case -1:
kill(-1, SIGINT);
exit(1);
default:
fprintf(stderr,"Forks = %d\n", i++);
}
}
return 0;
}
Cheers,
Dick Johnson
***** FILE SYSTEM WAS MODIFIED *****
Penguin : Linux version 2.2.6 on an i686 machine (400.59 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:51    [W:0.805 / U:0.008 seconds]
©2003-2014 Jasper Spaans. Advertise on this site