当前位置:网站首页>Process priority nice
Process priority nice
2022-07-30 03:32:00 【great prisoner】
Ubuntu Touch's ssh service will have a lag problem, which can actually be alleviated by increasing the ssh connection priority through the nice value
Process priority nice
- Linux process scheduling and multitasking
- Relative priority nice
- View the nice level of the process
- Start processes with different nice levels
- Change the nice level of an existing process
Linux Process Scheduling and Multitasking
Each CPU (or CPU core) can only process one process at a time point. Through the time slice technology, the actual number of processes (and threads) that Linux can run can
The actual available CPU and coresquantity.The Linux kernel Process scheduler quickly switches multiple processes on the CPU core, giving the user the impression that multiple processes are running at the same time.
relative priority nice
Since not every process is as important as others, tell the Process Scheduler to use different scheduling strategies for different processes.The scheduling policy used by most
processes running on regular systems is SCHED_OTHER (also known as SCHED_NORMAL), but there are other scheduling policies for different purposes.
The relative priority of the process run by the
SCHED_OTHER scheduling policy is called the nice value of the process, and there can be 40 different levels of nice value.

Higher value of nice: means lower priority, eg +19, the process tends to cede CPU usage to other processes.
The lower the nice value: the higher the priority, eg -20, the less likely the process is to give up the CPU.
View the nice level of the process
1. Use top to view nice level
NI: actual nice level
PR: show nice level as mapped to larger priority queue, -20 to 0, +19 to 39
3. Use ps to check the nice level
[[email protected] ~]# ps axo pid,command,nice --sort=-nice
[[email protected] ~]# ps axo pid,command,nice,cls --sort=-nice
TS indicates that the scheduling policy used by the process is SCHED_OTHER
Start processes with different nice levels
When starting a process, it usually inherits the nice level of the parent process, which defaults to 0.
[[email protected] ~]# nice -n -5 sleep 6000 &
[[email protected] ~]# ps axo command,pid,nice |grep sleep
[[email protected] ~]# nice -n -20 service httpd start
[[email protected] ~]# ps axo pid,command,nice,cls |grep httpd
11116 /usr/sbin/httpd-20 TS
11119 /usr/sbin/httpd -20 TS
11120 /usr/sbin/httpd -20 TS
11121 /usr/sbin/httpd -20 TS
11122 /usr/sbin/httpd -20 TS
11123 /usr/sbin/httpd -20 TS
11124 /usr/sbin/httpd -20 TS
11125 /usr/sbin/httpd -20 TS
11126 /usr/sbin/httpd -20 TS
Change the nice level of an existing process
1. Use top to change the nice level
r Adjust the priority of the process (Nice Level) (-20 high) ---0--- (19 low)
2. Change nice level using shell
[[email protected] ~]# sleep 7000 &
[3] 10089
[[email protected] ~]# renice -20 10089
10089: oldpriority 0, new priority -20
边栏推荐
- 新手入门上位机开发 C#语言:PC串口发送数据
- Is the snowflake the same question?
- 群论-Burnside引理与Polya定理 三千字
- MyCat中对分库分表、ER表、全局表、分片规则、全局序列等的实现与基本使用操作
- 【JS】iframe 嵌入页面用法
- Answer these 3 interview questions correctly, and the salary will go up by 20K
- Overview of Federated Learning (1) - Background, Definition and Value of Federated Learning
- 记录NLP各种资源网址
- FreeRTOS个人笔记-内存管理
- [C Supplement] Conversion of Integer to String
猜你喜欢
随机推荐
Overview of Federated Learning (2) - Classification, Framework and Future Research Directions of Federated Learning
Simple Operations on Sequence
[3D检测系列-PointRCNN]复现PointRCNN代码,并实现PointRCNN3D目标检测可视化,包含预训练权重下载链接(从0开始以及各种报错的解决方法)
un7.29:Linux——centos中如何安装与配置redis?
厉害,腾讯技术专家手撸Redis技术笔记,下载量已突破30W
基于数据驱动故障预测的多台电力设备预测性维护调度
A. Strange Birthday Party- Codeforces Round #694 (Div. 1)
JUC (7): Thread Safety Analysis of Variables
【无标题】
SQL 入门之第一讲——MySQL 8.0.29安装教程(windows 64位)
新手入门C#:实现简易的计算器功能
路由过滤器
使命、愿景、价值观到底有什么区别
Open address method hash implementation - linear detection method
un7.29: How to install and configure redis in Linux-centos?
开放地址法哈希实现——二次探测法
The most important transport layer
QT based on the third day (3) widget, dialog and mainwindow
传输层详解
LoadBalancer 负载均衡







