AFAIG, it is based on the kernel PSLOT number and a generation number, meaning there will be some time before a PID number is re-used, but I don't know the specifics.
Thanks p5wizard, you gave me enough of a clue to find the complete answer. The PID is the PSLOT number divided by 256 in a 32 bit kernel, 4096 in AIX 5.1 and 8192 in 5.2.
Michael, it's the other way around (PSLOT number is low number, PID numbers are high)...
If you look at [tt]pstat -a[/tt] output, you can deduce that PID number is PSLOT number times a factor plus some offset.
On AIX53, I have PID=PSLOT*4096+offset
So I'm betting that this offset (I've seen it called generation count on some info I googled) is incremented at every reuse of the PSLOT number.
For every PSLOT number, it would theoretically take up to a maximum of 4096 generations for the same PID number to come up again. But it is probably half of 4096 (or less) as apparently PID numbers on AIX in this schema are always EVEN, the PID 1 for [tt]init[/tt] being the exception...
So you'd be pretty safe in assuming the same PID won't come up again in the same 24hr period, unless you have a server that has massive amounts of short running (sub-second) processes... And probably the kernel programmers accounted for this and would probably block the re-use that PSLOT number for the remainder of that 24hr period or distribute the rapid restarting processes evenly among all free PSLOT numbers to avoid that scenario.
Anyway, this is just google-and-guess-work so maybe I will want to find out for real on the AIX Kernel Internals class some day soon... ;-)
That's so odd - why and where are you getting this from? It's certainly not 4096, although it does look like they're spaced apart but it seems to be by 102h:
3 a 306 0 0 0 0 1 sched
FLAGS:swapped_inno_swapfixed_prikproc
4 a 408 0 0 0 0 1 lrud
FLAGS:swapped_inno_swapfixed_prikproc
Most of them are oddly enough like this for unclear reasons.
That is precisely my problem. In non AIX UNIX I could use $$ for a temporary file name in my scripts and be sure it was a unique file name. Now I have to do something else, probably a combination of PID and timestamp (
Well, a PID is unique at any given time. If your process creates that /tmp/$$ file, uses it for whatever purpose and cleans it up (removes it) before the process ends, you should still be all right...
That is true, but sadly enough, it is also used as a tag to identify a sequence of events in an application log which over its 24 hour lifetime ends up with the same tag for multiple transactions. At least I know what I have to work with. Thanks for your help, you ARE the wizard!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.