Il 26/09/23 17:13, Andreas Kähäri ha scritto:
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.


Thank you for your suggestion.

This processes are real processes, why they are not reported as standard process?

Why python3 psutil() does report only the swapper process and not the other? This is a bug of psutil?



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.


Thank you in advance.

Alessandro.


Reply via email to