Linux programs and resource management

Source: Internet
Author: User
Tags dmesg

Use Man command to view online Help

The executable binary is the program

ID, called PID, obtained by triggering an event when executing a program

?

When we log into the system, we get a bash shell pid. We can use Bash to provide the interface to execute another program, this additional execution of the program will also get a PID, this PID is a subroutine. And our bash environment is the parent program.

Memory-resident Program: Crond ATD, Syslog, Apache, named, vsftpd ... System or NETWORK Service

Procedures to exit after execution: LS, touch, RM/MKDIR/CP/MV, chmod, Chown, passwd, etc.

?

▲ Operation Management

Bash Shell manages multiple jobs at the same time with a single terminal interface

Each job program must be a shell subroutine

Each job program cannot wait for Terminal/shell input

?

▲ Backstage and front desk

The foreground is a job that the user can control foreground

background is a self-operating operation in memory, the user needs BG/FG wait for instructions to get the job out.

?

jobs [-lrs] observe the current background job status

???? Parameters - L???????? also lists PID

???? Parameters - R???????? list is only in the background Run 's work

???? Parameters - s???????? list is only in the background Stop 's work (+ represents default,FG overrides default Job )

?

FG [%]jobnumber???? Get background jobs to the foreground

BG???? make a job in the background

Ctrl + Z???????? put the current job in the background to pause

?

Kill–signal%jobnumber

???? Parameters - L???????? List the current Kill can use the Signal What are

???? Signal???????? What tips for the back job, with Mans 7 Signal know

???? Parameters -1???????? re-reading the settings file for the parameter once

???? Parameters -2???????? Representative Ctrl + C

???? Parameters -9???????? force deletion of a job immediately

???? Parameters -15???? terminate a work in a normal way

?

▲ Process Management

if Linux The system is busy and when the entire system resource is exhausted, we should identify the process that consumes the most system resources and then delete the process or lower its execution permissions

If a program is zombie Zombie , we should find it and kill it.

?

Observations of the process:

PS???????? a static viewing process ???? Process status

Top???????? Dynamic Viewing process ???? Top [-d] top [-BNP]

pstree???????? Lookup The relationship between programs ???? Pstree [-aup]

?

Stat Current in State

???? R can run D wait for disk S to be tracked or stopped in sleep T

Additional flags

???? W process is swapped out < process has a higher priority than the normal priority N process has a lower priority than the normal priority L Some pages are locked in memory s process is session-first-to-process

RSS???? represents the number of pages in memory

?

Killall [-ile] [ command name ]???? kill all processes related to the program directly by the name of the program

???? Parameters - I.???????? Interactive Interactive to prompt the user whether to delete

???? Parameters - L???????? instruction name ignores case

???? Parameters - e????????

?

Free [-BKMGTV]???????? displays system resource memory and buffers, etc.

?

uname [-asrmnopiv]???? Display Computers and OS the relevant information

?

uptime???????? Displays the current time of the system, the time of the boot, the number of landings and load, etc.

w,top???????? have a Uptime the same display information

DMESG???????? Display power-on information and view directly /VAR/LOG/DMESG

SAR [-ru]???? Detecting the resource status of a host

netstat [-atunlp]???? apply to Network monitoring

?

Linux The system invokes the processes according to the priority of each process. Priority can be adjusted using the courtesy of Nice

???? PRI (new) = PRI (old) + Nice

for a normal user, where the newly created process inherits the humility value from its parent process, the owner of the process can increase the humility value, but it cannot reduce Nice to prevent low-priority processes from deriving high-priority child processes. Super users are free to set up Nice

Nice [-n] Command

Renice [number] PID

?

fuser [-ki] [-signal] file/dir???? find a process that uses the file or directory based on a file or directory

?

/proc File System

???? The PS and top commands for Linux are all read from the /proc directory to the status information of each process. The kernel places meaningful information about the state of the system in this pseudo-directory. Process-specific information is placed in a subdirectory of the PID name, respectively.

?

/proc process information file under directory

???? CMD???????? the command or program that the process is executing

???? CmdLine???? complete command line of the process to NULL Split

???? CWD???????? symbolic link to the current directory of the process

???? Environ???? environment variables for processes

???? EXE???????? link to the symbolic connection of the file being executed

???? FD???????? subdirectories, which contain links to the descriptors of each open file

???? Maps???????? Memory Mapping Information

???? Root???????? symbolic link to the root of the process

???? State???????? the overall state of the process

???? STATM???????? Memory usage Information

?

lsof [-uu] [+d]???????? find out which files and directories are open or used by a process

pidof [-sx] program_name???? find out which programs are running PID

????

?

Linux programs and resource management

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.