使用chrt命令能夠很簡單地更改調度策略.bash
$ chrt --help Scheduling policies: -b | --batch set policy to SCHED_BATCH -f | --fifo set policy to SCHED_FIFO -i | --idle set policy to SCHED_IDLE -o | --other set policy to SCHED_OTHER -r | --rr set policy to SCHED_RR (default)Options: -h | --help display this help -p | --pid operate on existing given pid -m | --max show min and max valid priorities -v | --verbose display status information -V | --version output version information
確認某個進程的屬性能夠經過指定 -p 或 --pid 並指定進程ID,用法以下:app
# chrt -p 468 pid 468's current scheduling policy: SCHED_FIFO pid 468's current scheduling priority: 85 # chrt -p 476 pid 476's current scheduling policy: SCHED_OTHER pid 476's current scheduling priority: 0
eg:ide
將PID 1000 的進程設定成 SCHED_FIFO,優先級設定成50。 # chrt -f -p 50 1000 將PID 1000 的進程設定成 SCHED_OTHER,優先級設定成0。 # chrt -o -p 0 1000 起動 /bin/my-app 設定成 SCHED_FIFO,優先級設定成36。 # chrt -f 36 /bin/my-app
chrt 命令的策略選項this
短選項orm
長選項進程
詳細ci
-f --fifo 調度器設成 SCHED_FIFO it
-o --other 調度器設成 SCHED_OTHER io
-r --rr 調度器設成 SCHED_RR form