Description of the process and creation of the process

Source: Internet
Author: User

Zhang Yu + "Linux kernel analysis" MOOC course http://mooc.study.163.com/course/USTC-1000029000

Process Descriptor TASK_STRUCT Data structure

The process descriptor provides the kernel information that the kernel needs to know. The TASK_STRUCT data structure is very large.

The process state of Linux and the process state described in the operating system principle appear to be different. Essentially the same, ready state, running state, blocking state.

All the process states

Process identifiers

Linked List of processes

It is a doubly linked list that connects all the processes together. A linked list can be operated independently,

Each process has its own independent process address space.

Parent-child Relationship

This is the management of the parent-child relationship in the process

The ptraced is for debugging purposes.

Creation of processes

The fork system call returns one time between the parent and child processes, which becomes two processes. This fork () system call allows you to create a process in the user state.

A normal system call:

When the fork () is called

The parent process returns normally with normal calls, and the child processes generated by the fork are returned inside the kernel.

Fork, Vfork, clone all can create new processes, and all are created by calling Do_fork to implement the process.

Creating a new process is done by replicating the current process.

Linux creates a new process by replicating the parent process, so it provides an ideal framework for us to understand this process:

The system calls the kernel handler functions sys_fork, Sys_vfork, Sys_clone.

The DUP task struct--copies the task struct.

Child process

The child process starts from return_from_fork and then challenges to Syscall_exit, which is returned in the system call.

Description of the process and creation of the process

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.