12

Is there a difference between a daemon and a service?

Or are they both basically an application that is resident in memory, and is bound to a specific port and listens/responds to requests?

1

4 Answers 4

10

Daemons and Services are not the same.

A "Service" could refer to either a Daemon or a Service.

A daemon is a subset of services that always run in memory waiting to service a request.

A non-daemon service generally is handled by xinetd. xinetd listens for the request, then starts the required service to handle the request. After the request has been serviced the service is then stopped again.

Typical non-daemon services: rsync vsftpd

Typical daemonized services: MySQL Apache

4
  • 1
    xinetd was created to serve other services to conserve resources, but doesn't make them non-daemons. your example of non-daemons includes a deaemon...vsftpd ends in d because it's convention (but not required) to name unix deamons with a d at the end to stand for Daemon....the vsftp-daemon :-) Apr 3, 2010 at 20:06
  • Also see askubuntu.com/a/192142/344328
    – Pacerier
    Dec 24, 2014 at 13:54
  • Do you still use xinitd today? I guess xinitd makes more trouble than it does help (today).
    – guettli
    Aug 7, 2019 at 13:50
  • While working on a feature that required understanding this question, I hit a clear case where despite all signs pointing to NetworkManager being a daemon (started by PID 1, systemctl status NetworkManager reports enabled, active), when I looked at the ps raw data, I saw that it has been started with the --no-daemon flag. So clearly it's running as a service, but not a daemon. My understanding is that daemons are not interactive. That's what I'm going on anyway since I could not call something explicitly statrted with --no-daemon a daemon.
    – Lizardx
    Feb 5 at 19:21
13

daemons and services are one in the same.

However, neither have to be bound to a port. HALd is a daemon, that monitors plugged in hardware and mounts it properly. crond is a daemon that keeps the trains on time.

2
  • so then they are usually bound to a port, or OS level events?
    – Blankman
    Apr 3, 2010 at 14:29
  • 2
    @Blankman: a daemon has a job to do - you don't run one if it doesn't. It has to get inputs from somewhere; a common source is the network, but it could be elapsed time (cron) or the various peripheral connection buses (HALd) or ... Apr 3, 2010 at 14:37
3

Yes - daemons run on Unix-like boxes, and services run on Windows.

Once upon a decade ago, daemons kept going indefinitely and services didn't.

Once upon a couple of decades ago, daemons didn't keep going indefinitely either.

So, really, I meant No - there isn't a significant difference between services and daemons.

Note that 'cron' is a daemon; it is not bound to the network at all.

1
  • 4
    conceptually they're the same. System programs that perform some background task not attached to a particular logged-in user... Apr 3, 2010 at 14:42
1

Since all major linux distributions use systemd today, it is feasible to look up what systemd says about it:

from man systemd

systemd is a system and service manager for Linux operating systems.

...

Service units, which start and control daemons and the processes they consist of. For details, see systemd.service(5).

...

systemctl daemon-reexec (does restart systemd)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .