LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 12-29-2008, 08:47 PM   #1
kushalkoolwal
Senior Member
 
Registered: Feb 2004
Location: Middle of nowhere
Distribution: Debian Squeeze
Posts: 1,249

Rep: Reputation: 49
On which core is Linux kernel running on Dual-core machine?


I am new to Dual-core world and I just got a AMD X2 64-bit Dual Core processor machine and have installed Debian Lenny (64-bit) on it with the SMP kernel (64-bit).

Now as I understand dual-core means there are two cores i.e. the OS see two cpus as correctly identified by:
Code:
debian-workstation:~# cat /proc/cpuinfo 
processor       : 0
vendor_id       : AuthenticAMD
cpu family      : 15
model           : 107
model name      : AMD Athlon(tm) 64 X2 Dual Core Processor 5600+
stepping        : 2
cpu MHz         : 2000.000
cache size      : 512 KB
physical id     : 0
siblings        : 2
core id         : 0
cpu cores       : 2
apicid          : 0
initial apicid  : 0
............
Now my following question might sound little strange but I got curious:
Is there a way to know on which of the two cores is the Linux kernel running on? Does it run partially on both the cores or does it just runs on a single core? If it runs on a single core, then which core?

How can I determine this?
 
Old 12-29-2008, 09:17 PM   #2
PatrickNew
Senior Member
 
Registered: Jan 2006
Location: Charleston, SC, USA
Distribution: Debian, Gentoo, Ubuntu, RHEL
Posts: 1,148
Blog Entries: 1

Rep: Reputation: 48
As I understand it, the kernels run on both cores. I know that's how it works for multiprocessor machines, but I'm not sure about multicore.
 
Old 12-29-2008, 09:32 PM   #3
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 9 (stretch)
Posts: 3,361

Rep: Reputation: 127Reputation: 127
Linux boots on the number one core, then shifts to multiprocessor mode at some point when it is ready. I believe that the number one core continues to allocate processes to all cores, but I could be wrong on that point.
 
Old 12-29-2008, 09:36 PM   #4
kushalkoolwal
Senior Member
 
Registered: Feb 2004
Location: Middle of nowhere
Distribution: Debian Squeeze
Posts: 1,249

Original Poster
Rep: Reputation: 49
Quote:
Originally Posted by Quakeboy02 View Post
Linux boots on the number one core, then shifts to multiprocessor mode at some point when it is ready. I believe that the number one core continues to allocate processes to all cores, but I could be wrong on that point.
Wonder if there is tool/utility to find that out just like there are so many for determining whether the kernel is a dual-core or not (proc/cpuinfo and top).

Edit: I just noticed that this is my 1000th post.....

Last edited by kushalkoolwal; 12-29-2008 at 09:37 PM.
 
Old 12-30-2008, 06:10 AM   #5
IBall
Senior Member
 
Registered: Nov 2003
Location: Perth, Western Australia
Distribution: Ubuntu, Debian, Various using VMWare
Posts: 2,088

Rep: Reputation: 62
The kernel would run on both cores (or as many cores as is available).
The kernel would also allocate threads from each application to an appropriate core.

I don't know which core would do the scheduling to allocate threads to a particular core. It may not even be a static thing.

To complicate things even further, there is a degree of hardware scheduling between the cores.

--Ian
 
Old 12-30-2008, 06:35 AM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 19,245

Rep: Reputation: 3383Reputation: 3383Reputation: 3383Reputation: 3383Reputation: 3383Reputation: 3383Reputation: 3383Reputation: 3383Reputation: 3383Reputation: 3383Reputation: 3383
Quote:
Originally Posted by IBall View Post
The kernel would run on both cores (or as many cores as is available).
Do you have evidence to support this statement, or merely presuming a "SMP kernel" might (should ?) work this way ???.

I'm inclined to agree with Quakeboy02, but I haven't tracked through the code. Depends on what one means by "the kernel" of course - (some) kernel threads can run on any "engine". But then again, they can be bound to a specific "engine".
The (non-threaded) kernel itself ??? - mmmm. I'd be thinking just the one - Linux generally works that way to ensure things like cache flushes are minimized. Maybe one should peruse the code on a balmy New Years Eve rather than drinking and enjoying oneself.
.
.
Maybe.
 
Old 12-30-2008, 09:48 AM   #7
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194
Isn't the "system" time reported by top the answer to this question?

