Home >Operation and Maintenance >Linux Operation and Maintenance >What are the three categories of processes in Linux?

What are the three categories of processes in Linux?

青灯夜游
青灯夜游Original
2022-06-16 18:25:244091browse

Processes in Linux are generally divided into three categories: "interactive process", "batch process" and "monitoring process". An interactive process is a process started by a Shell; an interactive process can run in the foreground or in the background. The batch process has no connection with the terminal and is a sequence of processes. The monitoring process, also called a daemon process, is a special process that runs in the background and is not controlled by any terminal. It is used to perform specific system tasks.

What are the three categories of processes in Linux?

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

What is a process

A process is a program or command being executed. Each process is a running entity and has its own address space and occupy certain system resources. Once a program is run, it is a process.

A process can be seen as an instance of program execution. A process is an independent entity allocated system resources, and each process has an independent address space. One process cannot access the variables and data structures of another process. If you want one process to access the resources of another process, you need to use inter-process communication, such as pipes, files, sockets, etc.

Process classification

In the Linux operating system, processes can be roughly divided into 3 different types, each Each process has its own characteristics and attributes.

  • Interactive process: A process started by a Shell. The interactive process can run in the foreground or in the background.

  • Batch process: This process has no connection with the terminal and is a sequence of processes.

  • Monitoring process: Also called daemon process, it is a special process that runs in the background and is not controlled by any terminal. It is used to perform specific system tasks.

The composition of the process

A process contains a part of the address space and a series of data structures in the kernel. The address space is a part of the memory marked by the kernel for use by the process, and the data structure is used to record the specific information of each process.

The most important process information includes:

  • The address space map of the process

  • The current status of the process (sleeping, stopped , runnable, etc.)

  • Execution priority of the process

  • Resource information called by the process

  • Information about files and network ports opened by the process

  • Signal mask of the process (indicates which signals are blocked)

  • Owner of the process

Process status

  • Runnable status: The process is running at this time Or waiting in the running queue to prepare to run
  • Waiting state (blocking state): At this time, the process is waiting for an event to occur or some system resource. In the Linux system, the waiting state is subdivided into two waiting states: interruptible waiting state and uninterruptible waiting state
    • Interruptible waiting state: A process in an interruptible waiting state can be interrupted by a certain signal
    • Uninterruptible waiting state: In an uninterruptible waiting state The process is not disturbed by signals and will always wait for the occurrence of an event or some system resource
  • Suspended state: The process in the suspended state is suspended
  • Zombie state: Each process will be in a zombie state after running, waiting for the parent process to call and then release system resources. The process in this state has finished running, but its parent process is still Its system resources are not released

Related recommendations: "Linux Video Tutorial"

The above is the detailed content of What are the three categories of processes in Linux?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn