Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the common command nice in Linux

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to use Linux common command nice, has a certain reference value, interested friends can refer to, I hope you have a lot of gains after reading this article, let Xiaobian take you to understand.

The nice command executes programs with changed priority, and if no program is specified, prints the current scheduling priority, with a default adjustment of 10, ranging from-20 (highest priority) to 19 (lowest priority).

nice [-n adjustment] [-adjustment][--adjustment=adjustment] [--help] [--version] [command [arg...]] Parameter Description:

-n adjustment, -adjustment, -adjustment=adjustment is an increase in the priority of the adjustment

- help Display help messages

- version Displays version information

Instance Sets the run-time priority of the program

# vi & //background [1] 15297 # nice vi & //set default priority [2] 15298 [1]+ Stopped vi # nice -n 19 vi & //Set priority to 19 [3] 15299 [2]+ Stopped nice vi # nice -n -20 vi & //Set priority to-20 [4] 15300 [3]+ Stopped nice -n 19 vi # ps -l //Display process F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD 4 S 0 15278 15212 0 80 0 - 1208 wait pts/2 00:00:00 bash 0 T 0 15297 15278 0 80 0 - 2687 signal pts/2 00:00:00 vi 0 T 0 15298 15278 0 90 10 - 2687 signal pts/2 00:00:00 vi 0 T 0 15299 15278 1 99 19 - 2687 signal pts/2 00:00:00 vi 4 T 0 15300 15278 3 60 -20 - 2687 signal pts/2 00:00:00 vi 4 R 0 15301 15278 0 80 0 - 625 - pts/2 00:00:00 ps [4]+ Stopped nice -n -20 vi Increase the priority of ls by 1 and execute

nice -n 1 ls increases the priority of ls by 10 and executes

nice ls Note: Priority is a parameter used by the operating system to determine CPU allocation. Linux uses a round-robin algorithm for CPU scheduling. The higher the priority, the more CPU time it is possible to get.

Thank you for reading this article carefully. I hope that the article "How to use nice Linux common commands" shared by Xiaobian will be helpful to everyone. At the same time, I hope that everyone will support you a lot and pay attention to the industry information channel. More relevant knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report