Subject: Re: README: kernel pty struct allocation change
To: Andrew Gillham <firstname.lastname@example.org>
From: Jaromír Doleček <email@example.com>
Date: 09/10/2000 13:26:07
Andrew Gillham wrote:
> What is the upper limit on this value? How many ptys can be expected
> to work correctly considering the kernel memory and /dev filenames?
> Looking at MAKEDEV (on i386) it appears that only 240 can be addressed?
The maximum value is kern.maxptys. It's 512 by default at this time. I will
lower this to 256 since that seems to be the limit enforced by
current naming scheme in /dev/.
Following the David's advice and after more though, I'm working
on making the kern.maxptys value settable to any value bigger
than current number of ptys.
> Would it be reasonable to expect to be able to have 512 people logged in
> at one time? Can NetBSD support thousands of concurrent logins?
> Don't some of the commercial unixes (Solaris?) support >= 2048 concurrent
I don't know if NetBSD would support such high number of concurrently
But pty's are used used also by screen, vi and other software
besides in getty/telnet/ssh sessions. The number of needed
pty's is thus higher than number of logged users, anyway.
> I'm mostly curious from the perspective of allocating ptys as needed and
> finding out at 295 (arbitrary number) that kernel memory is exhausted, etc.
Memory exhaustion would lead to every process trying to open the
296th pty to block until memory is available. This should not
cause any problems, particularily should not lead to any possibility of DoS
attack any more the previous behaviour (fixed number of ptys) would.
It would still be possible to use any of those first 295 ptys
normally even when some processes would be blocked waiting for memory.
The biggest chunk of memory is taken by appropriate tty structs, which
were also allocated at runtime previously. While pty private structure
is about 20B on i386, the tty struct is like 200 B or even more.
Memory needed for pty-private structures for 512 entries is now like:
512 * sizeof(void *) + 512 * sizeof(struct pt_softc) = (approx) 12288 B
Total memory needed for fully populated array with 512 entries, when tty
struct is included (on i386, approximate guess):
12288 + 512 * sizeof(struct tty) = 114688 bytes
Jaromir Dolecek <jdolecek@NetBSD.org> http://www.ics.muni.cz/~dolecek/
@@@@ Wanna a real operating system ? Go and get NetBSD, damn! @@@@