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*
-
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.doneal24– doneal242025-08-28 19:39:53 +00:00Commented 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!)Marcus Müller– Marcus Müller2025-08-28 23:42:49 +00:00Commented 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.doneal24– doneal242025-08-29 12:23:14 +00:00Commented 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)Marcus Müller– Marcus Müller2025-08-29 12:45:48 +00:00Commented Aug 29 at 12:45
Add a comment
|
How to Edit
- Correct minor typos or mistakes
- Clarify meaning without changing it
- Add related resources or links
- Always respect the author’s intent
- Don’t use edits to reply to the author
How to Format
-
create code fences with backticks ` or tildes ~
```
like so
``` -
add language identifier to highlight code
```python
def function(foo):
print(foo)
``` - put returns between paragraphs
- for linebreak add 2 spaces at end
- _italic_ or **bold**
- indent code by 4 spaces
- backtick escapes
`like _so_` - quote by placing > at start of line
- to make links (use https whenever possible)
<https://example.com>[example](https://example.com)<a href="https://example.com">example</a>
How to Tag
A tag is a keyword or label that categorizes your question with other, similar questions. Choose one or more (up to 5) tags that will help answerers to find and interpret your question.
- complete the sentence: my question is about...
- use tags that describe things or concepts that are essential, not incidental to your question
- favor using existing popular tags
- read the descriptions that appear below the tag
If your question is primarily about a topic for which you can't find a tag:
- combine multiple words into single-words with hyphens (e.g. shell-script), up to a maximum of 35 characters
- creating new tags is a privilege; if you can't yet create a tag you need, then post this question without it, then ask the community to create it for you
lang-bash