3

I am new to Operating Systems (specifically Linux) and this is my first question here

I want to ask, can there be two process with CMD = init (as given by ps - e command).

I had two processes on my laptop with CMD = init (id's 1 (this is default) and 29179). I wrote a c++ program and created a child and waited for parent to exit (orphaned the child) and then checked the child's ppid but it gave 29179.

Here is my C++ program : Prog.cpp (on Ideone all output of stdout is not printed may be the way it is.)

Here is stdout of my C++ Program and output of ps -e on my laptop (Only 2 links allowed) : output

2

Yes. It is possible to have multiple init processes.

In the olden days before Upstart, there was just one init process (where PID = 1).

Now, with Upstart, there's the original init process (where PID = 1).

But, when a user logs in, a new init process is created for that user session. Thus, that is why you see the second init process (where PID != 1).

  • Who is the parent of then this second init process? – Saurabh Jain Feb 27 '15 at 0:21
  • All processes (other than yours) have the parent of the original init (pid = 1). Your processes (user) have the parent of the second init (where pid != 1). – user376787 Feb 27 '15 at 0:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.