pid rollover?

John F. Haugh II jfh at rpp386.Dallas.TX.US
Wed Feb 1 17:34:50 AEST 1989


In article <923 at auspex.UUCP> guy at auspex.UUCP (Guy Harris) writes:
>And it doesn't on his (S5?) system.  Different systems do it
>differently.  (Actually, the S5R3 code sets "nextpid" - actually, "mpid"
>- to 0, but if process ID 0 isn't already in use something rather
>strange has happened on your system....)

The general effect of the entire ordeal is something like

	struct	proc	*pp;

again:
	if (++mpid == MAXPID) {
		mpid = 0;
		goto again;
	}
	for (pp = proc;pp < v.ve_proc;pp++)
		if (pp->p_stat && pp->p_pid == mpid)	/* oops, exists */
			goto again;

The kernel repeatedly scans for a valid pid.  So the concern over
conflicting pid's is unfounded.  There is much more involved as
well.  Unless Guy wants to post the source to newproc(), I think
this is sufficient detail to answer the original question.

Of course, with school back in session, you really didn't expect
me to go posting code with a goto in it ;-)  See what you made me
do? ;-)
-- 
John F. Haugh II                        +-Ad of the Week:----------------------
VoiceNet: (214) 250-3311   Data: -6272  |"Your hole is our goal"
InterNet: jfh at rpp386.Dallas.TX.US       |     -- Gearhart Wireline Services
UucpNet : <backbone>!killer!rpp386!jfh  +------  Shrevesport, LA  -------------



More information about the Comp.unix.wizards mailing list