首先, exec 系统调用系列不执行它自己的图像,而是执行它加载的二进制文件。按照 man exec :
exec
man exec
The exec() family of functions replaces the current process image with a new process image.
因此,它将表现出如何准备安排特定的可执行映像。
当一个进程标记为被安排为 SCHED_BATCH ,他们将根据他们的好价值进行安排 SCHED_OTHER 。由于批处理任务不需要用户交互,因此调度程序将任务视为CPU密集型。按照 man sched_setschedparam 引用自 SCHED_BATCH: Scheduling batch process -
SCHED_BATCH
SCHED_OTHER
man sched_setschedparam
SCHED_BATCH: Scheduling batch process
This policy is similar to SCHED_OTHER in that it schedules the process according to its dynamic priority (based on the nice value).The difference is that this policy will cause the scheduler to always assume that the process is CPU-intensive. Consequently, the scheduler will apply a small scheduling penalty with respect to wakeup behaviour, so that this process is mildly disfavored in scheduling decisions.
因此,如果您将进程的调度策略更改为 SCHED_BATCH ,它将像几乎任何其他正常进程一样进行调度(SCHED_OTHER,默认调度策略)。如果您想要回退到完全默认行为,那么您必须使用 SCHED_RESET_ON_FORK flag与调度策略ORed。如果指定该标志,则任何新创建的进程都将回退到默认调度策略,而不是复制父进程。
SCHED_RESET_ON_FORK
希望这可以帮助!