Daemon (computing)

Daemon (computing)

In Unix and other multitasking computer operating systems, a daemon (play /ˈdmən/ or /ˈdmən/)[1] is a computer program that runs as a background process, rather than being under the direct control of an interactive user. Typically daemon names end with the letter d: for example, syslogd is the daemon that implements the system logging facility, or sshd, which services incoming SSH connections.

In a Unix environment, the parent process of a daemon is often, but not always, the init process. 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. In addition, a daemon or the operating system 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) in Unix.

Systems often start 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 udevd on some GNU/Linux systems), run scheduled tasks (like cron), and perform a variety of other tasks.

Contents

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 could not be bothered with. BSD and some of its derivatives have adopted a daemon as its mascot, although this mascot is a variation of the demons that appear in Christian artwork.

The word daemon is an alternative spelling of demon,[3] and is pronounced /ˈdmən/ dee-mən. In the context of computer software, the original pronunciation /ˈdmən/ has drifted to /ˈdmən/ day-mən for some speakers.[1]

Creation

In a strictly technical sense, a Unix-like system process is a daemon when its parent process terminates and the daemon is assigned the init process (process number 1) as its parent process and has no controlling terminal. However, more commonly, a daemon may be any background process, whether a child of init or not.

The common method for a process to become a daemon involves:

  • Dissociating from the controlling tty
  • Becoming a session leader
  • Becoming a process group leader
  • Executing as a background task 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.
  • Setting the root directory ("/") as the current working directory so that the process does not keep any directory in use that may be on a mounted file system (allowing it to be unmounted).
  • Changing the umask to 0 to allow open(), creat(), et al. operating system calls to provide their own permission masks and not to depend on the umask of the caller
  • Closing all inherited 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

Implementation in MS-DOS and Microsoft Windows

In the Microsoft DOS environment, daemon-like programs were implemented as Terminate and Stay Resident (TSR) software. On Microsoft Windows NT systems, programs called Windows services perform the functions of daemons. They run as processes, usually do not interact with the monitor, keyboard, and mouse, and may be launched by the operating system at boot time. In Windows 2000 and later versions, Windows services are configured and manually started and stopped using the Control Panel or the net start and net stop commands.

However, any Windows application can perform the role of a daemon, not just a service, and some daemons for Windows have the option of running as a normal process.

Implementation in Mac OS

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 regular system extensions.

Mac OS X, being a Unix system, has daemons. There is a category of software called services as well, but these are different in concept from Windows services.

Etymology

The BSD daemon, also called Beastie, as drawn by John Lasseter. His widely known and popular take on the BSD mascot first showed up on a book cover in 1988.[4]

According to Fernando J. Corbato who worked on Project MAC in 1963 his team is the first to use the term daemon. The use of the term daemon was inspired by Maxwell's demon, an imaginary agent in physics and thermodynamics that helped to sort molecules.[5]

We fancifully began to use the word daemon to describe background processes which worked tirelessly to perform system chores.

In the general sense, daemon is an older form of the word demon, from the Greek δαίμων. In the Unix System Administration Handbook, Evi Nemeth states the following about daemons:[6]

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)

A further characterization of the mythological symbolism is that a daemon is something which is not visible yet is always present and working its will. Plato's Socrates describes his own personal daemon to be something like the modern concept of a moral conscience:

"The favour of the gods has given me a marvelous gift, which has never left me since my childhood. It is a voice which, when it makes itself heard, deters me from what I am about to do and never urges me on."
—Character of Socrates in "Theages", Plato[7]

Notable service daemons in Unix-like systems

See also

References

  1. ^ a b Eric S. Raymond. "daemon". The Jargon File. http://catb.org/~esr/jargon/html/D/daemon.html. Retrieved 2008-10-22. 
  2. ^ Fernando J. Corbató (2002-01-23). "Take Our Word for It". http://www.takeourword.com/TOW146/page4.html. Retrieved 2006-08-20. 
  3. ^ "Merriam-Webster definition of daemon". Merriam-Webster Online. http://www.merriam-webster.com/dictionary/daemon. Retrieved 2009-08-05. 
  4. ^ Amazon.com, Book cover image, ISBN 0-201-06196-1
  5. ^ "The Origin of the word Daemon". http://ei.cs.vt.edu/~history/Daemon.html. 
  6. ^ "The BSD Daemon". Freebsd.org. http://www.freebsd.org/copyright/daemon.html. Retrieved 2008-11-15. 
  7. ^ There is some doubt as to whether "Theages" was genuinely authored by Plato but this passage accurately articulates the Greek conception of a daemon.
  8. ^ http://unixhelp.ed.ac.uk/CGI/man-cgi?klogd+8

External links


Wikimedia Foundation. 2010.

Игры ⚽ Поможем написать курсовую

Look at other dictionaries:

  • Daemon — Contents 1 Computers 2 Gaming 3 Literature 4 Music …   Wikipedia

  • Daemon (technothriller series) — Daemon   …   Wikipedia

  • daemon — daemon1 [ di:mən] (also daimon) noun 1》 (in ancient Greek belief) a divinity or supernatural being of a nature between gods and humans.     ↘an inner or attendant spirit or inspiring force. 2》 archaic spelling of demon1. Derivatives daemonic… …   English new terms dictionary

  • Wikipedia:Reference desk/Computing — The Wikipedia Reference Desk covering the topic of computing. Computing #eee #f5f5f5 #eee #aaa #aaa #aaa #00f #36b #000 #00f computing Wikipedia:Reference de …   Wikipedia

  • Condor High-Throughput Computing System — Condor Developer(s) University of Wisconsin–Madison Stable release 7.6.4 Stable / October 24, 2011; 21 days ago (2011 10 24) Preview release 7.7.2 / October 12, 2011; 33 days ago …   Wikipedia

  • List of computing and IT abbreviations — This is a list of computing and IT acronyms and abbreviations. Contents: 0–9 A B C D E F G H I J K L M N O P Q R S T U V W X Y …   Wikipedia

  • Entropy (computing) — In computing, entropy is the randomness collected by an operating system or application for use in cryptography or other uses that require random data. This randomness is often collected from hardware sources, either pre existing ones such as… …   Wikipedia

  • Enlightened Sound Daemon — In computing, the Enlightened Sound Daemon (ESD or EsounD) is the sound server for Enlightenment and GNOME. ESD will mix together the simultaneous audio output of multiple running programs, and output the resulting stream to the sound card. ESD… …   Wikipedia

  • Berkeley Open Infrastructure for Network Computing — (BOINC) …   Wikipédia en Français

  • Doors (computing) — This article is about an inter process communication facility. For a requirements tracking tool by IBM, see DOORS. Doors are an inter process communication facility for Unix computer systems. They provide a form of procedure call. Contents 1… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”