Linux Kernel ------ basic process knowledge

Source: Internet
Author: User

Linux Kernel ------ basic process knowledge

Process:

Traditionally, applications running in Linux, servers and other programs are called processes. Of course, a process not only indicates a piece of executable code in the execution period, but also includes other resources, such as open files, suspended signals, and internal kernel data. In fact, there is another concept: thread or lightweight process, but in the Linux midline process and process is actually similar. The thread can be seen as a process that shares certain data and resources with other processes.

Process representation:

Generally, a process is represented by a structure called task_struct or process descriptor ). It contains all information about the kernel management process. Many members of task_struct are not simple type variables, but pointers to other data structures. In fact, task_struct has many Members who connect processes with various subsystems. Because the quantity is too large, if you want to know it right away, you will basically lose yourself in the details. However, they can be divided into many parts, each representing a specific aspect of the process. Let's take a look at them.

1. Status and execution information: process ID (PID), pointer to parent process and other related processes, etc.

2. Information about allocated virtual memory.

3. Process Identity creden: User ID, group ID, and permissions

4. Information of the file used

5. The thread information records the CPU-specific running time data of the process ....)

6. Information about inter-process communication

7. The signal processing program used by the process to respond to the incoming signal.

The process identifier, namely, PID, is the unique identifier of the kernel for the process. When a new process is created, the system assigns a unique PID to it for identification.

Process status:

The state field in task_struct describes the current state of the process. Each process must be in one of the following five States.

1. TASK_RUNNING: the process is being executed or waiting for execution in the running queue.

2. TASK_INTERRUPTIBLE: the process is in sleep state and is waiting for an event or resource. Once the signal of an event sent by the kernel is received, the status changes to TASK_RUNNING.

3. TASK_UNINTERRUPTIBLE: A Sleep process that is stopped by the kernel. It cannot be awakened by external signals. It can only be awakened by the kernel.

4. TASK_STOPPED: The process stops running. If any signal is received during debugging, the process enters this state.

5. TASK_TRACED: Process tracked by other processes

There is also a so-called zombie state, that is, EXIT_ZOMBIE. This program has died because its resources, such as memory, and connections to peripherals have been released, but they still exist in the progress table, so they have not actually died, why... later

Process family tree:

In Linux, tree structures are common, such as file systems and processes to be mentioned. The init process is the root of the entire process tree. All processes are directly or indirectly from this process. Almost every process has its own child process and parent process. How to create and revoke a process is also a problem. In short, the process tree is similar to the file tree. init is the root directory, while creating a sub-process for a process is equivalent to creating a new directory under a directory. revocation is similar.

Well, this is almost the basic process knowledge! More complicated things will be done later!

Note: The content of this article (including similar articles in the future) mainly refers to the download of Love's Linux kernel design and implementation PDF and the download of WolfganglMauerer's deep Linux kernel architecture PDF. Because I feel that the focus and depth of each book are different in the Process of reading and learning, it brings little trouble to beginners. So here we will summarize what we have learned and try to give a concise knowledge structure of kernel knowledge, so as to better grasp from the macro perspective and ensure that we will not lose in tedious details. In general, it mainly helps you sort out your knowledge and deepen your understanding. It would be my greatest pleasure to help everyone!

How to install Linux 3.11 Kernel on Ubuntu

The Ubuntu 13.10 (Saucy Salamander) Kernel has been upgraded to Linux Kernel 3.10 RC5

Linux Kernel 3.4.62 LTS is now available for download

How to install Linux kernel 13.10 On Ubuntu 3.12

Linux Kernel: click here
Linux Kernel: click here

This article permanently updates the link address:

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.