LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Mobile
User Name
Password
Linux - Mobile This forum is for the discussion of all topics relating to Mobile Linux. This includes Android, Tizen, Sailfish OS, Replicant, Ubuntu Touch, webOS, and other similar projects and products.

Notices


Reply
  Search this Thread
Old 05-02-2011, 01:52 AM   #1
pavan8085
LQ Newbie
 
Registered: May 2011
Location: Bangalore, India
Distribution: Ubuntu
Posts: 13

Rep: Reputation: 8
[Android] Multiple /init processes!!


I am working on an Android phone which has Linux Kernel 2.6.35.11. When I generated the boot chart, I can see there are 2 /init processes. One is in sleep almost all the time and the other is doing a lot of processing and was created after around 5 seconds. Also when I plugged in the phone to the PC and ran "adb shell", I saw 3 /init processes!! 2nd one's parent was the first one and the third one's parent was the second /init. All the other major threads were spawned by the third /init process!
Can anyone throw some hints on why are there multiple /init processes??
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 05-09-2011, 05:04 AM   #2
pavan8085
LQ Newbie
 
Registered: May 2011
Location: Bangalore, India
Distribution: Ubuntu
Posts: 13

Original Poster
Rep: Reputation: 8
Hi All,
I found the cause for the above stated multiple /init processes problem. In Android, exec command is implemented a combination of fork()+execv(). So while running exec commands from init.rc, /init process first forks itself and then the resulting child execv()s a new binary. If this execv() fails ( which was the case with me ) and there's is no error checking, then there shall remain 2 processes with the same name ( in this case, 2 /init processes ). We added _exit() for the failed execv() case so that the failed child terminates immediately.
 
2 members found this post helpful.
Old 05-09-2011, 05:16 AM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Thanks for posting back - I was interested in what was happening.
 
Old 05-10-2011, 06:50 AM   #4
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 234Reputation: 234Reputation: 234
Welcome to LQ. I think you're already becoming a valuable contributor here.

Thanks for taking the time to post back your solution.
Thanks for taking the time to mark this "[SOLVED]".
Your "[Android]" tag in the title is a good idea, more folks should use it.

Again, welcome to LQ.
 
  


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
Question about multiple writes from multiple processes rainman1985_2010 Programming 3 10-08-2010 02:39 PM
init : no more processes left in this thread babygajah Linux - Newbie 2 12-11-2008 01:20 AM
Some init processes fail on boot Corbiere Linux - Software 0 03-30-2006 02:04 AM
Tweaking Init processes. longnam Debian 2 03-23-2005 09:02 AM
INIT: no more processes left in this runlevel ..:eMa:.. Linux - Newbie 8 10-29-2003 11:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Mobile

All times are GMT -5. The time now is 12:51 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