Relation b/w Scheduler & No. of C.P.U's
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? i am running openSUSE on interl core2 duo laptop I never recompiled my kernel, so by default i think 2 cpus are enabled... could anybody tell me what is the relation between no. of c.p.u's n scheduler? |
Quote:
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. Quote:
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. |
thanx sir...
but still that wud contrary to the very well acclaimed fact-"in linux fork creates child process, and its unpredictable to tell which process schedules first" this is wat buks have told to me! could u plz discuss this more! |
It unpredictable as to which process has priority when its running ie parent or child. Depends on what its doing. OTOH, Linux will create new processes as a priority.
|
The scheduler was recently completely rewritten. I doubt many books are cognisant of the fact.
|
All times are GMT -5. The time now is 05:29 AM. |