Can pkill guarantee the following situation never happens:
I use pkill -f "abc"
pkill finds process by name and remembers pid
process ends
Linux starts a new process with the same pid
pkill kills the process started at step 4
Can pkill guarantee the following situation never happens:
I use pkill -f "abc"
pkill finds process by name and remembers pid
process ends
Linux starts a new process with the same pid
pkill kills the process started at step 4
Copyright © 2021 Jogjafile Inc.
Pids do wrap and do eventually get reused. However, pids assigned to recently running processes are not soon reused. so, in practice the problem you're worried about never happens. It is theoretically possible as far as I can tell. However, that would mean that
It's possible there is some way of attacking pkill so it's that slow, but such an attack would almost certainly be a kernel bug. I've never been in a situation where worrying about this problem was the right design decision.