Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

The Mac OS X Internals book states that the maximum process identifier is 30,000 and after that the kernel will start re-using pids. But checking on my own system, via:

ps a | grep ps | grep -v grep | awk '{print $1}'

I can see that I have pids that go higher. Does anyone know if there is a pid_max explicitly set somewhere, like in Linux?

share|improve this question
add comment

1 Answer 1

up vote 7 down vote accepted

Looking at sys/proc_internal.h in xnu-1699.24.23, I find that PID_MAX is 99999. The value is used in kern_fork.c in the function forkproc. Looking at that function, process IDs are not assigned equal to PID_MAX, so the highest possible pid is 99998.

share|improve this answer
4  
The book is out of date, it did use to be 30000 (xnu-792 - Tiger) and changed to 99999 when xnu-1228 was released (Leopard) –  Stu Wilson May 11 '12 at 21:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.