Processes and Daemons

Processes and Daemons : fork and clone

Starting a Unix/Linux process

Daemon processes

When we refer to a daemon process, we are referring to a process with these characteristics:

BSD-ish: Kernel and user daemons: swapper

Kernel and user daemons: init

init (pid 1) daemon: The first ``user'' process started by the kernel; its userid is 0. All other ``normal'' processes are descendants of init. Depending on the boot configuration, you might see something along these lines:

There is a lot of flux in this area. It's hard to characterize the successes and the failures of each approach since each has an environment that it is most appropriate for, and all have downsides in other environments. Articles like this and this demonstrate some of the vehemence that can be attached to these discussions.

Kernel and user daemons: update (aka bdflush/kupdate and fsflush)

Comments in the code: what kernel comments say about dirty buffers and pages

 * The relationship between dirty buffers and dirty pages:
 * Whenever a page has any dirty buffers, the page's dirty bit is set, and
 * the page is tagged dirty in its radix tree.
 * At all times, the dirtiness of the buffers represents the dirtiness of
 * subsections of the page.  If the page has buffers, the page dirty bit is
 * merely a hint about the true dirty state.
 * When a page is set dirty in its entirety, all its buffers are marked dirty
 * (if the page has buffers).
 * When a buffer is marked dirty, its page is dirtied, but the page's other
 * buffers are not.
 * Also.  When blockdev buffers are explicitly read with bread(), they
 * individually become uptodate.  But their backing page remains not
 * uptodate - even if all of its buffers are uptodate.  A subsequent
 * block_read_full_page() against that page will discover all the uptodate
 * buffers, will set the page uptodate and will perform no I/O.

(from fs/buffer.c in kernel 3.16)

Kernel and user daemons: inetd and xinetd

Amusingly enough, this very same line of reasoning was revived by systemd; see this blog posting by its author. (note that daemontools also has used a related idea since 2001, but more for monitoring purposes.)

Kernel and user daemons: inetd and xinetd

When installing new software packages you may have to modify /etc/inetd.conf, /etc/xinetd.d/ files, and/or /etc/services. A hangup signal (kill -HUP SOMEPID) will get the inetd/xinetd to re-read its config file. Or you might be able to use a startup script, such as ``/etc/init.d/inetd restart'') or ``service inetd restart''.

Kernel and user daemons: portmap and rpcbind

portmap/rpcbind : portmap (rpcbind on OpenSolaris and BSD) maps Sun Remote Procedure Call (RPC) services to ports (/etc/rpc). Typically, /etc/rpc looks something like:

[root@vm5 etc]# more /etc/rpc
#ident  ``@(#)rpc        1.11    95/07/14 SMI''   /* SVr4.0 
#       rpc
portmapper      100000  portmap sunrpc rpcbind
rstatd          100001  rstat rup perfmeter rstat_svc
rusersd         100002  rusers
nfs             100003  nfsprog
ypserv          100004  ypprog
mountd          100005  mount showmount
ypbind          100007
walld           100008  rwall shutdown
yppasswdd       100009  yppasswd

Kernel and user daemons: portmap/rpcbind

Kernel and user daemons: syslogd

syslogd : syslogd is a daemon whose function is to handle logging requests from

Note that syslog is generally being replace rsyslog.

Kernel and user daemons: syslogd

A process can make a logging request to the syslogd by using the function syslog(3). syslogd determines what to do with logging requests according to the configuration file /etc/syslog.conf

/etc/syslog.conf generally looks something like:

*.info;mail.none;news.none;authpriv.none;cron.none  /var/log/messages
authpriv.*                                          /var/log/secure
mail.*                                              /var/log/maillog
cron.*                                              /var/log/cron
*.emerg                                             *
uucp,news.crit                                      /var/log/spooler
local7.*                                            /var/log/boot.log

Kernel and user daemons: syslogd


Thus ends our initial summary of daemons in the Unix world!