5 ms·
Wow, this entire article is completely off the mark. 0 is a special value in the POSIX kill function. It denotes every process in the process group of the call
by kazinator 2y ago
Wow, this entire article is completely off the mark.
0 is a special value in the POSIX kill function. It denotes every process in the process group of the caller.
That's it.
(OK, so because of that, a given OS based on POSIX can internally get away with using the value in some ways, to denote some process that nothing in user space would ever know about, let alone try to send a signal to.)
Don't get nerd-sniped! Know the 15 second answer and move on.
- Karellen 2y agoMaybe it was only used as the `all in progress group` sentinel because it was used by the kernel and could never be the pid of a userspace process? There's no reason that Unix couldn't have defined `PID_ALLPROCGRP = -2` instead. I mean, what do you think came first the development of Unix? The pid taken by the kernel thread used for scheduling, or a special value to a syscall when someone realised "hey, maybe being able to kill the entire process group would be handy. What spare values do we have we can use to indicate that?" (And remember, POSIX codified existing practice. Unices don't use pid 0 for a reason because POSIX says so; POSIX says so because that's what Unices did)
- kazinator 2y ago> Maybe it was only used as the `all in progress group` sentinel because it was used by the kernel Ah, but for that we have to long beyond/before Linux. kill(0, signal) existed before a line of Linux was written. Linux followed the existing POSIX spec which gave it PID 0 to do whatever.