How are you determining they're "invalid"? […] I suspect those are zombie processes
Yes, these look like to be zombie processes (listed as in ps output). They seem to be grouped after "pid" 0. But OK, I will assume that the order is not guaranteed.
They were seen as invalid as they didn't appear in Activity Monitor.app.
It can return a PID that's no longer valid (the process was terminated immediately after the call was made).
PIDs can be "missing" from the list (because they were created immediately after the call was made).
Yes, this is fair as this is just a snapshot.
That's also why I thought that there could be no guarantees that the number of entries returned by the API was the exact number of entries instead of just a maximum number of entries in the populated list (i.e. entries after "pid" 0 were just random values).
Topic:
App & System Services
SubTopic:
Processes & Concurrency
Tags: