Sunday, September 04, 2011

Daemons in Linux

A daemon in the Linux environment is any process that typically runs for a long time, and in the background. This means that a daemon can often run from the time a computer is booted, till it is switched off, and that it will often have no controlling terminal during its lifetime.

Daemons carry out specific and specialized tasks e.g. command scheduling (cron), ensuring secure remote logins (sshd) and listening to incoming network connections (inetd). Many system daemons work as privileged programs, making it necessary for them to follow the rules that accompany privileges.

For a program to become a daemons, the fork() function needs to run, making the child process run and the parent to exit. The former becomes a child process of init(), and needs to call setsid() after that, to free itself from any control terminal. Consequently, the becomeDaemon() function needs to be implemented, turning the calling program into a daemon.


Read more: Prescott Linux
QR: https://chart.googleapis.com/chart?chs=80x80&cht=qr&choe=UTF-8&chl=http://linux.bihlman.com/2011/09/01/daemons-in-linux/

Posted via email from Jasper-Net