First, the Linux daemon
Linux servers start with a number of system services that provide local and network users with a system-functional interface for Linux that is directly targeted to applications and users. The programs that provide these services are executed by daemons running in the background.
A daemon is a process that has a long lifetime. They are independent of the control terminal and periodically perform certain tasks or wait to handle certain occurrences. They often start when the system boots and terminate when the system shuts down.
Linux systems have many daemons, and most servers are implemented with daemons. At the same time, the daemon completes many system tasks, such as job planning process crond, printing process lqd and so on. Some books and materials also call the daemon a "service".
Daemon, which means daemon and service.
Ii. classification of the Linux daemon
Depending on how the daemon is started and managed, it can be divided into two types, independent boot daemon and Super daemon.
Stand-alone Boot (stand_alone): This class of process starts with memory, so it always consumes system resources. Its biggest advantage is that it will always start, when the outside world has the corresponding speed faster, such as httpd process;
Super Daemon: The system starts with a unified daemon xinet to manage some processes, and when the corresponding request arrives, it needs to be xinet to wake up the Xinet managed process. The advantages of this process when initially only xinet this daemon occupies the system resources, other internal services do not always occupy the system resources, only the arrival of the packet will be xinet by the administrator to wake. And we can also use Xinet to set some access rights to the process it manages, which is equivalent to a layer of management mechanism.
If two metaphors are used to describe a class of daemons, it is common to use the Bank's Business processing window to analogy:
Independent start: There is a single-service window in the bank, such as taking money, saving and other windows, these windows will always sit on the side of a person, if someone to withdraw money or save, you can directly to the corresponding window to handle, this single service is always the existence of the person is the independent start of the Guardian process;
Super Daemon: There is also a window in the bank, providing comprehensive services, such as remittances, transfers, withdrawals and other business; This window is also always sitting near a person (xinet), she may not provide specific services, provide specific services to the people in the idle chat ah, tea ah, but when someone comes to the remittance, he will shout a word, Xiao Wang, someone sent money, and then the inside tube remittance of the small Wang will immediately run to help finish the remittance business. Others continued to chat and have tea. Those who are responsible for the specific business we call the Super daemon process. Of course, the sender may have some rules, may not be able to send money to Beijing, he will tell Xinet early, so if someone to send money to the remittance to Beijing, the administrator directly told him that we can not do here, so it will not go to shout remittance clerk, equivalent to provide a layer of management mechanism. For this window there are multithreading and single-threaded differences: Multithreading: All the user's requirements are brought up, inside the people do not idle, all work together;
Single-threaded: Everyone is lined up, one by one, and the people in it. At the same time only one person at work.
XINETD Service is a special service for UNIX operating system, because it can be responsible for the start, stop and record of some other network services. The full name of XINETD is eXtended Internet Services Daemon, which is often used to manage a variety of lightweight Internet services such as Telnet, talk, POP3, IMAP, and sometimes for Apache and FTP services.
Stand alone's daemon responds fast. Common stand alone daemon have WWW daemon (httpd), FTP Daemon (VSFTPD) and so on.
Linux Daemon and Super Daemon (XINETD)