How are PIDs generated?
Problem
On *nix, PIDs are unique identifiers for running processes. How are PIDs generated? Is it just an integer which gets incremented? Or is it a more complex structure such as a list? How do they get recycled? By recycling, I mean that, when a process terminates, its PID will eventually be reused by another process.
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Fix for: How are PIDs generated?
As wikipedia says, Under Unix, process IDs are usually allocated on a sequential basis, beginning at 0 and rising to a maximum value which varies from system to system. Once this limit is reached, allocation restarts at zero and again increases. However, for this and subsequent passes any PIDs still assigned to processes are skipped. so it's really a very simple policy for "generation", just increment a counter, and "recycling", just wrap the number around at a max value and keep incrementing u…
Awaiting Verification
Be the first to verify this fix
Sign in to verify this fix