On Tue, Sep 26, 2023 at 06:12:20PM +0200, Alessandro Baggi wrote:
> 
> 
> 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?

Because it is the main() thread and nobody cleaned up that mess.

-- 
:wq Claudio

Reply via email to