[ale] PID numbers

Benjamin Scherrey scherrey at innoverse.com
Thu Apr 4 00:27:35 EST 2002


In fork.c :: get_pid() you'll see a highly optimized function call. I think it looks kindof sloppy but PIDs 
are only 16-bit values and will easily roll over. It generally does allocate them in sequential order but 
a pure sequential approach would actually be quite costly requiring a thourough walk of the task list 
to make sure it isn't a collision. You could re-write the function to perform as you wanted but your 
biggest problem is going to be the size of the PID itself and that's a serious change to the kernel to 
fix. Making code dependent upon  upon the relative value of another process id is certainly an 
unsafe practice and will result in undefined behaviour.

	best regards,

		Ben Scherrey

4/3/2002 11:41:11 PM, "Chris Fowler" <cfowler at outpostsentinel.com> wrote:

>I have a question on pid nuber selection.  Why does the kernel not pick PIDS
>in sequential order?
>Can I change this?




---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be 
sent to listmaster at ale dot org.






More information about the Ale mailing list