Appendix: PID collision probabilities
It's been brought to my attention that people doubt the "PIDs can collide" argument, quoting a space of 2²² possible PIDs.
Collision between any two PIDs chosen (Birthday Problem)
That is a rather small space. Making the assumption that every one of these PIDs is chosen equally likely (thus, modelling things better than they are), we hit the expected number of newly chosen PIDs before we get the first collision between any two PIDs after trying but approximately 1.25·√(2²²) = 1.25 · 2¹¹ = 2560 PIDs.
Collision between one specific PID and a later chosen PID
Even if we just say
I don't care whether there's any collision, I want the time where it becomes more likely that we have a collision this one particular PID than that we have no collision
(which is very valid!), then we can do the following:
The probability to not have a collision is (2²²-1) out (2²²) for every newly chosen PID,
P = (2²²-1)/(2²²)=1 - 2⁻²².
Now, the probability of not choosing our desired PID twice in a row is P². The probability for not choosing it n times in a row is Pⁿ. So. If we want to know
at the point where Pⁿ = 50% = 0.5, what's the n?
We apply the logarithm to both sides of the equation Pⁿ = 0.5, and get
log(Pⁿ)=log(0.5)
Then, thanks to logarithm arithmetic rules
log(Pⁿ) = n·log(P) = log(0.5),
we divide by log(P) and get n=log(0.5)/log(P), which is, rounded, n=2907270.
Times to collisions
If we assume that our servers spawns but 10 new processes per second (which isn't even much for a desktop usage, and very little for something that might e.g. spawn an image converter, or process emails through filters etc), we get:
| Case | number of PIDs before expected collision | time to expected collision at 10 PID/s | … at 100 PID/s | 
|---|---|---|---|
| Collision between any two PIDs | 2560 | 256 s, i.e., < 5 minutes | < 30s | 
| Collision with a fixed PID | 2907270 | 290727 s, i.e., 80 hours 45 minutes | 8 hours | 
 
                