Run top. Press "1" if necessary to see the categories of time per core. Watch it while you run some ordinary tasks.
 
Old 12-30-2008, 10:18 AM   #8
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,248
Blog Entries: 5

Rep: Reputation: 191Reputation: 191
all discussion on SMP and the Linux kernel I find are centered around the scheduler and threads or processes..
just tagging this thread so I can see what you all may find..

http://www.ibm.com/developerworks/library/l-linux-smp/
Quote:
SMP in the kernel
To understand how SMP is initialized for a given architecture, check out the smp.c or smpboot.c files within the kernel at ./linux/arch/<arch>/kernel/ (for most architectures and platforms).
http://www.ibm.com/developerworks/li...-linux-kernel/
http://www.ibm.com/developerworks/li...y/l-scheduler/



Interesting topic.
 
Old 12-30-2008, 11:33 AM   #9
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,186

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
If you like "geek" toys, install gkrelm (although, come to think of it, it's not the the Ubuntu repositories). It runs on most window managers (but "best" under GNOME) and, among other things, can show you a "5-second updated" chart of CPU usage by core.

<edit>
Oops! apt-get install gkrellm does get it.
</edit>

Last edited by PTrenholme; 12-30-2008 at 12:18 PM.
 
Old 12-30-2008, 12:06 PM   #10
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 64
gkrellm is a cool tool. Looks cool on the cpu usuage of a quad core and compiling a new kernel with the -j8 option with make. It is working all 4 processors when compiling.

Brian
 
Old 12-30-2008, 05:31 PM   #11
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 4,070

Rep: Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897
If you have a non-smp kernel (which would be old, presumably), my experience is that it runs on Core 0 and Core 1 idles.

SMP kernels (anything recent should be SMP, except for oddball things that are specifically low-resource) split the load over the two (err, sometimes with a load of zero for one cores, if the load is low).

Note that ksysguard and Gnome system monitor can also do the trick of showing the load for the individual cores.
 
Old 12-30-2008, 06:52 PM   #12
HackTidus
Member
 
Registered: May 2007
Location: Spain
Distribution: Debian
Posts: 50

Rep: Reputation: 16
very interesting indeed, I asked that question to myself some time ago and I've learned some interesting stuff reading this...

Good work!
 
Old 12-30-2008, 07:41 PM   #13
bastl
Member
 
Registered: Sep 2003
Location: Germany/BW
Distribution: My own
Posts: 235

Rep: Reputation: 22
I think the process splitting is done by the pipelining system of the cores means, that software does not have any possibility to choose where to be executed.
So I think if the pipeline recognizes a call instruction then it gives that code until ret (iret) to the next free PU. So you can say that an interrupt (IRQ) is executed surely only on one PU. I can also imagine that a arithmetic work on the pipeline is pushed forward to a free PU and when the result is calculated then the other PU is at that point it needs that result.
Before I guess something wrong, you can download the datasheets for the AMD multicore CPU chips from here:
http://www.amd.com/us-en/Processors/..._15343,00.html
 
Old 12-30-2008, 09:00 PM   #14
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 9 (stretch)
Posts: 3,361

Rep: Reputation: 127Reputation: 127
Here's an interesting article on interrupt scheduling in an SMP environment.

http://software.intel.com/en-us/arti...essor-affinity
 
Old 01-03-2009, 07:43 PM   #15
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 4,070

Rep: Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897
Quote:
Originally Posted by bastl View Post
I think the process splitting is done by the pipelining system of the cores means, that software does not have any possibility to choose where to be executed.
If this were true, you wouldn't be able to set affinity. And if the pipelining system were doing this, which part ensures that instructions work on the correct registers?
 
  


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
Mixing quad and dual core cpu's in the same machine sniff Linux - Hardware 12 09-26-2008 10:52 AM
Kernel Panic on Intel Core 2 Duo E6700 Dual Core Processor nwongrat Linux - Hardware 2 01-08-2008 11:13 PM
does mandriva 2006 free edition supports dual core machine gajanan_khandake Linux - Hardware 2 12-28-2006 05:11 AM
Problem with installing Debian Linux on a AMD64 dual core machine brianq Linux - Software 1 10-07-2005 09:34 PM
Dual processor vs. Dual core cs. single on home machine fincher69 Linux - Hardware 3 03-04-2005 01:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 01:56 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
Open Source Consulting | Domain Registration