LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 10-03-2014, 10:31 AM   #1
gundog126
LQ Newbie
 
Registered: Oct 2014
Posts: 8

Rep: Reputation: Disabled
What happens to init after the first call?


Where does it go? Are kthread and ksoftirq the next two threads on all boxes or just mine ?
 
Old 10-03-2014, 12:48 PM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,289

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
It doesn't go anywhere. Those processes show on my system too - I imagine they are kernel related.
 
Old 10-06-2014, 11:01 AM   #3
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939
You are seeing two entirely different things:

init (a.k.a. "Process #1") is a user-level process that is hand-built by the kernel during system startup ... and that is never allowed to die. It performs fundamental services for the system, including being the "grim reaper" of any other user-land process whose parents have died. (The orphans are briefly parented to this process so that it can clean them up, thereby neatly avoiding what would otherwise be a special-case of "cleaning up a process that has no parent." The processes are given a parent, and that parent is never allowed to not be there.)

(If init ever does die, you get the mis-named message: "Kernel panic ... tried to kill init." That's what that message actually means.)

Meanwhile ...

The various processes and threads that you see whose names begin with the letter k and which are owned by uid #0 are: kernel threads. These are, literally, "parts of the kernel," which are executing (under very special and highly-privileged conditions ...) "as 'ordinary,' 'pre-emptible,' processes." This allows them to be asynchronous, as they need to be to do whatever-it-is that they do, while "bending as few rules as possible." These "parts of the kernel" are able to run "under the auspices of the kernel," and thus to avail themselves of many of the kernel-provided services that are available to userland, without being "a massive special-case."
 
1 members found this post helpful.
Old 10-06-2014, 11:16 AM   #4
gundog126
LQ Newbie
 
Registered: Oct 2014
Posts: 8

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by sundialsvcs View Post
You are seeing two entirely different things:

init (a.k.a. "Process #1") is a user-level process that is hand-built by the kernel during system startup ... and that is never allowed to die. It performs fundamental services for the system, including being the "grim reaper" of any other user-land process whose parents have died. (The orphans are briefly parented to this process so that it can clean them up, thereby neatly avoiding what would otherwise be a special-case of "cleaning up a process that has no parent." The processes are given a parent, and that parent is never allowed to not be there.)

(If init ever does die, you get the mis-named message: "Kernel panic ... tried to kill init." That's what that message actually means.)

Meanwhile ...

The various processes and threads that you see whose names begin with the letter k and which are owned by uid #0 are: kernel threads. These are, literally, "parts of the kernel," which are executing (under very special and highly-privileged conditions ...) "as 'ordinary,' 'pre-emptible,' processes." This allows them to be asynchronous, as they need to be to do whatever-it-is that they do, while "bending as few rules as possible." These "parts of the kernel" are able to run "under the auspices of the kernel," and thus to avail themselves of many of the kernel-provided services that are available to userland, without being "a massive special-case."

Thanks for the great explanation. I'm trying to understand this a little better. Books have vague info. init is still the first kernel thread correct? And kxx are threads that init initialized. when I say where does init go, I am referring to CPU_idle. Does init go here and call a function then become k_init?
 
Old 10-06-2014, 11:19 AM   #5
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
Fwiw: systemd will be process 1, pretty much from here out. I personally wouldn't spend too much time learning about init, since it's in the process of being deprecated.
 
1 members found this post helpful.
Old 10-06-2014, 11:44 AM   #6
gundog126
LQ Newbie
 
Registered: Oct 2014
Posts: 8

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by szboardstretcher View Post
Fwiw: systemd will be process 1, pretty much from here out. I personally wouldn't spend too much time learning about init, since it's in the process of being deprecated.
Thanks. I'm guessing thus is why my box didn't match up to the books I an using. Systemmd seems to change be more relevant. A but off topic but is there a way I can edit start_kernel() and setup.c in a kernel I didn't compile myself? I don't have source/arch/x86/kernel/setup.c.
 
Old 10-06-2014, 11:58 AM   #7
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018
sysvinit is not deprecated. systemd is just one of a number of alternatives. It may end up that systemd becomes the most commonly used and supported, but that doesn't deprecated any of the others any more than Ubuntu deprecates debian, or mint deprecates ubuntu.

Besides, unlike systemd, the time needed to learn about sysvinit is trivial, so why not learn it.
 
1 members found this post helpful.
Old 10-06-2014, 12:23 PM   #8
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
Quote:
Originally Posted by GazL View Post
sysvinit is not deprecated. systemd is just one of a number of alternatives. It may end up that systemd becomes the most commonly used and supported, but that doesn't deprecated any of the others any more than Ubuntu deprecates debian, or mint deprecates ubuntu.

Besides, unlike systemd, the time needed to learn about sysvinit is trivial, so why not learn it.
No, thats fine. I agree with you. Learning both can't hurt.

But, I disagree with the first part. First off, I didnt say it IS deprecated, I said that it is in the process of BEING deprecated. And this is true. You can mince words and say that systemd is an 'alternative' but the fact is that it is replacing sysvinit as the standard.

Most of the major distros have already switched, and more will follow suit.

Debian, Ubuntu, RHEL, Fedora, Suse,.. All systemd. And since MOST distros are based on these, you can bet that within X years, systemd will be the standard. Sysv will be unmaintained and forgotten eventually.

The argument can be made that 'alternatives' will spring up and be used. And this is true. But they will NOT be in the majority, and will not be considered the STANDARD.

So I believe that my suggestion to concentrate on Systemd is a good suggestion based in reality. But as mentioned, learning sysv can't hurt, especially since you will still run into systems that use it for a long while. For this i suggest debians outstanding guide: https://www.debian.org/doc/manuals/d...e/ch03.en.html

Last edited by szboardstretcher; 10-06-2014 at 12:26 PM.
 
1 members found this post helpful.
Old 10-06-2014, 12:32 PM   #9
gundog126
LQ Newbie
 
Registered: Oct 2014
Posts: 8

Original Poster
Rep: Reputation: Disabled
If anyone us interested.en.m.wikipedia.org/wiki/Systemd. Has a nice summary of why systemd is a pain.
 
Old 10-06-2014, 06:12 PM   #10
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939
Be that as it may ... (ahem), the fact remains that the Unix/Linux system does rely on certain user-land processes to perform essential-to-the-system services. These processes are "magically created" by the kernel during startup, and the system will grind to an immediate halt ("kernel panic!") if they ever die or fail to start.

And, separate from this idea, there are also "fully asynchronous parts of 'the kernel itself,'" running truly "in kernel space," but thereby able to "wait on" things, or to start I/O operations and sleep until those operations complete, and so on. (Which things are otherwise quite difficult for "the kernel" to do, because of its very unique position.)

You should always keep in mind that "not all Unix/Linux-es are created equal," and so you might at any time find yourself working on an older system that does it one way, and a newer system that does the same thing another way, and the two of them might well be sharing rack-space with one another. In this business, it's important to be aware of both the older and the newer. (Preferably, without judging them . . . )

Last edited by sundialsvcs; 10-06-2014 at 06:14 PM.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
system call from a /init.d/ script not returning correct exit code tomschuring Linux - General 5 10-03-2013 08:38 PM
What is the exact diff between init 1,init S and init s challavijay Linux - Newbie 1 08-05-2010 06:51 AM
Call init script on exception immortaltechnique Linux - Software 1 11-28-2008 01:37 AM
How can i make centos 4.5's system call using vDSO(call *%gs:0x10) instead of int80 tclwp Red Hat 3 08-06-2007 12:07 AM
Does init 5 call startx? linuxlah Linux - General 4 03-04-2003 11:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 12:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration