Process creation of Linux process management

Source: Internet
Author: User

The so-called process is an instance of the execution of a program. It is an important abstraction in the modern operating system, and we analyze the process management implementation on Linux from the lifecycle of the process: creation, execution, and extinction.

One: Preface

Process management structure;

In the kernel, each process corresponds to a task. That's what we used to say about PCB. Its structure is as follows (Include/linux/sched.h):

struct Task_struct {
volatile long state;   /*-1 unrunnable, 0 runnable, >0 stopped
/void *stack;
atomic_t usage;
unsigned int flags;   /* per process flags, defined below * *
unsigned int ptrace;
int lock_depth;   /* BKL Lock depth * ...
...
}

Since this structure contains all the information about the process, it is very large and we will analyze the meaning of each member in future analysis.

Storage of Task_struct:

Process switching is very frequent during the system operation, so we need a way to quickly get the task_struct of the current process. The Linux task_struct is stored as shown in the following illustration:

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.