Running in the background of Linux systems, daemons are essential for multitasking processes. They exist in other systems, usually under a different name (e.g., Windows services), and they are important for managing resources, security, and task automation. In this article, we’ll dig deeper into daemons and discuss what they are, their types, their benefits, and their role in other systems like macOS and Windows. What is a daemon? } description={ } /> A specific action or event within the system initiates a daemon program when needed. For example, a daemon background process starts running when: The user installs a piece of software on their system A specific service is installed on the server. A daemon computer process usually runs continuously in the background, but if it’s lying dormant, it can occasionally wake up when faced with periodic requests. These commands often come from remote processes. In essence, the OS alerts the daemon to the request. A daemon can then either respond to it on its own or forward the request to another program or process. Let’s say a synchronization daemon computing process is running in the background of a system. Once the user saves a file in a folder, the daemon will detect the action and automatically sync the updated file to a remote server. It will do that automatically for every subsequent instance, ensuring the files are always up to date without user intervention. History of the term daemon As for the word’s history, programmers from MIT’s Project MAC coined the term daemon in 1963. The inspiration came from Maxwell’s demon, a thought experiment that can hypothetically break the second law of thermodynamics. Namely, Maxwell’s demon works tirelessly to control a door between two gas chambers to force fast-moving molecules in one and slow-moving molecules in the other direction. The programmers thought the word would accurately describe a background process that also works nonstop to perform system chores. Ultimately, they chose an older term that refers to a supernatural being from Greek mythology residing among gods and mortals — daemon. It was much later that the acronym “Disk And Execution MONitor” was retrofitted to the term daemon, the acronym that’s still in use today. What are the different types of daemons? Every daemon program can be put into a specific category based on its functionality and purpose. Here are a few standard classifications: System daemons — They manage system-wide functions such as time synchronization and are a part of the operating system. Network daemons — These daemons handle processes related to the device’s network. One example is domain name system (DNS) servers. Device daemons — They handle processes specific to that device (e.g., Bluetooth connectivity). Daemons in different computing systems Daemons require a specific service only an OS can achieve, which is why they differ depending on the operating system. Daemons in Linux: Role and examples Daemons were initially developed for Unix-like operating systems, which means they were designed to be compatible with Unix features. Linux is the most widespread Unix-like system in which we can find daemons today. Daemons in Linux are one of three common types of processes, the other two being interactive and batch processes. Daemons in Linux launch automatically, either during the initialization process of the system. Once it starts, the daemon process stays in a loop — it waits for a request, processes it when it arrives, then continues to wait for another one. Daemons in other operating systems (Windows and macOS) Daemons may have initially been applied in Unix-like systems, but they can still run in any multitasking operating system. Because of that, you’ll find them in other systems, but usually under a different name: In Windows systems, daemons are referred to as Windows services. In macOS systems, daemons are usually called agents. In Windows, daemons typically run on Microsoft Windows NT systems. They execute in processes and don’t normally interact with the monitor, keyboard, or mouse. In many cases, they can launch at system boot. The Control Panel, PowerShell scripting system, and commands like “net stop” and “net start” are typically those that manually start, configure, and stop Windows services. In macOS systems, daemons started as optional services and features within files that started on boot up. They were later expanded into full background applications. {SHORTCODES.blogRelatedArticles} What are the benefits of operating systems using daemons? Operating systems use daemons to automate tasks, manage resources, and enhance security. Daemons in task automationDevelopers can use daemons to automate various routine tasks, including database maintenance, data backups, and log rotation. They are also ideal for scheduling tasks. Daemons in resource managementThe primary purpose of daemons is to manage system resources, enabling better system performance. In essence, they optimize system operation and prevent system leaks. Daemons for enhanced securityDaemons are also capable of improving security. For example, the sshd daemon in Linux creates a secure SSH connection, which lets users transfer files safely and access the system remotely. Common examples of daemons As stated, daemon programs are plentiful, and some of the most popularly used are: Crond — It runs other programs under a predetermined schedule in Linux. Crond typically starts running on system startup and wakes every minute to check configuration files, executing commands set for that time. Init — Once a Unix-like system boots up, init is the first daemon to start running. It’s designed to spawn every other process. Httpd — This “web server daemon” operates in the background, waiting for any incoming request from the server. It uses HTTP and shows online hypertext and multimedia documents. The httpd daemon is always signaled by the TCP/IP stack within the OS. Sshd — This daemon exists in Linux systems and sanctions safe SSH connections. Mysqld — It processes and manages requests for data storage and retrieval. It’s effectively the cornerstone of every MySQL database. Inetd — This daemon monitors internet requests within a specific port number and creates the right server program in response. The name stands for Internet Superserver Daemon, and it exists on many Unix systems. Sendmail — This is an SMTP or mailer daemon that deals with incoming emails. The daemon is run once at system startup and activates whenever the device receives an email. Named — This Linux daemon deals with domain name resolution. Specifically, it rephrases every domain name into an IP address, effectively directing your browser toward the right server. Nfsd — The name stands for network file sharing daemon, which is a daemon program that offers Network File System services. Rsyslogd — The dedicated logger for a system, the rsyslogd daemon collects and processes various log messages. Dhcpd — The daemon provides DHCP services to networks. It gathers host information from the DHCP server and configures the device’s network interface. Portmap/rpcbind — This daemon converts every remote procedure call program number into a port number. These are just some of the more common daemons. Many others exist, each designed to perform a specific command essential to the operations of the processes and programs it supports. Although users can’t control daemons as they do normal processes, they are necessary background processes. Moreover, daemons represent vital knowledge for users interested in background process management.
The main difference between daemons and normal processes lies in their ability to be interacted with. Unlike normal processes, daemons don’t have a control terminal, meaning they can’t respond to user input. ), }, { question: ‘What is the difference between a daemon and a server process?’, answer: ( A daemon process runs in the background, responding to events and actions periodically. On the other hand, a server process completes actions on request because it serves other programs. ), }, { question: ‘Why are Linux services called daemons?’, answer: ( Programmers working on MIT’s Project MAC in 1963 coined the word daemon after being inspired by Maxwell’s demon, the imaginary agent in thermodynamics. ), }, { question: ‘Is a daemon a server?’, answer: ( A daemon is a program, but in client-server models, it fulfills the role of a server. ), }, ]} />