What is the relationship between all processes in Linux?

Updated on technology 2024-02-10
7 answers
  1. Anonymous users2024-02-06

    Use the pstree command to see the relationship between the processes, all processes are created by the initial init, and the parent process creates child processes one by one.

    Something like this (pid in parentheses).

    pstree -p

    init(1)-+acpid(4555)

    atd(18593)

    auditd(4256)-+audispd(4258)--4261)

    automount(4536)-+4537)..Omitted in between).

    xfs(4692,xfs)

    Check it out yourself with the command, it's clearer.

  2. Anonymous users2024-02-05

    Each process has a parent process, and all processes form a tree-like structure with the init process as the root.

    1. Process groupEach process will belong to a process group, and each process group can contain multiple processes. A process group will have a process group leader, and the PID of the leader process (see Linux Process Basics) becomes the process group ID (PGID) to identify the process group.

    2. Session

    Furthermore, if the shell supports job control, multiple process groups can also form a session. Bash (bourne-again shell) supports work control, while sh (bourne shell) does not.

    3. The concept of process group (work) is relatively simple and easy to understand. Whereas, a session is primarily established for a terminal. When you open multiple terminal windows, you are effectively creating multiple terminal sessions. Each session will have its own foreground and background work.

  3. Anonymous users2024-02-04

    Different processes have separate spaces with each other, and different threads of a process share space with each other!! This essential difference dictates that different processes do different tasks because they have their own space; Different threads of a process do something at a certain step of a task because they have the same space.

  4. Anonymous users2024-02-03

    In a multi-process scenario, each process has its own independent space, while in a multi-threaded scenario, threads within the same process share the spatial address of the process. As a result, creating a new process takes much less time to allocate system resources to it, while creating a new thread takes much less time.

    In terms of system scheduling, because the process address space is independent and the threads share the address space, the switching speed between threads is much faster than that between processes.

    In terms of communication mechanism, the data between processes is independent of each other, and the communication between them must be carried out in a special communication mode, and the communication must go through the operating system, while the thread is data sharing.

  5. Anonymous users2024-02-02

    Thread: is a path executed in a process, which is the smallest unit of system scheduling.

    Process: is a running program and is the smallest unit of resources allocated by the system.

    Thread-to-process relationship1.A process can have multiple threads, and a thread can belong to only one process.

    2.All threads in the same process share all resources in the same process.

    3.What really runs on the processor is the thread, not the process, which is an execution unit within the process, and is a schedulable entity within the process.

    Linux threads are different from processesProcess: Advantages: Multiple processes can utilize multiple CPUs at the same time, and can perform multiple operations at the same time.

    Disadvantages: Resource-intensive (create a process to re-open up memory space).

    The number of processes is not as good as possible, and the number of processes is generally equal to the number of CPUs.

    Threads: Advantages: Shared memory, especially when performing IO operations (network, disk) (CPU is rarely used for IO operations), and multi-threading can be used to perform concurrent operations.

    Disadvantages: Grab resources.

  6. Anonymous users2024-02-01

    I'm here to learn the answers.

  7. Anonymous users2024-01-31

    The following states are defined in the Linux kernel:

    define task running 0 define task interruptible 1 define task uninterruptible 2 define task zombie 4 define task stopped 8 where task running is ready and the process is currently only waiting for CPU resources.

    Task Interruptible and Task Uninterruptible are both blocking states, and the process is currently waiting for other system resources except the CPU; The former can be woken up by a signal, the latter cannot.

    Task zombie is a zombie state, the process has ended running, but the process control block has not been logged out.

    Task Stopped is a pending state and is mainly used for debugging purposes. The process will enter this state when it receives the sigstop signal, and will resume running again after receiving the sigcont.

Related questions
10 answers2024-02-10

Acids: HCl, HCO3, HCO3, HCO4, H2SO3, HNO3 bases: NaOH, KOH, Ca(OH)2, Mg(OH)2, Fe(OH)3 are the forms of metal + hydroxide. >>>More

7 answers2024-02-10

Examples of chemical equations for chemical reactions learned in junior high school are as follows: >>>More

12 answers2024-02-10

The only way to do that is to try to log in with a single user to see if root can be recovered. >>>More

16 answers2024-02-10

The social status quo is refracted through the bitterness of the workplace in the entertainment industry, but the real society is more cruel, and the society in the show is ideal.

3 answers2024-02-10

If the foundation is good, you can read the book directly and follow the operation. >>>More