LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-15-2010, 05:25 AM   #1
abhinav4
Member
 
Registered: Jun 2010
Location: India
Distribution: Fedora/Cent OS
Posts: 123

Rep: Reputation: 0
Exclamation Difference between deamon and service in Linux?


It would be of great help if someone can explain me the difference between deamon and service in Linux?
 
Old 06-15-2010, 05:53 AM   #2
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by abhinav4 View Post
It would be of great help if someone can explain me the difference between deamon and service in Linux?
http://www.comptechdoc.org/os/linux/...lservices.html
 
Old 06-15-2010, 05:55 AM   #3
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
Hello and Welcome to LinuxQuestions,

This type of question is easily answered using Google. Furthermore this looks like homework to me, since it's basic knowledge. If it is, then please read the LQ Rules which state that it's against those same rules to post homework.

Kind regards,

Eric
 
Old 06-15-2010, 08:30 AM   #4
tommylovell
Member
 
Registered: Nov 2005
Distribution: Fedora, Redhat
Posts: 372

Rep: Reputation: 101Reputation: 101
Well, it may be homework, but I didn't find Googling it to be very helpful, and I already think I know the answer, so...

In loose terms, typically a daemon is any long running process whose parent process id is '1' (i.e. 'init') and is running without a console (tty).

Daemons can be started from /etc/inittab (that means that init is starting it as the result of a runlevel change - or possibly restarting it if it has ended for some reason). They are also started by "rc startup" scripts. Or you could start one yourself manually with 'nohup' (so when you log off the process continues to run), and usually run as a background job. This sort of breaks the PPID=1, no tty definition above... Daemons are usually thought of as not having a terminal associated with them. They're equivalent to the dos TSR (terminate and stay ready) program, if you want to compare them to ancient inferior technology.

A service is usually something that is started or stopped by an "rc startup" script. (There are two styles of "rc startup", BSD-style and (ATT) System V-style.) As the link in the earlier post alluded to, a service does not necessarily start a daemon. It may just perform some function and then end, not producing a daemon. (The same is true of inittab.)

Google "/etc/inittab linux".

Google "daemon vs service" (I like http://en.wikipedia.org/wiki/Daemon_...er_software%29).

And Google "rc files in linux", but keep in mind there is BSD-style (Slackware and others) and SysV-style (Fedora, Redhat, Debian and others).
 
Old 06-15-2010, 08:43 AM   #5
tsg
Member
 
Registered: Mar 2008
Posts: 155

Rep: Reputation: 30
I always thought (and I could well be wrong) that a service was a function and the daemon the process that provided the service. For example "smtp" is the service and "sendmail" (or "postfix") was the daemon.
 
Old 06-15-2010, 09:15 AM   #6
abhinav4
Member
 
Registered: Jun 2010
Location: India
Distribution: Fedora/Cent OS
Posts: 123

Original Poster
Rep: Reputation: 0
googling does not help me as i am unable to get a clear picture of this like httpd is a deamon but we start it as a service say "service httpd start". And this is not homework, its very basic but important.
 
Old 06-15-2010, 09:15 AM   #7
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,133

Rep: Reputation: 876Reputation: 876Reputation: 876Reputation: 876Reputation: 876Reputation: 876Reputation: 876
i heard that a daemon is a type of service that forks off a new process for each new session and has the potential to take over a system with child processes if no limits are imposed (hence the name).
 
Old 06-15-2010, 09:23 AM   #8
deepclutch
Member
 
Registered: Nov 2004
Distribution: Debian Testing+Sid
Posts: 714
Blog Entries: 1

Rep: Reputation: 33
pstree command will show you how daemons are running.
 
Old 06-15-2010, 09:33 AM   #9
myposts
Member
 
Registered: Jun 2010
Posts: 46

Rep: Reputation: 21
Here... for you

In most cases there's no difference, Daemon is Service, however in general, service may be bigger that daemon. Daemon is a process that is detached from terminal (has no controlling terminal) and provides some service (in windows world it is service). However some so-called services , aka Samba, NFS etc. contain more than one daemon. Daemon usually has configuration file, that describes how it should behave (for example what shares it offers, which connections it allows, security etc). It is in two sentences. You need something like "Learn Linux" dvds by Unix Academy http://www.amazon.com/gp/search/ref=...50&rnid=491286
, they teach stuff like that very well. Also, in many cases daemon reads the configuration file only once during startup, and it must be informed after you altered the configuration (changed something in its configuration file), so you send it a signal like "kill -1" and so on.

Hope it helps.
 
Old 06-15-2010, 02:55 PM   #10
tommylovell
Member
 
Registered: Nov 2005
Distribution: Fedora, Redhat
Posts: 372

Rep: Reputation: 101Reputation: 101
Quote:
i am unable to get a clear picture of this like httpd is a deamon but we start it as a service say "service httpd start".
Aha! "service httpd start" means you are probably running Fedora, Redhat or CentOS. You should update your profile to indicate what distribution you are running. It makes it easier to understand the question posed.

So, you are speaking service in that context (my assumption when I answered earlier).

When httpd starts, it deamonizes itself. So it's started as a service, and is a daemon. If it was started from /etc/inittab (inadvisable), it would still be a daemon, but would not be considered a service.

tsg, not the same service abhinav4 is referring to.

schneidz, a daemon can do that, it doesn't necessarily have to. That is a common characteristic of many daemons, especially network related daemons that benefit from forking off a child process to handle a tcp/ip connection.

'chkconfig --list' will show you how all the services are configured in terms of starting and stopping.

Look at the service 'network', /etc/rc.d/init.d/network. It is a service, starts at the run levels indicated in the chkconfig --list. It does a lot of configuration and setup of the network interfaces, but (at least on my systems) starts no daemons.

Both terms, service and daemon, are often used pretty loosely and interchangeably which causes confusion.

btw, you can look at the 'service' command, as it is a Bourne shell, /sbin/service (at least on Fedora/Redhat/CentOS). It is a shell script for manually starting a service. In SuSE there is no service command and you would instead issue the command '/etc/rc.init/httpd start' to manually start httpd (if that's what the Apache service is called there).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
difference between a TCP based service and a UDP based service ZAMO Linux - General 2 11-21-2008 04:22 AM
Any deamon service for rlogin/rcp ust Linux - Newbie 1 09-12-2008 07:01 AM
what is the difference between service network reload and service network restart ? markraem Linux - Networking 3 11-21-2007 03:08 PM
Deamon Tools error - Service folder error joey52 Fedora 0 04-26-2005 02:13 PM
Help in writing a C program as a service deamon cranium2004 Programming 9 10-28-2004 07:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:45 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration