What Is a Daemon?
This strange term is a relic of Unix history, but daemons are still in use today. The term is synonymous with the concept of a "service", a task that runs continuously, typically without user interaction.
There are several common examples of daemons, and even if you don’t need to know exactly how they work, it’s at least useful to be able to identify them.
What Is a Daemon?
A daemon or Disk And Execution MONitor is a program that runs as a background process rather than an interactive one. Daemons are common among network tools and system administration tasks. You can control some daemons by sending signals to them.
How Do You Pronounce “Daemon”?
Despite appearances, the word daemon is typically pronounced the same as the word "demon". Rest assured, it has nothing to do with satanic rituals. In fact, the name ultimately derives from Greek mythology and the concept of a guiding spirit, working tirelessly in the background. In this sense, it’s a very apt name!
How Do Daemons Work?
On Unix systems, the term daemon is often used interchangeably with the term background process. In other words, it‘s a process that has been detached from any shell and continues to run non-interactively. A true daemon should also assign itself as the child of the special init process which has the special process ID number 1.
Other typical tasks involved in isolating the daemon include:
- Sandboxing by removing unnecessary variables from its environment.
- Setting the root directory (/) as the process’s current working directory.
- Redirecting file descriptions for input, output, and error to log files or /dev/null.
Other systems, such as Windows and macOS, also use daemons. In the case of Windows, services are the closest equivalent.
What Are Some Common Daemons?
Cron (crond) is a daemon that executes other programs on a schedule. Most Unix systems configure it to run automatically on startup. It wakes once per minute, checks configuration files, and executes any commands set to run during that minute. Cron is clever enough to react to changes to crontab files when they change. You do not need to restart it yourself.
Web servers, such as Apache’s httpd, often run as daemons—it’s what the “d” stands for. The Apache daemon handles incoming requests by creating a pool of child processes to share the load. You can use a helper program, such as apachectl, for easier control over the httpd daemon itself.
Finally, sshd is another common example of a daemon, this time one that handles SSH connections. Again, it normally starts from the boot and stays running indefinitely, relying on signals for certain operations. For example, a SIGHUP signal causes sshd to re-execute itself, reloading its configuration file when it does so.
See also: What Is SSH and What Does It Stand For?
Daemons Are Vital Service Providers
Daemons run continuously, performing vital tasks to keep your computer running. They are often involved when a computer needs to act as a server, acting on behalf of other clients.
Daemons are a vital component of a Linux server. If you’re new to setting a server up, check out our tips for getting started.
via MUO – Feed https://ift.tt/1AUAxdL
September 15, 2021 at 01:03PM