6 ms·
There is no PID 0, it's a ABI convention just as using a negative PID is a convention to use the PGID instead like kill -9 -1. PIDs start at 1. The Linux kernel
by hi-v-rocknroll 2y ago
There is no PID 0, it's a ABI convention just as using a negative PID is a convention to use the PGID instead like kill -9 -1. PIDs start at 1. The Linux kernel allocates PIDs to kernel threads that are "processes" without a separate address space running in a privileged mode with separate stacks, and generally ignore kill() signals.
Command to get when a Linux box was started as opposed to just running uptime -s:
ps -p 2 -o lstart=
- scottlamb 2y agoOkay. I said approximation, and saying that the approximation is not completely true is not that interesting.
- wzdd 2y agoEven in your own examples 0 means different things. It’s not an approximation, it’s wrong.
- bvaldivielso 2y agoAll models are wrong, some are useful. I found his explanation useful while knowing it was not correct
- helpfulContrib 2y agoBut this statement is wrong and should not be propagated: "pid 0 refers to myself". pid 0 refers to the thing that is running 'myself', not to myself, itself. It is the thing which gave way to allow 'myself' to be executing in the current context. It is more accurate to say "pid 0 is the source of cpu 'attention' which allows myself 'awareness'", as it discovered I was not idle, and granted me power to proceed with processing ..
- echoangle 2y agoBeing slightly wrong is kind of the thing that makes an approximation an approximation
- mrits 2y agoI think generalization would have been a better word but everyone understands what they meant
- deleted 2y ago[deleted]
- usr1106 2y agoWhy not ps -p 1 -o lstart= ? In real life the difference should be rarely visible. And then, did we want to know when it started booting or when it became usable. The latter would be rather tricky (even defining what it exactly meant by that).