# What is your current highest PID?



## michaelsanford (May 29, 2008)

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):

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


----------



## michaelsanford (May 29, 2008)

Wow, what an equally neat and frivolous idea Mike; mine's *37198*.


----------



## Viro (May 29, 2008)

1511.


----------



## Giaguara (May 29, 2008)

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...


----------



## michaelsanford (May 29, 2008)

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).


----------



## macbri (May 30, 2008)

PIDs wrap somewhere near the 30k mark. Here's what I got on 10.4.11:


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

Wrapped for me here:

[...]
29991
29995
29999
104
108
112
[...]


----------



## Giaguara (May 30, 2008)

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.


----------



## michaelsanford (Jun 2, 2008)

Doesn't wrap for me: 47435  (OS X 10.5.3)


----------



## Zaphire (Jun 21, 2009)

55015, and growing!  Running 10.5.7.  Does it still wrap on 10.5.7, and if so, where?


----------



## Giaguara (Jun 22, 2009)

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...


----------



## ora (Jun 22, 2009)

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.


----------

