Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to analyze the process attributes of Linux system

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

In this issue, the editor will bring you how to analyze the process attributes of the Linux system. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

All the tasks running in the Linux system are processes. More accurately, each user task, each system management, can be said to be a process, so what are the attributes of the process?

1. The four elements of the process have a piece of program code for the program to run.

Has dedicated system stack space.

Have a task_struck structure to implement the process control block (pcb).

Have independent storage space.

two。 The relationship and classification of processes all processes in the Linux system are interrelated.

The Linux kernel creates a process with process label 0 and process label 1. The process labeled 1 is an initialization process from which all processes in init,Linux are derived. The process started by the program under Shell is a child process of the Shell process. In the user's startup process, you can start your own child processes, thus forming a process tree, and each process is a node in the tree. The root of the tree is the initialization process init. The relationship between processes can be described by kinship in the diagram, which usually includes the following parts.

P_opptr (ancestor, original parent): points to the process descriptor of the creation process P, or to the process init if the parent process does not exist. When a Shell user starts a background process and exits from Shell, the background process becomes a child of init.

P _ pptr (parent process, parent): points to the parent process of the process. The value is usually the same as that of p _ opptr, or may be different.

P _ cptr (child process, child): a descriptor that points to the youngest child of a process, that is, the process descriptor that the process last created.

P _ ysptr (sibling process, younger sibling): points to the process created by the parent process after this process is created.

P _ osptr (sibling process, older sibling): points to the process created by the parent process before this process is created.

3. Types of processes the Linux operating system usually includes three different types of processes.

Interactive process: a process started by a Shell that can be run either in the foreground or in the background.

Batch process: there is no contact with the terminal, it is a process sequence.

Daemon: a process that starts when the Linux system starts and runs in the background.

4. The state of a process during its lifetime the process may be in the following states, which are mutually exclusive, and different keywords are used to define them in the state domain of the task_struct structure.

Runnable state (TASK_RUNNING): takes up processor execution or is ready for execution.

Interruptible wait state (TASK_INTERRUPTIBLE): a process is suspended or sleeps, and exits this wait state when certain conditions become true, such as a hardware interrupt, the release of the system resources that the process is waiting for, sending a signal, and so on. After exiting the wait state, the process will return to the TASK_RUNNING state.

Uninterruptible wait state (TASK_ UNINTERRUPTIBLE): similar to an interruptible wait state, except that it cannot be exited when a signal is received.

TASK_STOPPING: the execution of a process is paused, usually when a process receives a SIGSTOP, SIGTTIN, or SIGTTOU signal, it enters a paused state. If a process is monitored by another process, any signal can put the process in the TASK_STOPPEN state.

Zombie state (TASK_ZOMBIE): the execution of the process has been terminated, but the parent process has not yet used the corresponding information returned by the wait call, so the kernel cannot discard the corresponding data contained in the process, because the parent process may also need it.

Processes transform each other between these states, but they are transparent to users, and the switching process is often referred to as process scheduling.

A process is an entity that changes with the execution process, and it also contains the values of program counters and all processor registers, while its stack stores temporary data such as parameters (such as subroutines), return addresses, and variables. The current executor, or process, contains the active state in the current processor. In a multiprocessing operating system, processes have independent permissions and responsibilities. If one process in the system crashes, the rest of the process will not be affected. Each process runs in its own virtual address space, and only through a certain communication mechanism can they communicate with each other.

The above is how to analyze the process properties of the Linux system shared by the editor. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report