Tuesday, September 26, 2023

Re: OpenBSD 7.3 found a process with PID 0

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.

--
:wq Claudio

No comments:

Post a Comment