Subject: Re: increase default for number of files descriptors per process (was Re: Speeding up "pstat -T")
To: Perry E. Metzger <perry@piermont.com>
From: Andrew Brown <atatat@atatdot.net>
List: tech-userlevel
Date: 10/07/2003 11:04:26
>> > A machine with 4G of physical memory probably can afford to
>> > let user processes have a bit of a larger default stack size than a
>> > machine with 4M of memory, right?
>> 
>> Why should the amount of physical memory have any effect on the
>> default stack size limit of a process?
>
>It is more damaging on a machine with little physical memory for one
>user to take up lots and lots of memory than on a machine with
>plenty. The limits are partially there to prevent certain kinds of
>denial of service.

while that's nominally true, there's still *nothing* preventing me
from doing this:

	char *p;
	for (p = 0x40000000;
	    (p = mmap(p, 4096, PROT_READ|PROT_WRITE, MAP_ANON, -1, 0)) != -1;
	    p += 4096)
		*p = '*';

so if had had more stack space, that would reduce to this:

	void foo(void) { foo(); }
	main() { foo(); }

the latter would merely take longer.  oh, and cost more in kvm along
the way.  ;-)

-- 
|-----< "CODE WARRIOR" >-----|
codewarrior@daemon.org             * "ah!  i see you have the internet
twofsonet@graffiti.com (Andrew Brown)                that goes *ping*!"
werdna@squooshy.com       * "information is power -- share the wealth."