pid rollover?

David Sherman dave at lsuc.uucp
Mon Jan 30 09:39:26 AEST 1989


In article <460 at oglvee.UUCP> jr at oglvee.UUCP (Jim Rosenberg) writes:
>Our system is an Altos 2000 running Xenix System V.  The CPU is a 386, and the
>C compiler produces 4 as sizeof(int).  However we seem to be hitting rollover
>of pids at 32K, implying that the kernel must be using short as the type of a
>pid -- at least internally.  I have two questions.  Why wouldn't the kernel use
>a true int for a pid, preventing rollover until 2147483647 or so?  Surely this
>isn't just because someone thought it would louse up the output format of ps??

The rollover has been at 30000 since time immemorial.  On the
16-bit PDP11, where pid was stored in a (short) int, there
obviously would have been a problem after 32767, and I suspect the
original design of a 30000 cutoff was simply to make it easier to
track how many rollovers there had been (they were rare in those
days, remember?).

>As system administrator should I be concerned about letting the pids roll over?
>We've had this happen several times with no apparent ill effects.  I'm not
>concerned about the kernel -- it seems to know what to do when pids roll over.
>But what about all those programs using mktemp() or $$ ?  Does anyone have any
>horror stories about applications that behaved badly after pid rollover?

There's a 1/30000 chance, so it's likely happened somewhere along
the line.  However, it would be hard to spot (imagine guessing at
that as the cause of a bug!), so I doubt too many people will have
had the horror story and have lived to tell of it :-)

David Sherman
-- 
Moderator, mail.yiddish
{ uunet!attcan  att  pyramid!utai  utzoo } !lsuc!dave



More information about the Comp.unix.wizards mailing list