当前位置:网站首页>Process basic properties

Process basic properties

2022-06-24 13:18:00 Chen Bucheng I

One . brief introduction

This article mainly introduces the basic properties of a process , Basic attributes include : process ID、 The parent process ID、 Process group ID、 Session and control terminals

Two . Process properties

1. process ID(PID) Each process has a unique process represented by a nonnegative integer ID(PID). Like our ID cards , Everyone's ID number is unique . Because of the process ID Identifiers are always unique , It is often used as part of other identifiers to ensure its uniqueness . process ID(PID) It cannot be changed at the user level .

stay Linux In the system ,PID by 0 The process of is usually a scheduling process . It is often called an exchange process , It is also the first system process . The first user process is init process . Its PID by 1.

2. The parent process ID(PPID) No matter what process ( except init process ) Are created by another process . This process is called the parent process of the created process . The process that is created is called a child process . The parent process ID Cannot change at the user level . The process of the parent process ID It is the parent process of the child process ID(PPID).

3. Process group ID(process group ID PGID) stay Linux In the system . Every user is a user ID(UID) User group ID(GUID). identical , Processes also have their own processes ID(PID) And process groups ID(PGID). A process group is a collection of one or more processes ; They are related to the same assignment . Each process group has a unique process group ID(PGID), Process group ID(PGID) Can be changed at the user level . example . Add a process to another process group , Is the use of setpgid() Function changes its process group ID.

A process can only set up process groups for itself or its child processes ID(PGID), Suppose... Is called in its child process exec() And so on , The process group of the child process can no longer be changed ID(PGID).

4. conversation (session) A session is a collection of one or more process groups . System call function getsid() Used to get the session of a process ID(SID).

such as , We go through SSH logon server , Will open a control terminal (TTY), This control terminal corresponds to a session . And the commands we run in the terminal and their child processes , It forms process groups one by one , among , Commands running in the background , Make up a background process group ; Commands running in the foreground , Constitute the foreground process group .

原网站

版权声明
本文为[Chen Bucheng I]所创,转载请带上原文链接,感谢
https://yzsam.com/2021/05/20210525190743828F.html