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

Source: Internet
Author: User
Tags dmesg

Prioritized execution (priority, PRI)

The lower the PRI value, the more preferential the meaning. Only the 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! Generally speaking. The relevance of the PRI to NI is as follows:

PRI (new) = PRI (old) + Nice

It's just that you have to pay special attention. Suppose the original PRI was 50. Not that we give a nice = 5, it makes the PRI 55!

Since the PRI is determined by the system "dynamic". So. Although the nice value is able to influence the PRI, it is only after the system analysis that the final PRI is determined.

In addition, the nice value is positive or negative, and since the smaller the PRI, the sooner it is executed. So. When the nice value is negative, the process reduces the PRI value. That is, it becomes more preferred to be processed. In addition, you must be aware that:

The nice value can be adjusted to a range of-20 ~ 19.
Root can arbitrarily adjust the nice value of himself or others program, and the range is 20 ~ 19;
The average user can only adjust the nice value of his or her process to only 0 ~ 19 (to avoid the general users from seizing system resources).
The general user can only adjust the nice value higher, such as the original Nice is 5, the future can only be adjusted to greater than 5;

Nice: The newly executed 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 execute VI, and observe the process.


The original bash PRI was 80. So the vi default should be 80. It is only given nice to be-5, so the PRI of VI is reduced!

But not necessarily all are reduced to 75, because the core will also be dynamically adjusted!


Renice: Nice again adjustment of already existing program

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 units displayed are Kbytes, we are able to use B (bytes), M (Mbytes)      K (Kbytes), and G (GBytes) to display the units.  -T: the output finally results. Displays the total amount of solid memory and swap. 

Eg: shows the memory capacity of the system at the moment



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 number-M  : The hardware name of the system, such as i686 or x86_64;-P  : The type of CPU, similar to-M, only 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 the connections, listening, and Socket data for the current system-T  : Lists the data of the TCP network packets-U  : Lists the data of the UDP network packets-n  : Not the service name of the program. indicated by port number;-L  : Lists the services currently in network listening (listen). -  P

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



DMESG: Analyzing the information generated by the core


DMESG shows too much information. At execution time, the pipeline command is typically added to retrieve the required information.


Vmstat: Detecting System Resource changes

[Email protected] ~]#Vmstat [-A] [delay [total number of measurements]] <==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 cutting Groove] <== related to diskOptions and Parameters:-A: Use Inactive/active (active or not) instead of buffer/cache memory output information;-F: The number of programs that have been started up to the present, System replication (fork);-S: Memory changes caused by some events (up to now) A list of conditions is described. -S: Can be followed to the unit, so that the display of data units. For example, the capacity of k/m instead of bytes;-D: Lists disk read and write totals table-P: The cutting slots are listed later. can display the total reading and writing statistics of the cutting 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 awaiting execution. B: The number of processes that cannot be awakened.

The more these two items, the busier the system is (because the system is too busy.) So many processes cannot be executed or are waiting to be awakened.

The internal level (memory) items are:
SWPD: The capacity of virtual memory to be used. Free: Memory capacity that has not been used. Buff: used to buffer memory; cache: used for fast 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 to write the unused process to the swap of the disk due to insufficient memory. Suppose the value of si/so is too large. Indicates that the data in memory is often transmitted between the disk and the main memory, the system performance will be very 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.

Assuming that the value of this part is higher, the I/O on behalf of the system is busy.

Systems (System) projects are:
In: Number of processes interrupted per second; CS: Number of events per second; These two values are larger. The representative system communicates with the peripheral equipment very frequently! 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


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

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.