What really is kthreadd (PID=2)?
In chapter 3, page 6 creating processes, the course states that kthreadd (PID=2) purpose is to adopt orphaned processes.
I'm running ArchLinux with kernel 5.13 and all the processes with PPID=2 as reported with ps axjf are reported in square brackets, i assume they are kernel threads?
I also see many processes with PPID=1 (/sbin/init, that is a symlink to systemd), for example tmux and ssh-agent have PPID=1. I was expecting them to be have kthreadd as the parent, not init.
So, when does init adopt a process and when does kthreadd adopts?
Is there a documentation/man about kthreadd somewhere? I could not find it.
Comments
-
If you examine the list you will see all [ ] processes have ppid=2 (kthreadd) while all user space processes may have ppid=1 (systemd/init). kthreadd is actually the internal kernel thread that is used in kernel code with functions like kthread_create() to create these kernel threads or adopt them. Perhaps the wording is not the best, I will investigate. thanks
as far as documentation about kthreadd goes, http://www.tovantran.com/blog/?p=2591 is one simple (but dated) explanation,
0 -
Hi @coop,
Thanks for the explanation and the link.
There's also a similar statement in page 8 (Process States):
If the parent of any process dies, the process is adopted by init (PID = 1) or kthreadd (PID = 2).
Do you think it is possible to amend/update these pages with a clearer explanation about which process adopts orphans?
Is there a place that I can suggest/submit changes?
0
Categories
- All Categories
- 177 LFX Mentorship
- 177 LFX Mentorship: Linux Kernel
- 756 Linux Foundation IT Professional Programs
- 375 Cloud Engineer IT Professional Program
- 171 Advanced Cloud Engineer IT Professional Program
- 74 DevOps IT Professional Program - Discontinued
- 5 DevOps & GitOps IT Professional Program
- 100 Cloud Native Developer IT Professional Program
- 7.6K Training Courses & Learning Paths
- 3 AI & ML Training
- 1 Blockchain & Decentralized Identity Training
- 10 Cloud & Containers Training
- 1 Cybersecurity Training
- 2 DevOps & Site-Reliability Training
- 1 Linux Kernel Development Training
- 1 Networking Training
- 2 Open Source Best Practice Training
- 2 System Administration Training
- 1 System Engineering Training
- 1 Web & Application Development Training
- 796 Hardware
- 202 Drivers
- 68 I/O Devices
- 37 Monitors
- 95 Multimedia
- 173 Networking
- 91 Printers & Scanners
- 91 Storage
- 770 Linux Distributions
- 81 Debian
- 68 Fedora
- 23 Linux Mint
- 13 Mageia
- 24 openSUSE
- 150 Red Hat Enterprise
- 31 Slackware
- 13 SUSE Enterprise
- 356 Ubuntu
- 465 Linux System Administration
- 31 Cloud Computing
- 73 Command Line/Scripting
- Github systems admin projects
- 98 Linux Security
- 78 Network Management
- 101 System Management
- 46 Web Management
- 113 Mobile Computing
- 20 Android
- 78 Development
- 1.2K New to Linux
- 1K Getting Started with Linux
- 394 Off Topic
- 121 Introductions
- 182 Small Talk
- 30 Study Material
- 984 Programming and Development
- 310 Kernel Development
- 656 Software Development
- 1K Software
- 391 Applications
- 182 Command Line
- 5 Compiling/Installing
- 68 Games
- 318 Installation
- Archived
- 2 LFD140 Class Forum
- 1.4K LFS258 Class Forum
Upcoming Training
-
August 20, 2018
Kubernetes Administration (LFS458)
-
August 20, 2018
Linux System Administration (LFS301)
-
August 27, 2018
Open Source Virtualization (LFS462)
-
August 27, 2018
Linux Kernel Debugging and Security (LFD440)
