ionice 获取和设置程序的IO调度与优先级
help
$ ionice --help
ionice - sets or gets process io scheduling class and priority.
Usage:
ionice [OPTION] -p PID [PID...]
ionice [OPTION] COMMAND
Options:
-c, --class <class> scheduling class name or number
0: none, 1: realtime, 2: best-effort, 3: idle
-n, --classdata <num> scheduling class data
0-7 for realtime and best-effort classes
-p, --pid=PID view or modify already running process
-t, --ignore ignore failures
-V, --version output version information and exit
-h, --help display this help and exit
说明:
scheduling class name or number
0: none
空闲磁盘调度1: realtime
实时调度策略,若设置,则立即访问磁盘2: best-effort
默认优先级,优先级参数(范围是0~7,数值越小,优先级越高)3: idle
当前系统没有其他进程需要进行磁盘IO时,才能进行磁盘
示例
# 打印进程号为 88 和89 的调度策略和IO优先级
$ ionice -p 88 91
# 设置进程号为 88 的进程调度策略为 idle
$ ionice -c 3 -p 88
# 运行bash,并设置调度策略是 best-effort,最高优先级
$ ionice -c 2 -n 0 bash
# 设置当前的进程磁盘IO调度策略为 idle 类型
$ ionice -c3 -p $$