Does the Linux scheduler prefer to run child process after fork()? -


does linux scheduler prefer run child process after fork() father process?

usually, forked process execute exec of kind so, better let child process run before father process(to prevent copy on write).

i assume child execute exec first operation after created.

is assumption (that scheduler prefer child process) correct. if not, why? if yes, there more reasons run child first?

to quote the linux programming interface (pg. 525) general answer:

after fork(), indeterminate process - parent or child - next has access cpu. (on multiprocessor system, may both simultaneously access cpu.)

the book goes on differences in kernel versions , mentions cfs / linux 2.6.32:

[...] since linux 2.6.32, once more parent is, default, run first after fork(). default can changed assigning nonzero value linux-specific /proc/sys/kernel/sched_child_runs_first file.

this behaviour still present cfs although there some concerns future of feature. looking @ cfs implementation, seems schedule parent before child.

the way go set /proc/sys/kernel/sched_child_runs_first non-zero value.

edit: this answer analyzes default behaviour , compares sched_child_runs_first.


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -