LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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, 05: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, 07:57 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
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, 08: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, 08:54 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
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, 09:05 PM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

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


Reply



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 08:02 PM
connection/relation between asus & asrock kpachopoulos General 0 06-30-2005 11:55 AM
?relation b/n linux & penguin& SuSE? gjo Linux - General 6 09-22-2004 10:54 AM
Solving a recursive relation .... SaTaN General 18 09-03-2003 09:39 PM
relation between classes Jo_Nak Programming 2 07-28-2003 01:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:34 AM.

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
Open Source Consulting | Domain Registration