Subject: Re: new pid allocation - any advantages?
To: David Laight <email@example.com>
From: Jaromir Dolecek <firstname.lastname@example.org>
Date: 03/21/2003 12:31:30
David Laight wrote:
> > I'm looking at this code (trying to figure how to adjust stuff to honour
> > hard limit PID_MAX for pid) and actually wonder if this is very useful
> > at all.
> pids greater than PID_MAX are only allocated if there are over (about) 16384
> ids already allocated . Since each active process can require 3 ids (it
> can have unique pid, pgid and sid) you would need to error the proc_alloc()
> call instead of allocating a larger pid.
Whatever, but ID > PID_MAX must not be used.
> > The code is quite big, uses some amount of memory on runtime and
> > the performance isn't really different to the previous pid allocator.
> The memory used at runtine is FAR less than the old code.
The previous code used just two int variables, didn't it? At least
for process ID allocation.
How much memory does the new pid allocation code use e.g.
when there are 128 IDs used? How much memory if 1024 used?
How much did the old pid allocation code used in these cases?
> The performance change it mainly to pfind() and pgfind() which are
> called quite often, and are now table lookups, not searches.
IIRC you said earlier you didn't see any performance difference
when you tried to benchmark this?
The only place where I see pfind()/pgfind() being used on common
code path is in kill(2). Otherwise they are used in ioctl/ktrace/setup
code, which not done frequently enough to matter. So speeding up
pfind()/pgfind() doesn't seem to be really a priority, IMHO.
If the only aim is to speed up pfind(), this could be easily
done with a hash - PIDs have very good distribution.
> The old code has a compile time dependency on MAXUSERS, this sucks.
This is totally orthogonal.
I'd still be interested to know if you tested the code
for PID > 16k and PID > 30k cases, though.
Jaromir Dolecek <jdolecek@NetBSD.org> http://www.NetBSD.org/
-=- We should be mindful of the potential goal, but as the tantric -=-
-=- Buddhist masters say, ``You may notice during meditation that you -=-
-=- sometimes levitate or glow. Do not let this distract you.'' -=-