良好的流程优先于子流程 [英] Niced process gives their priority to child process

查看:126
本文介绍了良好的流程优先于子流程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已使用以下命令将sshd进程设置为最高优先级:

nice -n -20 /sbin/sshd

但是默认情况下,它也会对子进程(/bin/sh)赋予最高优先级.那么,是否可以给子进程正常的优先级(0)而不是最高的优先级?

解决方案

不可能给正常进程的子进程以正常的优先级,但是我们可以在父派生子级之前在代码中分配正常的优先级,这样我们就可以为子进程.

请参阅 setpriority ,以设置代码中任何进程的优先级 >

I have given highest priority to sshd process using following command:

nice -n -20 /sbin/sshd

But it will give highest priority to child process (/bin/sh) also by default. So, is it possible to give normal priority (0) to child process instead of highest priority?

解决方案

Its not possible to give normal priority to child process of niced process but we can assign normal priority in code before parent forks child this way we can assign normal priority to child process.

Refer setpriority for setting priority for any process from code

这篇关于良好的流程优先于子流程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