delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/1999/01/19/10:54:55

From: coreyg AT surfree DOT com (Geoff Corey)
Subject: Bumping PSIZE & NTTYS to 256 in shared.h
19 Jan 1999 10:54:55 -0800 :
Message-ID: <19990119183509.1374.cpmta.cygnus.cygwin32.developers@c000.paix.cp.net>
Mime-Version: 1.0
To: cygwin32-developers AT cygnus DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019