Linux learning summary process and thread

Source: Internet
Author: User

Process concept: A process is an independent and schedulable task. Is a process of executing a program.

The program is static, and it is an ordered set of commands stored on the disk. There is no execution concept. The process is dynamic.

It is the process of program execution, including creation, scheduling, and extinction. It is the sum of various resources for program execution and the smallest unit of resource management.
Processes include: body segment + User Data Segment + System Data Segment (Process Control Block PCB ).

Process classification:

1. interactive process: it is controlled by Shell and can be run at the front-end or in the background.

-PS-Ef | grep A. Out
./A. Out & run in the background

2. batch processing process:

Does not belong to a terminal. It is submitted to a queue for sequential execution.
3. daemon:

Run in the background, start running at Linux Startup, and end at system shutdown

Process status:

Running status: the status of the instance that is running or preparing to run (the CPU allocates time slice only)

Wait state: Also known as sleep state (not occupying the CPU, CPU not processing, waiting for resources), divided into can be interrupted and can not be interrupted, waiting for can not be interrupted is not killed.
Stop State: GDB can set breakpoints, kill-20, CTRL + Z to stop the process.
Dead state: Also known as zombie state, a terminated process, but still occupies a task_struct structure in the process Vector Array.

Fork () function to create sub-process

If the parent process ends, process 1 will adopt the child process.
If the child process ends before the parent process ends, the child process becomes a zombie process and must use wait () to receive the zombie 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.