Linux Process Management-Pri,nice,free,uname,netstat

Source: Internet
Author: User
Tags dmesg

Priority run order (precedence, PRI)

The lower the PRI value, the more preferential the meaning. However, this PRI value is dynamically adjusted by the core, and the user cannot directly adjust the PRI value.


Because the PRI is the core dynamic adjustment, our users also have no right to interfere with the PRI! If you want to adjust the priority of the process, you have to pass the nice value! Nice value is the NI on the table! In general, the relevance of PRI to NI is as follows:

PRI (new) = PRI (old) + Nice

However, you should be particularly aware that if the original PRI is 50, it is not that we give a nice = 5, it will make the PRI become 55 Oh! Because the PRI is the system "dynamic" decision, although the Nice value can affect the PRI, however, the final PRI is still to be determined after a systematic analysis. In addition, the nice value is positive or negative, and since the smaller the PRI is, the lower the value is, the less the PRI value is, and the higher the precedence is processed. In addition, you have to be aware that:

The nice value can be adjusted to a range of-20 ~ 19;
Root is free to adjust the nice value of his or her program, with a range of-20 ~ 19;
General users can only adjust the nice value of their own process, and the range is only 0 ~ 19 (to avoid the general user preemption system resources);
The average user can only adjust the nice value higher, for example, Nice is 5, the future can only be adjusted to greater than 5;

Nice: The newly run command gives the new nice value

Nice [-n number] command options and Parameters:  -N: followed by a value, the range of values-20 ~ 19. 

Eg: use root to give a nice value of-5, to run VI, and observe the process.


The original bash PRI is 80, so the VI default should be 80. But since Nice was given 5, the PRI of VI was lowered! But not necessarily reduced to 75, because the core will also be dynamically adjusted!

Renice: Nice re-adjustment of existing programs

renice [number] PID options and Parameters: PID: The ID of a program! 

Eg: Find your own bash PID and adjust the nice of the PID to 10



Free: Observe memory usage

Free [-b|-k|-m|-g] [-t] Options and Parameters:-B  : When you enter free directly, the unit displayed is Kbytes, we can use B (bytes), M (Mbytes)      K (Kbytes), and G (GBytes) to display the unit! -T  : The final result of the output, showing the total amount of solid memory and swap. 

Eg: Displays the current system memory capacity



Uname: Access to system and core related consulting

uname [-asrmpi] Options and Parameters:-  A: All system related information, including the following data will be listed;-s  : System core Name  -r: Core version-M  : Hardware name of the system, such as i686 or x86_64;-P  : The type of CPU, similar to-M, just shows the type of CPU!  -I: Hardware platform (ix86)

Eg: basic consulting for the output system



Uptime: Observing the startup time and workload of the system



NETSTAT: Tracking network or slot files

Netstat-[ATUNLP] options and Parameters:  -A: Lists all connections, listening, and Socket data for the current system-T  : Lists data for TCP network packets-U  : Lists data for UDP network packets-n  : Not the service name of the program, the port number ( Port number) to display;  -L: Lists the services currently being monitored by the network (listen  );-P

Eg: Lists the network Connections and UNIX socket states that are currently created by the system



DMESG: Analyzing the information generated by the core


DMESG displays too much information, and the runtime typically joins the pipeline command to retrieve the required information.


Vmstat: Detecting System Resource changes

[Email protected] ~]#Vmstat [-a ] [delay [total number of detections]] <==cpu/Memory and other information[Email protected] ~]#Vmstat [-fs] <== Memory-related[Email protected] ~]#Vmstat [-S unit] <== Configuring units to display data[Email protected] ~]#Vmstat [-d] <== related to disk[Email protected] ~]#Vmstat [-P splitter slot] <== related to diskOptions and Parameters:-A: Use Inactive/active (active or not) to replace buffer/cache memory output information;-F: Boot up to date the number of system replication (fork) programs;-S: Memory changes caused by some events (up to date) A description of the condition list;-S: You can pick up units behind, so that the displayed data has units. For example, the capacity of k/m to replace bytes;-d: List disk read and write totals table-P: The split slots are listed later to show the total reading and writing statistics of the split slot

Eg: statistics current host CPU status, 1 times per second, total 3 times


The entries for the internal level (procs) are:
R: The number of processes waiting to run; B: The number of processes that cannot be awakened. The more these two projects, the busier the system is (because the system is too busy, so many processes cannot be run or waiting to be awakened).

The internal level (memory) items are:
SWPD: The capacity of virtual memory to be used; free: unused memory capacity; Buff: used to buffer memory; cache: used for caching. This part is the same as free.

The items for the memory replacement space (swap) are:
Si: The amount of the program removed from the disk; so: the capacity of the swap that is not used to write the unused process to the disk due to insufficient memory. If the value of the si/so is too large, it means that the data in memory is often transmitted between the disk and the main memory, the system performance will be poor!

Disk read and write (IO) items are:
BI: The number of chunks written by the disk; Bo: The number of chunks written to the disk. If the value of this part is higher, the I/O on behalf of the system is very busy!

Systems (System) projects are:
In: Number of processes interrupted per second; CS: Number of event switches per second; the larger the two values, the more frequent the communication between the system and the peripherals! These peripherals, of course, include disks, network cards, time clocks, and so on.

The CPU items are:
US: CPU usage status of non-core layer, SY: CPU state used by core layer, ID: idle state, WA: CPU state waiting for I/O, and ST: CPU usage state stolen by virtual machine.


Eg: all disk read and write status on the system


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Linux Process Management-Pri,nice,free,uname,netstat

Related Article

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.