Linux Foundation – Process and Service (1)

Process in Linux: an executable running instance that has been started

1, PID: process ID (each new process has a unique PID)

< p>2, PPID: the ID of the parent process

3, any process can create a child process

4, above redhat 7, the parent process of all processes: systemd< /p>

In redhat 5 and 6, the parent process of all processes: init

ps displays the status of the current process pair (the parameters of ps are very many, view it by man)

Share a picture

Common options:

-aux: List all processes

Share pictures

-ef: List all processes

share picture

-l: List processes related to the current user

Share a picture

-u user: view the process status of a user

share picture

top: You can view the real-time process status

share picture

The meaning of some letters in the above ps:

< p > Running:

    R: the process is running or waiting to run

 sleeping:

    S: sleeping but can be awakened

    D: Sleeping and cannot be awakened. The process is interrupted, which may cause an abnormal state of the device.

    K: Sleeping and cannot be awakened, the process can be interrupted.

  has been stopped:

    T: The process is stopped, but it can be restored by other processes

    T: the process being debugged

  zombie stop:

    Z: the child process sends a signal to the parent process when it exits, all resources except PID are released

    X: the parent process has acquired the structure of the child process, The child process can be completely released, and you can’t see it in the state process

In ps -aux

share picture

Process priority:

1,< high priority Level

2, n low priority

3, s contains child processes

4, + process group in the background

ps -aux parameter explanation

1, %CPU: occupied CPU usage rate

2, %MEM: occupied memory usage rate

3, VSZ: Occupied virtual memory size

4, RSS: Occupied memory size

5, TTY: the minor device number of the terminal (minor device number of tty)

6, STAT: the status of the itinerary

7, START: the time the process started

8, TIME: the execution time

9, COMMAND :Command executed

Process: an independent program run by Linux itself

Interactive process: a process started by a shell, which can run in the foreground, It can also run in the background

Batch process: it is a sequence of processes and has no connection with the terminal

Monitoring process (daemon): the process started when the Linux system is started, and Running in the background

Job: A process that is being executed, and the job can contain one or more processes.

Job control: Control the behavior of the running process. Such as: suspend a process, wait for a while and then execute it. This allows users to switch between multiple jobs.

&: Use this symbol after any command to allow the command to be executed in the background

jobs: You can view what is in the background Running job (front and back job status)

-l: In addition to listing the job number, PID is also listed

-r: List the jobs that only run in the background

-s: List jobs that are only suspended in the background

Share pictures

sleep: Delay a few seconds

share picture

ctrl + c: interrupt

ctrl + z: Hanging

share picture

< p>fg: transfer the background command to the foreground to continue execution, and cannot continue to put it back into the background

    % job number

bg: continue the execution of the suspended command in the background

    % job number

ps -j: display current job process information

  TGID: thread group ID number

  SID: reply ID number

share picture

Linux interrupt process

Signals: operations passed to the Linux process

kill -l displays all the signals that can be passed to the Linux process

Commonly used:

kill -9 PID: kill the iyge process-force

kill -15 PID: terminate a process in a normal way

kill -2: with ctrl+ The operation of c is the same

Share a picture

Share a picture

Leave a Comment

Your email address will not be published.