[lkml]   [1998]   [Feb]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: PID sequences

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

> Date: Mon, 23 Feb 1998 17:49:07 -0500
> From: Jim Nance <>
> 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
<>. 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".


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to

 \ /
  Last update: 2005-03-22 13:41    [from the cache]
©2003-2014 Jasper Spaans. hosted at Digital Ocean