当前位置:网站首页>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
边栏推荐
- leetcode每天5题-Day01
- 3.nodejs--modularization
- One book 1922 - table tennis
- JUC (four): five/six states of shorthand thread
- CDH/CDP 是什么?
- MyCat中对分库分表、ER表、全局表、分片规则、全局序列等的实现与基本使用操作
- 历经5面的阿里实习面经篇~
- Stimulsoft ReportsJS and DashboardsJS. 2022.3.3
- Three years of experience will only be a little bit (functional testing), and you may not even be able to find a job after resigning.
- 阿里云EasyNLP中文文图生成模型带你秒变艺术家
猜你喜欢

HCIP experiment (05) OSPF comprehensive experiment

Solve The problem of Google browser cross-domain has had been blocked by CORS policy: The request The client is not a secure context and The resou

NLP自然语言处理(二)

传输层详解

应用在光伏逆变器中的IGBT晶圆

HCIP OSPF

Software testing interview questions and answer analysis, the strongest version in 2022

SQL 入门之第一讲——MySQL 8.0.29安装教程(windows 64位)

新手入门C#:实现简易的计算器功能

OpenFeign实现负载均衡
随机推荐
使命、愿景、价值观到底有什么区别
CF1473C No More Inversions
JIT VS AOT
SQL Server中如何在date类型中提取年、月、日数据
OpenFeign实现降级
JUC(八):synchronized小练习
Overview of Federated Learning (1) - Background, Definition and Value of Federated Learning
Nacos集群分区
Software testing interview questions and answer analysis, the strongest version in 2022
中级-面试题目整理
26 basic models in 6 categories that operators must master
2022-07-29 第四小组 修身课 学习笔记(every day)
day10--在Linux上安装mysql
NLP自然语言处理(二)
22/07/21
JUC(六):synchronized
动态绑定href url
OPENSQL
北京bgp机房和普通机房的区别
【SQL】按某个关联列用一张表的数据更新另一张表