Dæmon (computer Software)
   HOME

TheInfoList



OR:

In
computing Computing is any goal-oriented activity requiring, benefiting from, or creating computer, computing machinery. It includes the study and experimentation of algorithmic processes, and the development of both computer hardware, hardware and softw ...
, a daemon is a program that runs as a
background process A background process is a computer process that runs ''behind the scenes'' (i.e., in the background) and without user intervention. Typical tasks for these processes include logging, system monitoring, scheduling, and user notification. On a Wind ...
, rather than being under the direct control of an interactive user. Customary convention is to name a daemon process with the letter ''d'' as a suffix to indicate that it's a daemon. For example, is a daemon that implements system logging facility, and is a daemon that serves incoming SSH connections. Even though the concept can apply to many computing systems, the term ''daemon'' is used almost exclusively in the context of
Unix Unix (, ; trademarked as UNIX) is a family of multitasking, multi-user computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, a ...
-based systems. In other contexts, different terms are used for the same concept. Systems often start daemons at
boot A boot is a type of footwear. Most boots mainly cover the foot and the ankle, while some also cover some part of the lower calf. Some boots extend up the leg, sometimes as far as the knee or even the hip. Most boots have a heel that is clearl ...
time that will respond to network requests, hardware activity, or other programs by performing some task. Daemons such as
cron The cron command-line utility is a job scheduler on Unix-like operating systems. Users who set up and maintain software environments use cron to schedule jobs (commands or shell scripts), also known as cron jobs, to run periodically at fixed t ...
may also perform defined tasks at scheduled times.


Terminology

In the context of computing, the word is generally pronounced either as or . The term was coined by the programmers at MIT's Project MAC. According to Fernando J. Corbató, who worked on
Project MAC Computer Science and Artificial Intelligence Laboratory (CSAIL) is a research institute at the Massachusetts Institute of Technology The Massachusetts Institute of Technology (MIT) is a Private university, private research university in ...
around 1963, his team was the first to use the term daemon, inspired by
Maxwell's demon Maxwell's demon is a thought experiment that appears to disprove the second law of thermodynamics. It was proposed by the physicist James Clerk Maxwell in 1867. In his first letter, Maxwell referred to the entity as a "finite being" or a "being ...
, an imaginary agent in physics and
thermodynamics Thermodynamics is a branch of physics that deals with heat, Work (thermodynamics), work, and temperature, and their relation to energy, entropy, and the physical properties of matter and radiation. The behavior of these quantities is governed b ...
that helped to sort molecules, stating, "We fancifully began to use the word daemon to describe background processes that worked tirelessly to perform system chores".
Unix Unix (, ; trademarked as UNIX) is a family of multitasking, multi-user computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, a ...
systems inherited this terminology. Maxwell's demon is consistent with Greek mythology's interpretation of a
daemon A demon is a malevolent supernatural being, evil spirit or fiend in religion, occultism, literature, fiction, mythology and folklore. Demon, daemon or dæmon may also refer to: Entertainment Fictional entities * Daemon (G.I. Joe), a character ...
as a supernatural being working in the background. In the general sense, daemon is an older form of the word "demon", from the
Greek Greek may refer to: Anything of, from, or related to Greece, a country in Southern Europe: *Greeks, an ethnic group *Greek language, a branch of the Indo-European language family **Proto-Greek language, the assumed last common ancestor of all kno ...
δαίμων. In the ''Unix System Administration Handbook''
Evi Nemeth Evi Nemeth (born June 7, 1940 – missing-at-sea June or July 2013) was an engineer, author, and teacher known for her expertise in computer system administration and networks. She was the lead author of the "bibles" of system administration: ''U ...
states the following about daemons: Alternative terms include ''
service Service may refer to: Activities * Administrative service, a required part of the workload of university faculty * Civil service, the body of employees of a government * Community service, volunteer service for the benefit of a community or a ...
'' (used in Windows, from Windows NT onwards, and later also in Linux), ''started task'' (IBM
z/OS z/OS is a 64-bit operating system for IBM z/Architecture mainframes, introduced by IBM in October 2000. It derives from and is the successor to OS/390, which in turn was preceded by a string of MVS versions.Starting with the earliest: ...
), and ''ghost job'' (XDS UTS). Sometimes the more general term ''server'' or ''server process'' is used, particularly for daemons that operate as part of client-server systems. A daemon that connects to a computer network is a
network service In computer networking, a network service is an application running at the network layer and above, that provides data storage, manipulation, presentation, communication or other capability which is often implemented using a client–server or pe ...
. After the term was adopted for computer use, it was incorrectly rationalized as a
backronym A backronym is an acronym formed from an already existing word by expanding its letters into the words of a phrase. Backronyms may be invented with either serious or humorous intent, or they may be a type of false etymology or folk etymology. The ...
for disk and execution monitor.


Implementations


Unix-like systems

