当前位置:网站首页>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
边栏推荐
- 使命、愿景、价值观到底有什么区别
- Are you still using the command line to read logs?Quickly use Kibana, visual log analysis YYDS
- The most important transport layer
- SQL Server数据类型转换函数cast()和convert()详解
- 厉害,腾讯技术专家手撸Redis技术笔记,下载量已突破30W
- JUC(八):synchronized小练习
- Open address method hash implementation - linear detection method
- redis的学习_基础部分
- REUSE_ALV_GRID_DISPLAY详解
- The relationship between the number of Oracle processes and the number of sessions
猜你喜欢
随机推荐
记录NLP各种资源网址
CDH/CDP 是什么?
淘宝/天猫获取卖出的商品订单列表 API
中级-面试题目整理
un7.29: How to install and configure redis in Linux-centos?
监控页面部署
Nacos 安装与部署
Nacos服务注册与发现
测试人员,除了测试还得会点什么
淘宝H5接口获取app数据6.0格式
解决导航栏变黑色
Nacos集群分区
精品:淘宝/天猫获取购买到的商品订单详情 API
golang的channel实现原理
[3D检测系列-PointRCNN]复现PointRCNN代码,并实现PointRCNN3D目标检测可视化,包含预训练权重下载链接(从0开始以及各种报错的解决方法)
Nacos实现高可用
SQLSERVER将子查询数据合并拼接成一个字段
微服务进阶 Cloud Alibaba
Nacos配置中心
朴素贝叶斯分类








