I am running Ubuntu 20.04. According to https://lwn.net/Articles/531419/ and https://stackoverflow.com/questions/3446727/how-does-linux-determine-the-next-pid/3457108#3457108, assigned PIDs should be sequential. However, that is not the case with my newly created PID namespace where the first process has PID 1 (as it should) and the next process has PID 8. What is strange is that every PID after PID 8 is sequentially assigned.
$ sudo unshare --fork --pid --mount-proc bash
root@anon:/home/anon# ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 9844 3840 pts/2 S 12:13 0:00 bash
root 8 0.0 0.0 11500 3364 pts/2 R+ 12:13 0:00 ps aux
Other processes after are assigned 9, 10, 11 ...
I'm curious why the initial jump from 1 to 8? If there are additional processes being created and killed before ps aux
can be run that are occupying PIDs 2-7, how do I view what those are? I tried viewing /var/log/syslog
but couldn't find anything useful.