ionic
A process can have three scheduling categories:
Idle
Programs running at Idle io priority will only get disk I/O processing time when no other programs request disk I/O. Idle scheduling type does not take any parameters. From kernel 2.6.25, Idle scheduling type can allow ordinary users to use
Best effort
This is an effective scheduling type for any process that has not applied for a specified io priority. This type will take a priority parameter, 0-7, the smaller the number, the higher the priority. If multiple processes have the same priority, the Linux kernel will provide I/O services for them in a round-robin polling manner.
Real time
Processes using this scheduling type will access the disk as soon as possible regardless of any other tasks on the system. You need to be careful when using the RT scheduling type in this way, because it may starve other processes. Like best effor, RT also has 8 priority levels. RT does not allow ordinary users to use it.
Options:
-c
class specifies the scheduling type, 0 means none, 1 means real time, 2 means best effort, 3 means idle
Case:
Set the I/O scheduling type of the process with PID 18944 to Idle
$ sudo ionice -c 3 -p 18944
View the I/O scheduling type and priority of the process with PID 18944
$ sudo ionice -p 18944
nice
nice
Means niceness
, that is, the degree of friendliness and humility. Used in a process, it indicates the priority of the process, that is, the friendliness of the process. niceness
When the value is negative, it means high priority, which can be executed in advance and obtain more resources, corresponding to low friendliness; otherwise, it means low priority and high friendliness.
Options: The
-n
option is followed by a specific niceness value. The range of niceness values, values -20~19
less than -20 or greater than 19 are recorded as -20 and 19, respectively.
默认优先级为0
Case
$ nice -n 10 vi&
View the scheduling priority of the process
ps -efl
NI
: Indicates the process priority