Working Mode of the Linux daemon

Source: Internet
Author: User

 

Linux Working Mode of daemon

Daemon works in the background and has no terminals. It is generally used for network services. The vast majority of daemon can work in two modes: Standalone/inetd. The daemon uses its own specific port to provide services.

When the daemon works in standalone mode, it listens to the port and occupies more system resources. It can be seen as a direct type.

When the daemon works in inetd mode, the inetd thread listens to the port and wakes up the daemon when the connection is received, it consumes less system resources than standalone mode, but the response is slow. Inetd is required.

Standalone Independent daemon

The init script is responsible for managing the independent daemon. the scripts of all the independent daemon are in the/etc/rc. d/init. d/directory. System services are independent daemon processes.
Including syslogd and cron. Standalone is used to run an independent daemon. It is an access mode in the traditional C/S Mode of UNIX. The daemon listener waits for the connection from the client on a special port. If the client generates a connection request, the daemon creates a connection to process the sub-process response, and the parent process continues to listen. To keep the sub-process pool waiting for the next client request. Standalone mode can be used for stream socket TCP and datagram UDP. Working principle of standalone Mode

Standalone Mode

Inetd daemon

From the concept of daemon, we can see that every service that the system uses must run a daemon that listens to a port connection. This usually means a waste of resources. To solve this problem, Linux introduces the concept of "network daemon service program. In this way, the system does not need every network service process to listen to its service port. Running a single inetd can listen to all service ports at the same time, thus reducing system overhead and protecting system resources. The daemon does not need to create or initialize socket sockets and their descriptors and process various signals (such as interruptions and sub-Process Termination), but only needs to accept Socket socket descriptors from the inetd server. The network daemon used in Versions later than RedHat Linux 9 is xinted (Extended Internet Daemon ). Inetd can listen to multiple specified ports at the same time. When receiving user requests, it can start different network service processes to process these user requests based on different user request ports. You can regard inetd as a management server that manages the startup service. It decides to send a customer request to the program for processing and then start the corresponding daemon process. The inetd mode applies to datagram UDP. How inetd works

Nnd. How to paste this image. Forget it, alas

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.