Program specification for Linux High Performance server reading notes

Source: Internet
Author: User
Tags syslog

Background: In addition to network communication, the server program has a lot of details.
Features: The details are template-style, so only need to speak clearly, follow certain norms is good
Category: 1.1 Run-to-background process, also known as the guard process. The terminal is not controlled and is not accidentally entered by the user.
Its parent process is: the init process (PID is a 1 process)
1.2 Log system. Generally at least output to a file, you can also output to a dedicated UDP server. Usually have their own log directory in/var/log
1.3 Running Identity: a specific non-root identity. Example: MYSQLD,HTTPD,SYSLOGD and other background programs, each has its own account Mysql,apache,syslog
1.4 Configurable. Can handle many many command line options. If you run too many options at once, you need a profile to manage. It is usually placed in/etc. Like squid in/etc/squid3/squid.conf.
1.5 The PID of the background process is recorded. The boot will have a PID file generated and deposited into the/var/run. Example: syslogd pid file is/var/run/syslogd.pid
1.6 Consider system resources and limits (self-maximum load) Example: Total number of file descriptors and total memory.
Linux Details Processing method
2.1 Log: Rsyslogd (syslog function)
2.2 User information: Uid,euid (valid user ID), Gid,egid
Euid: Easy access to resources. Purpose: It makes the user running the program of a valid user who owns the program .Permissions. (SU program, SU must access/etc/passwd to change user information.) /ETC/PASSWD is required to root, so ordinary users can access it must rely on Euid, the owner can set their own program Set-user-id, the command is: chmod +s * * * * * * * * *

                2.3 Inter-process relationship 2.3.1linux each process is subordinate to a process group, and each process group has a leader process, in addition to the PID and Pgid.                The PID and Pgid of the boss process are the same. The 2.3.2 Process group will always exist.                It terminates when all of the processes are exited or joined to another group. 2.3.31 processes can only set their own or the {Pgid of their child processes.                When a child process calls the Exec series of functions, the parent process can no longer set its pgid.                2.4 Session 2.4.1 Definition: Some associated process groups will form a session \ Implementation: Non-leader processes can call this function to create new sessions. Implementation feature: The calling process becomes the leader of the session, at which point the process is the only member of the new conversation. Create a new process group whose pgid is the PID of the calling process, which is the leader of the group.                The calling process will leave the terminal function: pid_t setsid (void);                Features: No sid,linux think he equals the session leader in the process group of pgid,pid_t GetSID (pid_t pid);                2.5 System Resource Limit 2.6 change the working directory and root directory 2.6.1 function: Get current working directory and change process working directory char * GETCWD (char* buf,size_t size);                int chdir (const char* path) function 2: Change the process root directory chroot int chroot (const char* path) 2.7.1 Server daemon Linux library functions int deamon (int nochdir,int noclose); Nochdir: Whether to change the working directory, 0 is the root directory, otherwise use the current directory, Noclose is 0, standard input and standard output and standard error output will be redirected to/dev/null files, otherwise the original device is still used. The function returned successfully 0. Failed to return-1;

Linux High Performance Server program specification for reading notes

Related Article

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.