Daemon (computer software)

In Unix and other computer multitasking operating systems, a daemon (IPA pronunciation: /'dimən/ or /'deɪmən/[1]) is a computer program that runs in the background, rather than under the direct control of a user; they are usually initiated as processes. Typically daemons have names that end with the letter "d" (for example, syslogd, the daemon that handles the system log, or sshd, which handles the incoming SSH connections).

In a Unix environment, the parent process of a daemon is often (but not always) the init process (PID=0). Processes usually become daemons by forking a child process and then having their parent process immediately exit, thus causing init to adopt the child process. This is a somewhat simplified view of things, naturally, as other operations are generally performed (such as disassociating the daemon process from any controlling tty), convenience routines such as daemon(3) existing in some UNIX systems for that purpose.

Systems often start (or "launch") daemons at boot time: they often serve the function of responding to network requests, hardware activity, or other programs by performing some task. Daemons can also configure hardware (like devfsd on some Linux systems), run scheduled tasks (like cron), and perform a variety of other tasks.

Terminology

The term was coined by the programmers of MIT's Project MAC. They took the name from Maxwell's demon, an imaginary being from a famous thought experiment that constantly works in the background, sorting molecules.[2] Unix systems inherited this terminology. Daemons are also characters in Greek mythology, some of whom handled tasks that the gods couldn't be bothered with, much like computer daemons often handle tasks in the background that the user can't be bothered with. BSD and some of its derivatives have adopted a daemon as its mascot, although this mascot is actually a cute stereotypical depiction of a demon from Christianity. (The alternative expansion of "daemon" as "disk and execution monitor" is also sometimes used, but is a backronym.)

Pronunciation

The word daemon, taken out of its computer science context, is universally pronounced as /'dimən/[3][4][5], i.e., as a homonym of the word demon. Perhaps due to the relative obscurity of the word in other contexts, the alternate pronunciation of /'deɪmən/ has popularity in its computer science context.

Humor

The term daemon often leads to humorous connections with its mythical homonym demon; for example, systems might have an exorcise command to kill off undesired daemons [1], and the parody website [2] uses this to claim that Apple's BSD-derived Mac OS X is Satanic due to its use of daemons.

Types of daemons

In a strictly technical sense, in the Unix world, a process comprises a daemon when it has process number 1 (init) as its parent process and no controlling terminal. The init process adopts any process whose parent process terminates. The common method for a process to become a daemon involves:
  • Disassociating from the controlling tty
  • Becoming a session leader
  • Becoming a process group leader
  • Staying in the background by forking and exiting (once or twice). This is required sometimes for the process to become a session leader. It also allows the parent process to continue its normal execution. This idiom is sometimes summarized with the phrase "fork off and die"
  • Setting the root directory ("/") as the current working directory so that the process will not keep any directory in use
  • Changing the umask to 0 to allow open(), creat(), et al. calls to provide their own permission masks and not to depend on the umask of the caller
  • Closing all inherited open files at the time of execution that are left open by the parent process, including file descriptors 0, 1 and 2 (stdin, stdout, stderr). Required files will be opened later.
  • Using a logfile, the console, or /dev/null as stdin, stdout, and stderr
In common Unix usage a daemon may be any background process, whether a child of init or not. Unix users sometimes spell daemon as demon, and most usually pronounce the word that way.

Etymology

In the general sense, daemon is an older form of the word demon. In the Unix System Administration Handbook, Evi Nemeth [6] has this to say about daemons:

Many people equate the word "daemon" with the word "demon", implying some kind of satanic connection between UNIX and the underworld. This is an egregious misunderstanding. "Daemon" is actually a much older form of "demon"; daemons have no particular bias towards good or evil, but rather serve to help define a person's character or personality. The ancient Greeks' concept of a "personal daemon" was similar to the modern concept of a "guardian angel" — eudaemonia is the state of being helped or protected by a kindly spirit. As a rule, UNIX systems seem to be infested with both daemons and demons. (p.403)

Windows equivalent

In the Microsoft DOS environment, such programs were written as Terminate and Stay Resident (TSR) software. On Microsoft Windows systems, programs called services perform the functions of daemons. They run as processes, usually do not interact with the monitor, keyboard, and mouse, and are launched (or not launched) by the operating system at boot time.

Mac OS equivalent

On the original Mac OS, optional features and services were provided by files loaded at startup time that patched the operating system; these were known as system extensions and control panels. Later versions of classic Mac OS augmented these with fully-fledged faceless background applications: regular applications that ran in the background. To the user, these were still described as, and disguised as, regular system extensions.

Mac OS X, being a Unix-like system, has daemons. (There are services as well, but these are completely different in concept.)

References

1. ^ Raymond, Eric. Jargon File entry for daemon. The Jargon File. Retrieved on 2007-07-18.
2. ^ Fernando J. Corbató (January 23, 2002). Take Our Word for It. Retrieved on 2006-08-20.
3. ^ YourDictionary entry for daemon. YourDictionary. Retrieved on 2007-07-18.
4. ^ Dictionary.com entry for daemon. Dictionary.com. Retrieved on 2007-07-18.
5. ^ Merriam-Webster pronuncation of daemon. Merriam-Webster Online. Retrieved on 2007-07-18.
6. ^ [3]

See also

External links

Unix (officially trademarked as UNIX®) is a computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs including Ken Thompson, Dennis Ritchie and Douglas McIlroy.
..... Click the link for more information.
In computing, multitasking is a method by which multiple tasks, also known as processes, share common processing resources such as a CPU. In the case of a computer with a single CPU, only one task is said to be running
..... Click the link for more information.
An operating system (OS) is the software that manages the sharing of the resources of a computer. An operating system processes system data and user input, and responds by allocating and managing tasks and internal system resources as a service to users and programs of the
..... Click the link for more information.
International Phonetic Alphabet

