Mail Archives: cygwin-developers/1999/01/19/10:54:55
Is there any reason why this shouldn't work?
I'm back porting software from UNIX to NT and I don't have a very large timeframe (thanks to the marketing department). The code does I bunch of forks when connecting users (thanks to previous owners of the code). I know forks are expensive under cygwin (not to mention in general), however if I bump this number up it solves my time crunch until I can move the software to a threading model.
The limiting factor for forking this many processes is memory. My test program will try and fork 300 processes. Watching the forked processes under the performance monitor shows that it will allocate about a 1 meg of memory for each process. If you do not have enough memory then NT will hit the swap file. Hit the swap file may cause a timeout in the fork routine, causing the fork to fail.
Here is exactly what I did.
Modified shared.h under winsup directory and changed
#define PSIZE 128 to #define PSIZE 256
#define NTTYS 128 to #define NTTYS 128
Recompiled the cygwin1.dll and replaced the one found in B20.1
I used the following test program to see if it works
/*-------------------------------------------*/
#include <stdio.h>
#include <process.h>
static int i;
int
main(int argc, char *argv[])
{
int j;
printf("Forking\n");
for(i=0;i<300;i++){
j = fork();
if(j)
break;
printf("Forked %d\n",i);
}
sleep(15);
exit(0);
}
/*------------------------------------------*/
---------------------------------------------------------
Phone (770) 522-4718
Email coreyg AT surfree DOT com (HBOC mail is not setup yet!)
---------------------------------------------------------
--------------------------------------------------------
$14.95 Unlimited Internet Access, http://www.surfree.com
- Raw text -