Firstly, exec
family of system calls does not executes it's own image rather it executes the binary it loads. As per man exec
:
The exec() family of functions replaces the current process image with a new process image.
So, it'll behave how that particular executable image was prepared to be scheduled.
When a process it marked to be scheduled as SCHED_BATCH
, they will be scheduled based on their nice values just like SCHED_OTHER
. Since, batch tasks doesn't require user interaction therefore scheduler treats the task as CPU-intensive. As per man sched_setschedparam
quote from 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.
Therefore, if you change a process's scheduling policy to SCHED_BATCH
, it'll be scheduled just like almost any other normal processes (SCHED_OTHER, the default scheduling policy). If you want to fallback to the fully default behavior then you have to utilize SCHED_RESET_ON_FORK
flag ORed with the scheduling policy. If you specify that flag, any newly created process will fallback to default scheduling policy rather copying parent's behavior.
Hope this helps!