Note: This page may contain IPA phonetic symbols in Unicode.

The International
Phonetic Alphabet
History
Nonstandard symbols
Extended IPA
Naming conventions
IPA for English The
..... Click the link for more information.
A computer program is one or more instructions that are intended for execution by a computer. Specifically, it is a symbol or combination of symbols forming an algorithm that may or may not terminate, and that algorithm is written in a programming language.
..... Click the link for more information.
The background, in the context of computer software processes, refers in general to processes that are run with a relatively low priority, require little or no input, and generate a minimum of output.
..... Click the link for more information.
In computing, a process is an instance of a computer program that is being sequentially executed.[1] While a program itself is just a passive collection of instructions, a process is the actual execution of those instructions.
..... Click the link for more information.
syslog is a standard for forwarding log messages in an IP network. The term "syslog" is often used for both the actual syslog protocol, as well as the application or library sending syslog messages.
..... Click the link for more information.
Secure Shell or SSH is a network protocol that allows data to be exchanged over a secure channel between two computers. Encryption provides confidentiality and integrity of data.
..... Click the link for more information.
A parent process is a computer process that has created one or more child processes.

In UNIX, every process except process 0 (the swapper) is created when another process executes the fork system call.
..... Click the link for more information.
init (short for "initialization") is the program on Unix and Unix-like systems that spawns all other processes. It runs as a daemon and typically has PID 1.

The functionality diverged, in Unixes such as System III and System V, from the functionality provided by the init in
..... Click the link for more information.
In computing, the process identifier (normally referred to as the process ID or just PID) is a number used by some operating system kernels (such as that of UNIX, Mac OS X or Windows NT) to uniquely identify a process.
..... Click the link for more information.
fork, when applied to computing occurs when a process creates a copy of itself, which then acts as a "child" of the original process, now called the "parent". More generally, a fork in a multithreading environment means that a thread of execution is duplicated.
..... Click the link for more information.
tty is a Unix command that prints to standard output the name of the file connected to standard input. The name of the program comes from teletypewriter, abbreviated "TTY".
..... Click the link for more information.
In computing, booting (booting up) is a bootstrapping process that starts operating systems when the user turns on a computer system. A boot sequence is the set of operations the computer performs when it is switched on that loads an operating system.
..... Click the link for more information.
devfs is an umbrella term for special-purpose file systems present on many Unix-like operating systems, used for presenting device files, an abstraction for accessing I/O and other peripherals.
..... Click the link for more information.
Linux (pronunciation: IPA: /ˈlɪnʊks/, lin-uks) is a Unix-like computer operating system. Linux is one of the most prominent examples of free software and open source development; its underlying source code can be
..... Click the link for more information.
In computing, cron is a time-based scheduling service in Unix-like computer operating systems. The name is derived from Greek chronos (χρόνος), meaning time.

cron has been recreated several times in its history.
..... Click the link for more information.
Project MAC, later the MIT Laboratory for Computer Science (LCS), was a research laboratory at MIT. Project MAC would become famous for groundbreaking research in operating systems, artificial intelligence, and the theory of computation.
..... Click the link for more information.
Maxwell's demon is an 1867 thought experiment by the Scottish physicist James Clerk Maxwell, meant to raise questions about the possibility of violating the second law of thermodynamics.
..... Click the link for more information.
Unix (officially trademarked as UNIX®) is a computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs including Ken Thompson, Dennis Ritchie and Douglas McIlroy.
..... Click the link for more information.
For the evil spirits of the Christian religion, see Demon
The words daemon, dæmon, are Latinized spellings of the Greek δαίμων (daimon),[1]
..... Click the link for more information.
Berkeley Software Distribution (BSD, sometimes called Berkeley Unix) is the UNIX derivative distributed by the University of California, Berkeley, starting in the 1970s.
..... Click the link for more information.
BSD Daemon is the BSD operating system's mascot, named after a daemon, a type of software program common on Unix-like operating systems, but taking the (albeit less arcane) shape of the classic mythical demon.
..... Click the link for more information.
Cuteness is a kind of attractive beauty commonly associated with youth, innocence and helplessness, as well as a scientific concept and analytical model in Ethology, first introduced by Konrad Lorenz.
..... Click the link for more information.
Stereotypes are ideas about people of other particular groups, based primarily on membership in that group. They may be positive or negative prejudicial, and may be used to justify certain discriminatory behaviors. Some people consider all stereotypes to be negative.
..... Click the link for more information.
demon (or daemon, dæmon, daimon from Greek: δαίμων [ğaïmon]) is a supernatural being that has generally been described as a malevolent spirit, and in Christian terms it is generally understood as a Fallen angel, formerly of
..... Click the link for more information.
Christianity

Foundations
Jesus Christ
Church Theology
New Covenant Supersessionism
Dispensationalism
Apostles Kingdom Gospel
History of Christianity Timeline
Bible
Old Testament New Testament
Books Canon Apocrypha
..... Click the link for more information.
A backronym (or bacronym) is a phrase that is constructed "after the fact" from a previously existing abbreviation, the abbreviation being an initialism or an acronym.
..... Click the link for more information.


In linguistics, a homonym
..... Click the link for more information.


This article is copied from an article on Wikipedia.org - the free encyclopedia created and edited by online user community. The text was not checked or edited by anyone on our staff. Although the vast majority of the wikipedia encyclopedia articles provide accurate and timely information please do not assume the accuracy of any particular article. This article is distributed under the terms of GNU Free Documentation License.