![Forrest logo](/images/logo.png)
ionice:tldr:3fa12
The ionice
command is used to set or get the I/O scheduling class and priority for a process. It allows you to control the input and output (I/O) priority of a process, which can be helpful in managing system resources and improving performance.
The command has two options:
-
-c ${scheduling_class}
: This option is used to set the I/O scheduling class. The${scheduling_class}
represents the scheduling class you want to assign to the process. The available classes are:0
ornone
: No scheduling class (default).1
orrealtime
: Real-time scheduling class, which gives the highest priority to the process.2
orbest-effort
: Best-effort scheduling class (default for most processes).3
oridle
: Idle scheduling class, which gives the lowest priority to the process.
By specifying the scheduling class, you can determine how the process's I/O operations are prioritized.
-
-p ${pid}
: This option is used to specify the process ID (PID) of the target process for which you want to set or get the I/O priority. The${pid}
represents the PID of the process.
By combining these options, the ionice
command allows you to set the I/O scheduling class and priority for a specific process. For example, if you want to set the scheduling class to "best-effort" and adjust the priority of a process with PID 1234, you would use the command:
ionice -c 2 -p 1234