Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • With PIDs cycling through 2^22 values, will the probability of any given PID being reused be significant? I'm having a hard time seeing 2^22 as a small space. Commented Aug 28 at 19:39
  • @doneal24 you're off the mark, 2²² is a very small space! Check the extension to my answer (and if you feel like it, check my math!) Commented Aug 28 at 23:42
  • Your math is correct but I see two issues with your conclusion. First it assumes that PIDs are generated randomly, not sequentially. Second, the reused PID must still be in use at the time of the kill to have any effect. At 100 PID/s, a PID will be reused after 11 hours - a reasonably short time. But with PIDs being generated at that rate, I would expect the lifetime of an arbitrary process, such as a mail filter, would be quite short, possibly measured in seconds. The situation then is that the kill script will wait 11 hours, then have a few seconds to kill the wrong process. Commented Aug 29 at 12:23
  • @doneal24 thinking adversarially, "sequentially" is not any better than uniformly random in this case, right? That just means that a different user can drive up the PID count with intent to make it more likely that your own user kills your process they want you to kill. That's why I chose the random uniform assumption as "better than reality" case. (in my scenario it's that your user has "fast" and "long-living" tasks, and the short-lived ones are the ones that get killed, and you'd want to make sure you don't accidentally kill a long-term task that gets started while you're churning) Commented Aug 29 at 12:45