Basic properties of Linux process

All running tasks on Linux systems can be a process, each user task, each system management, can be called the process, so that all tasks with Linux time-sharing management method to share system resources.

Defined processes:
textbook concept: the implementation of a program instance, the program being executed.
Kernel point of view: (CPU time, memory) entity acts as allocation of system resources.

1. The process of the four elements

  • There was a program code for the program is run.
  • It has a dedicated system stack space.
  • Task_struck has a structure to achieve process control block (pcb).
  • It has a separate storage space.

2. relationships and classification process

All processes in Linux systems are interrelated.

Linux kernel creates a process numbered 0 and processes numbered 1 process, the process numbered 1 process is an initialization process init, all processes in Linux are derived therefrom, in the Shell program starts execution process Shell process is a child process, you can then start your own child process to start the process of a user, thus forming a process tree, each process is a node in the tree, the root of the tree is the initialization process init.
Here Insert Picture Description
Between process can be described by the figures of kinship, typically includes the following sections.

  • p_opptr (ancestors, original parent): P points to the process of creating the process descriptor, if the parent does not exist, pointing init process descriptor. When a user starts a background process Shell and exit from Shell, a background process will become sub init process.
  • p_ pptr (parent, parent): points parent of the process, the value of p_ opptr general, and consistent, may be different.
  • p_ cptr (child process, child): The youngest child process point to the process descriptor, ie processes on a process to create a descriptor.
  • p_ ysptr (brother of course, younger sibling): After this point in the process of creating a process created by the parent process.
  • p_ osptr (brother of course, older sibling): point before the process created by the parent process to create this process.

Type 3. Process

Linux operating system typically includes three different types of processes.

  • Interactive process: both can be run by Shell to start a process in the foreground, it can also run in the background.
  • Batch process: no contact and terminal, is a process sequence.
  • Daemon: Start of boot Linux system processes and run in the background.

4. The process of state

Process within its life cycle may be in the following states, these states are mutually exclusive, use different keywords in domain task_struct structure of the state to define these states.

  • Runnable (TASK_RUNNING): processor-intensive execution or ready to execute.
  • Interruptible wait state (TASK_INTERRUPTIBLE): the process is suspended or sleep, when certain conditions become true when exiting the wait state, such as: hardware interrupts, system resources the process is waiting to be released, such as passing a signal, after the exit process will return to the wait state TASK_RUNNING state.
  • Uninterruptible wait state (TASK_ UNINTERRUPTIBLE): and wait states can similarly interrupt, when the difference signal is received and can not exit the wait state.
  • Suspended state (TASK_STOPPING): the process execution is suspended, in general, when the process is received SIGSTOP, SIGTTIN or SIGTTOU signal, enter the suspend state. If a process is monitoring another process, any signal can put this process into a TASK_STOPPEN state.
  • Zombie (TASK_ZOMBIE): implementation process has been terminated, but the parent process has not been using the corresponding information return call to wait, in which case the core comprises a corresponding data can not be discarded in the process, since the parent process may also need such data.

In the process of interconversion between several states, but is transparent to the user, this handover process is often referred to in the scheduling process.

Process is a process of changing the entity with the execution, the process also includes all of the program counter and the processor registers, and it is stored in the stack (e.g., subroutine) arguments, return address and temporary data such as variables.
The current implementation of the program, or process, contains the active state of the processor in the current. In the multi-processing operating system, the process has independent rights and duties. If the system is in a process crashes, without affecting the rest of the process.
Each process running its own virtual address space, through some communication mechanism, to contact between them.

Published 71 original articles · won praise 131 · views 20000 +

Guess you like

Origin blog.csdn.net/qq_43239560/article/details/102830743