"Linux_ Notes" Linux process Management (PS)

Source: Internet
Author: User

Learning resources from: www.magedu.com

The learning record process is inevitably error, the example is for reference only, the great god please ignore.


Process Management Related commands:
Ps:process State (Process status)
SYSV Style:-elf
Common Command formats:
Ps-e
Ps-el | Head
ps-elf | Head
Ps-ef (Common)

BSD style: PS aux | Head
A: Display of terminal-related processes (not absolute)
U: Show more information
X: Show non-terminal processes (not absolute)

Display content:
RSS: Resident Memory Set (data that cannot be swapped to hard disk)
VSZ: Virtual Memory Set
Process status (STAT):
D: Non-disruptive sleep
R: Run or ready
S: interruptible Sleep
T: Stop
Z: Zombie

<: high-priority process
N: Low-priority process
+: Processes in the foreground process group
L: Multithreaded Process
S: Session process first Process
[]: Kernel thread

-O: Specify display fields

Ps-o Property1,property2

Ps-axo Pid,comm,ni | Head
PA aux | grep "Bash" (Find process)
Pstree: Show Process Tree
Pgrep: Finding the specified process in grep style
Pgrep-u root bash//root user as host and bash process
Pgrep bash//show only process numbers
PIDOF: Find the process number according to the program name
Top: Monitoring the running status of the process
CPU (s): Average
1: Expand

Command:
M: Sort based on the size of the resident memory
P: Sort by CPU percent usage
T: Sort by cumulative time

L: Show average load and start time
T: whether to display process and CPU status related information
M: whether memory-related information is displayed

C: Whether to display full command line information
Q: Exit Top
K: Terminate a process

Options:
-D: Specify the delay length in seconds
-B: Batch mode (flip screen)
-N #: Total number of batches displayed in batch mode

Vmstat: System Status View command
Vmstat N m: refreshes every n seconds, showing only M
Free: View disk consumption status
Kill
Kill PID: Terminates a process
Kill%jobid: Terminate a job
Killall COMMAND: Terminates all processes under a program

Kill-l: Show all available signals
Important Signals:
1:sighup: Allow a process to reread its configuration file without restarting, and let the new configuration information take effect
2:sigint:ctrl+c: Interrupts a process
9:sigkill: Kill a process
15:sigterm: Terminates a process (default signal)
Specify the mode of the signal:
Signal Number: KILL-1
Signal Name: Kill-sigkill
Signal Name: Kill-kill
Pkill (similar to pgrep)
BG: Background jobs: occupy the command prompt
BG [%]jobid: Start a background job
FG: Foreground job: After startup, release the command prompt, and subsequent operations are completed in the background
FG [%]jobid: Returning a background job to the foreground

Front desk--Backstage:
CTRL + Z: Send the foreground job to the background (the default job status is stop)
Command &: Let commands execute in the background

Jobs: View all jobs in the background
(Job number differs from process number)
+: Command will default action for jobs
-: command to assign a second default action to the job

Uptime:top First line of information

Adjust nice values: (Adjust process priority)
1, Process has started: Renice NI PID
2. Specify a nice value at startup: Nice-n NI COMMAND

Cat/proc/meminfo: Viewing memory information
Cat/proc/pid/maps: Viewing specified process memory information


================= process Management Related concepts ==================

Memory: Linear memory, physical memory
Kernel data structure:
Task struct
Pid:7
Ppid
Name
...
Abbreviation Explanation:
Mmu:memory Management Unit Memory Management Unit
Tlb:translation lookaside Buffer Bypass conversion buffer (block table)
Context Switch: Contextual switching (process switching)
RSS: Resident Memory Set (data that cannot be swapped to hard disk)
VSZ: Virtual Memory Set
Pid:process ID Process Number PPID-parent process Number (init process number 1)
Ipc:inter Process Communication interprocess communication

Process:
Process number
Memory space
User
Parent process
CPU time

Process Execution Features:
Multicore system: One CPU can only execute one process at a time
Parallel programming model (multithreaded model): threads.
(Dividing a process into multiple execution streams (executing entities) to enable a process to run concurrently on multiple CPUs)
Process: Allocating resources
Threads: Shared resources allocated by the process, responsible for running
Issues to be addressed: Sync: Lock ... (Spin Lock)

Process status: Stop, Ready, execute, sleep, zombie (process ended but memory not released)
Sleep state type:
Uninterruptib sleep: Non-disruptive sleeping: external resources required (open file)
Interruptable sleep: Sleeps can be interrupted

Parent-child relationship for a process:
Kernel: (God)
Init: The first process generated by the kernel, which is the parent process for all other processes
Pstree: Show Process Tree

Priority level: 0-139
100-139: Users can control
Nice value: -20~19 corresponds to 100~139,nice value the higher the priority level
(Ordinary users can only adjust the nice value of their own process)
0-99: Can only be adjusted by the kernel

High-priority features:
1. Get more CPU Run time
2, more preferential access to operational opportunities

Process Information Location:/proc (a process number corresponds to a process)
Classification of processes: terminal-related processes, terminal-independent processes






This article from "Not Daze" blog, please make sure to keep this source http://tobeys.blog.51cto.com/10620284/1721980

"Linux_ Notes" Linux process Management (PS)

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.