What is your current highest PID?

michaelsanford

Translator, Web Developer
Another frivolous but potentially interesting thread: your current highest process-ID.

I got the idea for this one day when I was amazed to see very high PIDs on my iBook, which I restart rather often. I can only imagine those with Mac Pros or XServes who don't reboot for months at a time.

Quick code to return the highest PID (run in Terminal.app):
Code:
ps a | grep ps | grep -v grep | awk '{print $1}'
 
Last edited:
37198? But Mac OS X unlike BSD recycles the PIDs back from 0 once it reaches 31999...

Ok I've got a lousy uptime of 6 days as I had to reboot for reloading newer Fusion kexts, so highest PID is only 2526. With dashboard off...
 
It recycles pids? But I've had pids of 80000 and higher, I'm *fairly* certain, at least.

1007, anyway (rebooted after Mark/Space update, which REALLY should only require logout).
 
PIDs wrap somewhere near the 30k mark. Here's what I got on 10.4.11:

Code:
while true;do ps a|grep ps|grep -v grep|awk '{print $1}';done

Wrapped for me here:

[...]
29991
29995
29999
104
108
112
[...]
 
I thought it was well documented... I'm pretty sure it is somewhere on ADC site, but not just too obviously visible I guess.
When ever my uptimes get to 150 days or more, how could the PIDs be otherwise on the range of under 32,000?
I discovered the PID thing years ago, in 10.3 times, when my uptime was a few months, and new processes didn't seem to get any higher pids for top. All new processes were around 22000 on the second or third round...

Now that I check it, the PID recycling seems to occur only in 10.4 and before (or maybe 10.3 and before?).
On the MacBook next to me, with uptime of 18 days, I get highest PID reported as 66859. Good. At least one more thing standardized.
 
10.5 changed it to do a proper BSD style 1-99999 and then recycle. Finally.

Current highest PID - 43370
up 61 days, 10:36, 2 users, load averages: 1.51 0.99 0.74 -- so the PIDs have cycled at least once...
 
10863
Uptime 5 days though after some weirdly glitchy behaviour I needed to restart, and will have to shut down later today for a flight.
 
Back
Top