Am 26.09.23 um 18:12 schrieb Alessandro Baggi:
Il 26/09/23 17:30, Claudio Jeker ha scritto:
On Tue, Sep 26, 2023 at 05:13:46PM +0200, Andreas Kähäri wrote:
On Tue, Sep 26, 2023 at 04:59:22PM +0200, Alessandro Baggi wrote:
Hi list,
running this python3 script:
#!/usr/bin/env python3
import psutil
pids = psutil.pids()
for i in pids:
p = psutil.Process(i)
with p.oneshot():
print(str(i) + " " + p.name())
The result start with:
0 swapper
1 init
536 smtpd
868 ksh
...
This process does not appear in ps, top and htop.
$ ps -p 0
PID TT STAT TIME COMMAND
0 ?? DK 0:02.19 (swapper)
For top, you need to press S to show system processes. I don't use
htop, but I assume it has a similar capability to show system processes.
How could be that there is a process with PID 0 before init?
Probably I'm missing something about OpenBSD core.
Can someone point me in the right direction?
See uvm_init(9):
The swapper process swaps in runnable processes that are
currently swapped out, if there is room.
... and this is a lie. The swapper process does nothing.
Ok, but why it is running?
My guess without looking at the code is that it's an "idle" process,
it runs if there is nothing else to run and maybe does something like:
loop:
hlt ; wait for interrupt
jmp loop
It would make sense, but please correct me if I'm wrong.