In a
Unix-like A Unix-like (sometimes referred to as UN*X, *nix or *NIX) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Uni ...
system, the
parent process In computing, a parent process is a process that has created one or more child processes. Unix-like systems In Unix-like operating systems, every process except (the swapper) is created when another process executes the fork() system call. T ...
of a daemon is often, but not always, the
init In Unix-based computer operating systems, init (short for ''initialization'') is the first process started during booting of the operating system. Init is a daemon process that continues running until the system is shut down. It is the direc ...
process. A daemon is usually created either by the init process directly launching the daemon, by the daemon being run by an initialization script run by init, by the daemon being launched by a
super-server A super-server, sometimes called a service dispatcher, is a type of Daemon (computer software), daemon run generally on Unix-like systems. Usage A super-server starts other Server (computing), servers when needed, normally with access to them ...
launched by init. The init process in
Research Unix Research Unix refers to the early versions of the Unix operating system for DEC PDP-7, PDP-11, VAX and Interdata 7/32 and 8/32 computers, developed in the Bell Labs Computing Sciences Research Center (CSRC). The term ''Research Unix'' first app ...
and
BSD The Berkeley Software Distribution (BSD), also known as Berkeley Unix or BSD Unix, is a discontinued Unix operating system developed and distributed by the Computer Systems Research Group (CSRG) at the University of California, Berkeley, beginni ...
starts daemons from an initialization script. A daemon started as a command in an initialization script must either
fork In cutlery or kitchenware, a fork (from 'pitchfork') is a utensil, now usually made of metal, whose long handle terminates in a head that branches into several narrow and often slightly curved tines with which one can spear foods either to h ...
a child process and then immediately exit, or must be run as a background process using , so that the shell running the initialization script can continue after starting the daemon. In the former case, the daemon process run from the shell exits, thus causing init to adopt the child process that runs as the daemon; in the latter case, when the shell running the initialization script exits, the child daemon process is adopted by init. The versions of init in System III and in
System V Unix System V (pronounced: "System Five") is one of the first commercial versions of the Unix operating system. It was originally developed by AT&T and first released in 1983. Four major versions of System V were released, numbered 1, 2, 3, an ...
can run arbitrary commands and can be configured to run them once or to restart them when they terminate. The former mechanism can be used to run initialization scripts; daemons started from those scripts behave the same as in Research Unix and BSD. The latter mechanism can be used to run daemons directly from init. A daemon can also be launched from a user's command line. However, daemons launched in that fashion typically must perform other operations, such as dissociating the process from any controlling terminal (tty). Such procedures are often implemented in various convenience routines such as ''daemon(3)''. A daemon launched by an initialization script need not do these steps, but doing so allows the daemon to be restarted by a user if it exits; init itself would not restart them. Operations such a daemon must do include: * Optionally removing unnecessary variables from environment. * Executing as a background task by forking and exiting (in the parent "half" of the fork). This allows daemon's parent (shell or startup process) to receive exit notification and continue its normal execution. * Detaching from the invoking session, usually accomplished by a single operation, setsid(): ** Dissociating from the controlling tty. ** Creating a new session and becoming the session leader of that session. ** Becoming a
process group In a POSIX-conformant operating system, a process group denotes a collection of one or more processes. Among other things, a process group is used to control the distribution of a signal; when a signal is directed to a process group, the signal ...
leader. * If the daemon wants to ensure that it will not acquire a new controlling tty even by accident (which happens when a session leader without a controlling tty opens a free tty), it may fork and exit again. This means that it is no longer a session leader in the new session, and cannot acquire a controlling tty. * Setting the
root directory In a Computing, computer file system, and primarily used in the Unix and Unix-like operating systems, the root directory is the first or top-most Directory (computing), directory in a hierarchy. It can be likened to the trunk of a Tree (data st ...
() as the current
working directory In computing, the working directory of a process is a directory of a hierarchical file system, if any, dynamically associated with the process. It is sometimes called the current working directory (CWD), e.g. the BSD getcwd function, or just c ...
so that the process does not keep any directory in use that may be on a
mounted Mount is often used as part of the name of specific mountains, e.g. Mount Everest. Mount or Mounts may also refer to: Places * Mount, Cornwall, a village in Warleggan parish, England * Mount, Perranzabuloe, a hamlet in Perranzabuloe parish, Co ...
file system (allowing it to be unmounted). * Changing the
umask umask is a shell command that reports or sets the mask value that limits the file permissions for newly created files in many Unix and Unix-like file systems. A system call with the same name, , provides access to the mask value stored in the ...
to 0 to allow open(), creat(), and other operating system calls to provide their own permission masks and not to depend on the umask of the caller. * Redirecting
file descriptor In Unix and Unix-like computer operating systems, a file descriptor (FD, less frequently fildes) is a process-unique identifier (handle) for a file or other input/output resource, such as a pipe or network socket. File descriptors typically h ...
s 0, 1 and 2 for the
standard streams In computer programming, standard streams are preconnected input and output communication channels between a computer program and its environment when it begins execution. The three input/output (I/O) connections are called standard input (stdin), ...
(
stdin In computer programming, standard streams are preconnected input and output communication channels between a computer program and its environment when it begins execution. The three input/output (I/O) connections are called standard input (stdin), ...
,
stdout In computer programming, standard streams are preconnected input and output communication channels between a computer program and its environment when it begins execution. The three input/output (I/O) connections are called standard input (stdin), ...
and
stderr In computer programming, standard streams are preconnected input and output communication channels between a computer program and its environment when it begins execution. The three input/output (I/O) connections are called standard input (stdin), ...
) to or a
logfile In computing, logging is the act of keeping a log of events that occur in a computer system, such as problems, errors or broad information on current operations. These events may occur in the operating system or in other software. A message or ...
, and closing all the other file descriptors inherited from the parent process. If the process is started by a
super-server A super-server, sometimes called a service dispatcher, is a type of Daemon (computer software), daemon run generally on Unix-like systems. Usage A super-server starts other Server (computing), servers when needed, normally with access to them ...
daemon, such as , , or , the super-server daemon will perform those functions for the process, except for old-style daemons not converted to run under and specified as and "multi-threaded" datagram servers under .


MS-DOS

In
MS-DOS MS-DOS ( ; acronym for Microsoft Disk Operating System, also known as Microsoft DOS) is an operating system for x86-based personal computers mostly developed by Microsoft. Collectively, MS-DOS, its rebranding as IBM PC DOS, and a few op ...
, daemon-like functionality was implemented as a
terminate-and-stay-resident program A terminate-and-stay-resident program (commonly TSR) is a computer program running under DOS that uses a system call to return control to DOS as though it has finished, but remains in computer memory so it can be reactivated later. This techni ...
(TSR).


Windows

In
Windows Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
, a
Windows service In Windows NT operating systems, a Windows service is a computer program that operates in the background. It is similar in concept to a Unix daemon. A Windows service must conform to the interface rules and protocols of the Service Control Manag ...
provides the functionality of a daemon. It runs as a process, usually does not interact with the user (i.e. via monitor, keyboard, or mouse) and may be launched by the operating system at boot time. In
Windows 2000 Windows 2000 is a major release of the Windows NT operating system developed by Microsoft, targeting the server and business markets. It is the direct successor to Windows NT 4.0, and was Software release life cycle#Release to manufacturing (RT ...
and later versions, a Windows service is configured and controlled via various interfaces including the Control Panel, the Service Control Manager command, the and commands,
PowerShell PowerShell is a shell program developed by Microsoft for task automation and configuration management. As is typical for a shell, it provides a command-line interpreter for interactive use and a script interpreter for automation via a langu ...
, or a custom program. However, any Windows application can perform the role of a daemon, not just a service, and some Windows daemons have the option of running as a normal process.


Mac

In
classic Mac OS Mac OS (originally System Software; retronym: Classic Mac OS) is the series of operating systems developed for the Mac (computer), Macintosh family of personal computers by Apple Computer, Inc. from 1984 to 2001, starting with System 1 and end ...
, optional features and services were provided by system extensions and
control panels Control may refer to: Basic meanings Economics and business * Control (management), an element of management * Control, an element of management accounting * Comptroller (or controller), a senior financial officer in an organization * Controlling ...
files loaded at startup time that patched the operating system. Later versions of classic Mac OS augmented these with faceless background applications: regular applications that ran in the background. To the user, these were still described as regular system extensions. The more modern
macOS macOS, previously OS X and originally Mac OS X, is a Unix, Unix-based operating system developed and marketed by Apple Inc., Apple since 2001. It is the current operating system for Apple's Mac (computer), Mac computers. With ...
, which is
Unix Unix (, ; trademarked as UNIX) is a family of multitasking, multi-user computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, a ...
-based, uses daemons but uses the term "services" to designate software that performs functions selected from the
Services menu The Services menu (or simply Services) is a user interface element in macOS. The services are programs that accept input from the user selection, process it, and optionally put the result back in the clipboard. The concept originated in the NeXTST ...
, rather than using that term for daemons, as Windows does.


See also

*
List of computer term etymologies This is a list of the origins of computer-related terms or terms used in the computing world (i.e., a list of computer term etymologies). It relates to both computer hardware and computer software. Names of many computer terms, especially compu ...
* List of Unix daemons * Service wrapper * Software bot *
User space A modern computer operating system usually uses virtual memory to provide separate address spaces or regions of a single address space, called user space and kernel space. This separation primarily provides memory protection and hardware prote ...
*
Web service A web service (WS) is either: * a service offered by an electronic device to another electronic device, communicating with each other via the Internet, or * a server running on a computer device, listening for requests at a particular port over a n ...
*
Windows service In Windows NT operating systems, a Windows service is a computer program that operates in the background. It is similar in concept to a Unix daemon. A Windows service must conform to the interface rules and protocols of the Service Control Manag ...


References


External links

* {{Webarchive, url=https://web.archive.org/web/20191030233137/http://www.enderunix.org/docs/eng/daemon.php , title=Unix Daemon Server Programming , date=2019-10-30 Process (computing) Servers (computing)