The status of the [go] process

Source: Internet
Author: User

In order to track and describe the process from generation to extinction, it is necessary to define the various states of various processes and formulate the corresponding state transition policies to control the process operation.

Different operating systems interpret the state of the process differently, but the most basic state is the same. Include three kinds:

  Running state : The process consumes CPU and runs on the CPU;

  Ready state : The process already has operating conditions, but the CPU has not been allocated;

  blocking state : The process is temporarily unable to run because it waits for something to happen;

Here are 3 state transition graphs:

Of course, the conversion between the above three states is theoretically divided into six cases:

    1. Run---> Ready: This is caused by scheduling, mainly because the process takes up CPU time too long
    2. Ready---> Run: The time slice of the running process runs out and the schedule goes to the ready queue to select the appropriate process to allocate the CPU
    3. Run---> BLOCK: An I/O request or wait for something to happen
    4. Blocking---> Readiness: The event that the process waits for occurs, enters the ready queue

The above 4 kinds of situations can be converted to each other normally, is there still two kinds of situation?

    1. Block-to-run: even if the blocking process is allocated a CPU and cannot be executed, the operating system load will not load the blocking queue for picking, and its scheduled Selection object is the ready queue:
    2. Ready-to-block: Because the ready state is not executing at all, what comes into the blocking state?

Now we know the three basic states of the process, but in the specific reality of the operating system, the designer can set different states according to the actual situation, so that the following States have appeared:

Operational State: He is a combination of a run state and a ready state, indicating that the process is running or ready to run, and that this state is represented in Linux using the Task_running macro.
Light sleep State : The process is sleeping (blocked), waiting for the resource to arrive is wake-up, or can be awakened by another process signal or clock interrupt,

Enter the run queue. Linux uses task_interruptible macros to represent this state.
Deep sleep State : It is basically similar to shallow sleep, but one thing is that no other process signal or clock interrupt wakes up. Linux using task_uninterruptible

The macro represents this state.
paused State : The process pauses execution to accept some sort of processing. If the process undergoing debugging is in this state,Linux uses the task_stopped macro to represent this state.
Zombie State : The process has ended without releasing the PCB, andLinux uses the Task_zombie macro to represent this state.

We can look at the definition of the above macro in the kernel:
#define TASK_RUNNING 0
#define TASK_INTERRUPTIBLE 1
#define Task_uninterruptible 2
#define __TASK_STOPPED 4
#define __TASK_TRACED 8
/* in Tsk->exit_state */Process exit status
#define Exit_zombie 16
#define Exit_dead 32
/* in Tsk->state again */I understand the wake state of the process
#define TASK_DEAD 64
#define Task_wakekill 128
#define TASK_WAKING 256
#define TASK_STATE_MAX 512
#define TASK_STATE_TO_CHAR_STR "RSDTTZXXKW"

The following are the Linux inter-process state transitions and kernel invocation plots:

Original link: http://blog.chinaunix.net/uid-26126915-id-2948970.html

The status of the [go] process

Related Article

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.