Daemon
lastmod 2022-07-18created 2015-05-079 edits
In a multitasking operating system, a daemon (pronounced /'deɪmən/ or /'dimən/[1]) is a program that runs in the background performing various tasks without being directly controlled by the user. Like syslogd, which writes system logs, it usually has a ‘d’ at the end of its name to indicate a daemon, and it typically runs as a process.
A daemon usually has no parent process, i.e. its PPID is 0, and so it sits directly under init in the process tree. A program typically becomes a daemon by forking a child process and then killing itself after the fork, so that init adopts the orphaned child process under itself. This method is sometimes called ‘fork off and die’.
The system often starts daemons at boot, and these daemons handle responding to network requests, hardware activity, and other programs. They are also used for various other purposes, such as hardware configuration like devfsd on some Linux systems, or running periodic tasks like cron.
About
Citing Richard Stevens's Unix Network Programming, the conditions of a unix daemon are described as follows.
- Close all open file descriptors.
- Change the current working directory
- Reset the file creation mask
- Run in the background
- Detach from the process group
- Ignore terminal I/O signals
- Detach from the controlling terminal
- Correctly handle the following situations
- Started by the System V init process.
- Terminated by the SIGTERM signal
- Child processes generate the SIGCLD signal
List of Daemon
| Daemon name | Description |
| Network Manager | Automatically switches the network connection to the best available connection |
| acpid | Receives and handles ACPID events from the kernel |
| anacron | Runs cron jobs left over until downtime |
| apmd | Monitors and logs battery status (syslog(8)) |
| atd | Performs background jobs or handles scheduled commands |
| autofs | Automatically mounts when files on a server are read |
| crond | Periodically runs commands registered in Linux |
| diskdump | Saves a dump file on a system crash or diskdump module initialization |
| echo | Sends echo character values to the client |
| eklogin | Daemon that encrypts using Kebelos 5 |
| gpm | Mouse support for text-based Linux applications |
| gssftp | Kerberized ftp server, encrypts using Kerberos 5 |
| haldeamon | Collects and maintains information about hardware from sources |
| iptables | Linux firewall iptables daemon |
| irqbalance | Distributes printer jobs |
| idsn | Configures ISDN services |
| klogin | Kebelos 5 authentication, sets up dsd-type rlogin sessions |
| kudzu | Hardware detection daemon |
| mdmonitor | Handles RAID monitoring and management |
| mdmpd | Multipath device monitoring and management |
| messagebus | Notifies of system events and other messages |
| netdump | Initializes the netconsol and netcrashdump components |
| netfs | Mounts/unmounts NFS, SMB/CIFS, NCP, etc. |
| netplugd | Manages non-static network interfaces |
| network | Enables or disables network interfaces configured at boot |
| nfs | File sharing over tcp, used when running an nfs server on Linux |
| nfslock | Used to prevent access by multiple users when running an nfs server |
| NTPD | ntp V4 daemon, used for time synchronization |
| portmap | RPC connection management daemon (NFS, NIS) |
| psacct | Used to start/stop descriptions of processes |
| rawdevices | Maps raw devices to block devices |
| rpcgssd | Starts a user-level daemon, manages RPCSEC for NFSv4 clients |
| rpcidmapd | User-level daemon, maps user uid and gid values |
| rsync | Daemon used for sync |
| saslauthd | Daemon that handles authenticated requests |
| sendmail | Mail server daemon |
| smartd | Self-monitoring and reporting |
| snmpd | Simple Network Management Protocol daemon |
| snmptrapd | snmpd trap daemon |
| sshd | open-ssh daemon |
| syslog | Log daemon |
| time | RFC 868 time server daemon |
| uncserver | uncserver configuration |
| winbind | SAMBA winbind daemon |
| xfs | X-window font daemon |
| xinetd | Super daemon that manages various services |
| ypbind | NIS daemon |
See also
Favorite site
Programming
- Things to know when creating a Daemon 1
- How to create a Windows service (using Sc.exe)
- KLDP - Question - How do I run in the background without a DOS window appearing?
- Win32 Service - #2 Creating a service (see 'Mastering the Windows API')
- Win32 API – Registering, unregistering, starting, and stopping Windows services
- Building a C++ service program
References
-
Things_to_know_when_creating_Daemon.pdf ↩