1

我正在运行一个具有最高优先级的二进制文件,例如

nice -n -20 binary

现在我想运行相同的二进制文件,使其以高优先级运行,而无需nice -n 20 二进制文件

 ./binary // runs with high priority same as nice -n -20 binary with any setting

当我用 ./binary 启动二进制文件时,是否有任何配置说内核以更高的优先级启动进程,我不会每次都用nice -n -20 二进制文件启动二进制文件

那么怎么做给你的建议

4

3 回答 3

3

你可以为它创建别名

alias binary='nice -n -20 binary'

之后,如果你执行二进制,那么它将以更高的优先级开始

于 2014-06-28T06:53:48.200 回答
2

Create a script that contains your nice command, and run that instead.

e.g.

echo  nice -n -20 binary > binary2
chmod +x binary2

And then to run it, just do this:

./binary2
于 2014-06-28T06:04:29.113 回答
0

我相信你想要这样的东西,

sudo nice -n -20 ./binary

info coreutils 'nice invocation'

只有特权用户可以运行具有较低友好度的进程:

于 2014-06-28T05:06:25.873 回答