LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-31-2005, 01:21 AM   #1
durga324
LQ Newbie
 
Registered: May 2005
Location: india
Posts: 2

Rep: Reputation: 0
question on deamonizing


hi all,

i am having a small doubt about daemonizing.
in case of daemonizing the process which is daemonized will be added to the init process.can anyone explain what is the advantage of adding the process to init process and what is the main purpose of daemonizing except for background running.
 
Old 05-31-2005, 02:57 AM   #2
meDream
Member
 
Registered: Jan 2005
Distribution: Mandrake 10.1
Posts: 47

Rep: Reputation: 15
My opinion is, that you put the those process in init taht you want automatically to be run everytime you start your maschine.

with other words i put in the init proccess things that i need all the time to be run and are not the part of the sys the are not esential for the sys but whit them it runs more eficient

that's how i look to those things
 
Old 05-31-2005, 03:34 AM   #3
kees-jan
Member
 
Registered: Sep 2004
Distribution: Debian, Ubuntu, BeatrIX, OpenWRT
Posts: 273

Rep: Reputation: 30
Hi,

When you normally run something in the background, and it does some output, then the output is shown on your terminal, possibly messing up your screen.

daemonizing is something you do to a process for which you don't care for such output, or a process that should still be running after you logged out or something. It is, kind of, like running a windows service.

When any process terminates, it has a return value (called "exit status"). This exit status must be read by someone, otherwise the process will not go a way (it will become a "zombie"). Reading the exit status is the responsibility of the parent process (i.e. the process that started the process that is now exiting), because it knows exactly which processes it started and what the exit status means.

However, when the parent process terminates first, then it is no longer around to read the exit status of the child process. When this happens, reading the childs exit status becomes the responsability of the "init" process. The init process never exits, and therefore can always read other processes exit statusses. Because init doesn't know what the exit status means, it ignores it. It just reads the exit status for cleanup purposes.

When daemonizing, the exact same thing happens: the actual process is started in the background, and then the parent dies. Therefore, when the daemon process terminates, its exit status is read by init. In a sense, you could say the process is "added to init".

Usually, when people talk about "adding something to init" it usually means that the process is actually started by the init process when the system boots. This is something entirely different (which caused some confusion with the previous poster), although most such processes are daemonized, and therefore their exit status will be read by init as well.

Groetjes,

Kees-Jan
 
Old 05-31-2005, 12:09 PM   #4
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
Moved: This thread is more suitable in Linux-General and has been moved accordingly to help your thread/question get the exposure it deserves.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Question, Apples Contribution to Open Source + MacOs file structure question Higgy3k Other *NIX 5 07-25-2005 04:23 AM
Not your regular GRUB question - just a short question for a fried MBR!! ziphem Linux - General 3 01-31-2005 01:51 PM
2 part question: Speeding up MDK9.1/GNOME question wardialer Linux - Newbie 6 10-14-2004 03:16 PM
login prompt question & kde scheme question JustinCoyan Slackware 2 06-09-2004 02:02 PM
RE: Suse 8.0 hardware question {newbie question, pls help} Radiouk Linux - Distributions 2 06-04-2002 12:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:49 AM.

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