29 ms·
Maybe 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
by Karellen 2y ago
Maybe 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.