使用
python我可以轻松地增加当前进程的好处:
>>> import os >>> import psutil >>> # Use os to increase by 3 >>> os.nice(3) 3 >>> # Use psutil to set to 10 >>> psutil.Process(os.getpid()).nice(10) >>> psutil.Process(os.getpid()).nice() 10
但是,似乎不允许降低进程的好处:
>>> os.nice(-1) OSError: [Errno 1] Operation not permitted >>> psutil.Process(os.getpid()).nice(5) psutil.AccessDenied: psutil.AccessDenied (pid=14955)