LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-19-2009, 06:45 AM   #1
harrynath
LQ Newbie
 
Registered: May 2009
Posts: 2

Rep: Reputation: 0
Question 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?
 
Old 05-19-2009, 08:57 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,838

Rep: Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822
Quote:
Originally Posted by harrynath View Post
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.
Quote:
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.
 
Old 05-19-2009, 09:06 PM   #3
harrynath
LQ Newbie
 
Registered: May 2009
Posts: 2

Original Poster
Rep: Reputation: 0
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!
 
Old 05-19-2009, 09:54 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
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.
 
Old 05-19-2009, 10:05 PM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,838

Rep: Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822
The scheduler was recently completely rewritten. I doubt many books are cognisant of the fact.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
thread scheduler disable & enable balaji_singh Linux - Newbie 1 12-11-2007 09:02 PM
connection/relation between asus & asrock kpachopoulos General 0 06-30-2005 12:55 PM
?relation b/n linux & penguin& SuSE? gjo Linux - General 6 09-22-2004 11:54 AM
Solving a recursive relation .... SaTaN General 18 09-03-2003 10:39 PM
relation between classes Jo_Nak Programming 2 07-28-2003 02:48 PM


All times are GMT -5. The time now is 07:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration