On which core is Linux kernel running on Dual-core machine?
Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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.
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 08:37 PM.
Distribution: Ubuntu, Debian, Various using VMWare
Posts: 2,088
Rep:
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.
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.
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..
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).
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 gkrellmdoes get it.
</edit>
Last edited by PTrenholme; 12-30-2008 at 11:18 AM.
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:
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.
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.
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
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?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.