Re: PID sequences

Dean Gaudet (dgaudet-list-linux-kernel@arctic.org)
Mon, 23 Feb 1998 21:19:44 -0800 (PST)


On Mon, 23 Feb 1998, David S. Miller wrote:

> Date: Mon, 23 Feb 1998 17:49:07 -0500
> From: Jim Nance <jlnance@avanticorp.com>
>
> halfpint> bash -c 'for x in 1 2 3 4 5; do /bin/sh -c '\''echo $$'\''; done'
> 4476
> 4300
> 3707
> 4243
> 3843
>
> This looks almost random, and it does not seem to break anything.
> I just wanted to let people know that if we wanted to use some other
> scheme for generating PIDs, there is some precident for doing so.
>
> I did consider this issue when I was optimizing and making SMP safe
> the current PID allocation scheme. If the above you say is true,
> there is a fantastically efficient way we can allocate PIDs, and an
> entire SMP lock in fork.c is removed.

I have a concern. Whether or not this is valid is for you folks to
decide. Read the theory that describes apache 1.3's mod_unique_id
<http://www.apache.org/docs/mod/mod_unique_id.html>. Essentially I make
an assumption that pid reuse is unlikely to occur within a single second.
I'm sure I'm not the only one making this assumption (think Message-ID
generation, tmp filename generation, yadda).

If you can do this with 15-bit "random" pids that's great. Otherwise
maybe pids have to go 31-bits. I didn't look at your scheme closely, but
it didn't seem to be "random".

Dean

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu