Originally Posted by harrynath
wenever i call fork always the child process gets scheduled first...
i dont set priority or call schedule_yeild()...it just happen every time
i wonder why?
Probably just lucky ...
I don't see anything that is biased in favour of the child - although as a new task, presumably it would be more "left-most" in the red-black tree the scheduler uses than the creating task and thus more likely to be scheduled (presuming CFS).
In other words, the parent has consumed CPU time, and so has drifted to the right in the tree - anything to the left of it in the tree will dispatch first.
could anybody tell me what is the relation between no. of c.p.u's n scheduler?
Probably only Ingo - he wrote (most of) the scheduler.
There is a run queue per CPU, but it is likely parent and child will queue on the same CPU because of the amount of common data that will benefit from being in (hardware) cache.