Messages in this thread | | | Date | Wed, 25 Feb 1998 14:26:33 +1100 | From | Richard Gooch <> | Subject | Re: PID sequences |
| |
David S. Miller writes: > Date: Mon, 23 Feb 1998 21:19:44 -0800 (PST) > From: Dean Gaudet <dgaudet-list-linux-kernel@arctic.org> > > 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". > > Yes, there are some issues. Richard Henderson gave me some ideas last > night. Here is what I have so far. > > I can just imagine some program caching the parent pid, the parent > goes away (or changes, due to debugging for example), and the parent > pid gets reused very quickly (very likely with my suggested > algorithm). The child probes the parent by sending some harmless kill > signal to it, poof, disaster.
That's a bad way of doing it in the first place. Instead: if (getppid () == 1) my_parent_has_died ();
or: ppid = getppid (); if (getppid () != ppid) my_parent_has_died ();
> Solution involves some changes, which I think on the whole should not > add too much of a performance hit, and perhaps will still perform > significantly better than what we have right now.
If the above "problem" is the only one, then I don't see why there is a need to bother. There is a safe way to probe for parent death that will work with your PID allocation scheme.
Regards,
Richard....
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu
| |