LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 01-04-2009, 06:06 AM   #16
bastl
Member
 
Registered: Sep 2003
Location: Germany/BW
Distribution: My own
Posts: 237

Rep: Reputation: 22

Look, you have maybe 4 cores, that means you have 4 CPUs so 4 processors packed together in one case with some additional chips usually placed at a multicpu board there on the motherboard.
That means, each of that silicon CPU plates in those multicore CPUs is a real one core CPU, with cache, pipelining, controllers and buses. that means register rax is 4 times in that case but on totaly different chips. Only a central controller with pipelining and cache can split code in that way, that the same programm can be executed on all chips if it is possible but sometimes surely not, too.
That also means that it lays to the programmers of source codes if there sources can be executed fast on a multicore CPU !!!
O.K. such a CPU silicon plate isn't really one plate it exists itself of a lot of plates: CPU plate, FPU plate, controller-bus-pipelining plate, cache1 and cache2 plate.
And you are right you can't say on which register you have the value you need but your program code works like usual and the muticore controller will only split code where it is possible. So functions won't be splited, only if there is more then one FLOP in it they don't depend on each other, say x= 5.48*2.31/3.44*22.50 is splited to a=5.48*2.31, b=3.44*22.50, x=a/b, a/b is done on the FPU holding a. That means on a highly integrated multicore CPUs, say 4 cores, there are not only 4 FPU silicon plates clued but 6 or more.
But if you want really to know where your code is executed then you can hard debug it in an assembler debugger with that core debug registers. In the moment I think only the non core debug registers are supported but have a look on the NASM and GCC pages. It can also be possible, that those register are not accessible from inside of the CPU but on external pins via I2C only.

Last edited by bastl; 01-04-2009 at 06:17 AM.
 
Old 01-04-2009, 06:31 AM   #17
crashmeister
Senior Member
 
Registered: Feb 2002
Distribution: t2 - trying to anyway
Posts: 2,541

Rep: Reputation: 47
Quote:
Originally Posted by salasi View Post
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).
Way I understand it is that the application has to be multithreaded in the first place for this.

If you encode a video on a dual core and use only one thread it uses 100% of one core and switches between the cores but not 2 cores at the same time.

Also got my doubts that the kernel runs on any one specific core.What would be the purpose of that?
That would basically mean that if core 1 to 3 are busy and the kernel is restricted to run on core one things would slow down for all kernel events while core 4 just sits there.
I'd venture to think that in such a case things (kernel or not) just run on whatever core is less busy.

Last edited by crashmeister; 01-04-2009 at 06:38 AM.
 
Old 01-04-2009, 10:27 AM   #18
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Quote:
Originally Posted by crashmeister View Post
Way I understand it is that the application has to be multithreaded in the first place for this. [...]
The point is, of course, that the kernel is compiled as a multi-thread application. For example, when a shell starts a process, that process is in its own thread.

The process may, itself, start other processes or, internally, threads, and they will be scheduled as necessary on any available processor. You can see a (semi) graphical representation of the current process hierarchy by entering the pstree -Gc command in a terminal window. (There are, of course, other options to the pstree command. See man pstree for details.)
 
Old 01-04-2009, 01:56 PM   #19
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:
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.
I apologise; when I first read this, I thought this was rubbish; having re-read this, I realise that you are describing hyperthreading rather than multi-core. OTOH, you are describing hyperthreading, which isn't what the thread was about...and it certainly isn't what you quote in the AMD links.

Quote:
Look, you have maybe 4 cores, that means you have 4 CPUs so 4 processors packed together in one case with some additional chips usually placed at a multicpu board there on the motherboard.
OK, I am prepared to take 4 as an example, if you want.
Quote:
That means, each of that silicon CPU plates in those multicore CPUs is a real one core CPU, with cache, pipelining, controllers and buses.
Do you mean a die, or something else? In any case, no. A multi-core CPU has multiple cores (which is more than "one real core"). So, that is more than one core, or it wouldn't be multi, would it?
Quote:
that means register rax is 4 times in that case but on totaly different chips.
Now I really can't guess your meaning. With four cores, there must be four copies of each register, but I cannot comprehend why you claim that they be on seperate chips, when the cores are on the same chip (...not that applies to all multi-core chips)
Quote:
Only a central controller with pipelining and cache can split code in that way, that the same programm can be executed on all chips if it is possible but sometimes surely not, too.
No, again. Each CPU behaves like a CPU. It has a program counter. The default behaviour is to get the next instruction after the current one (unless modified by jump instructions). This has nothing to with pipelining, its just the way that microprocessors work. Running individual tasks, of course, the micro can do all of the multitasking stuff it would normally do (you know 'pseudo-simulataneous' execution of programs or threads), but better for having more cores available.

What does have something to do with cache and pipelining is performance. Performance will be higher if the cache has the right data in it and when you want some data that isn't locally available you have to wait for it, so the sooner that you started to get it, the better, because pipeline stalls can be a real performance killer. (Which is where hyperthreading comes in, of course. That does allow you to do something else useful while you are waiting.)

Quote:
That also means that it lays to the programmers of source codes if there sources can be executed fast on a multicore CPU !!!
O.K. such a CPU silicon plate isn't really one plate it exists itself of a lot of plates: CPU plate, FPU plate, controller-bus-pipelining plate, cache1 and cache2 plate.
Plates? My best guess is that you meant something like a functional area on the floorplan of the chip.

Quote:
So functions won't be splited,
It won't split your function for ordinary, integer code (still talking about multi-core). You might, but it won't Of course, this drags in the usual parallel programming issues, but you weren't expecting a free lunch, were you?
Quote:
crashmeister
Quote:Originally Posted by salasi
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).

Way I understand it is that the application has to be multithreaded in the first place for this.
Should have been more explicit...I meant that the kernel itself will use more than one of the CPUs. If you have one large monolithic task, that doesn't necessarily help as much as you would like.

If you had also wanted to split the application load over the cores, you would either have ensure that the application is threaded or have a lot of small applications rather than one large app. If your natural application load is many small applications, you might wonder what all the fuss is about, because it just works. Otherwise, you might find, it just doesn't.
 
Old 01-04-2009, 03:38 PM   #20
crashmeister
Senior Member
 
Registered: Feb 2002
Distribution: t2 - trying to anyway
Posts: 2,541

Rep: Reputation: 47
Quote:
Originally Posted by PTrenholme View Post
The point is, of course, that the kernel is compiled as a multi-thread application.
The kernel is always multithreaded and supports multithreaded apps.That has nothing whatsoever to do with SMP or how it is compiled.

SMP just enables the kernel to manage more than one cpu (and yes - a core is pretty much a cpu as far as the kernel is concerned).
 
Old 01-04-2009, 04:41 PM   #21
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,337

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
When booting on a multi-cpu system Linux boots on the first CPU just as if it is booting on a single CPU system. Once the kernel is established and set up it then goes into multi-cpu mode by scheduling threads on all of the available CPUs.
Once the kernel reaches this stage it is no longer sitting on a "master" CPU scheduling "slave" CPUs. All CPUs are equal.

Each processor is not running Linux per se. Each processor is running the thread it is currently assigned and executes application code and kernel code as the thread demands. Interrupts are processed by the CPU on which the interrupt causing event was generated. Thus the kernel interrupt code runs on which ever CPU has the latest interrupt. Likewise the scheduler runs on each CPU when that CPU reaches the next scheduling event.

So at any moment in time, after boot completes, you could have several CPUs running kernel code or one CPU running kernel code or no CPUs running kernel code.

-----------------------
Steve Stites
 
Old 01-04-2009, 05:59 PM   #22
bastl
Member
 
Registered: Sep 2003
Location: Germany/BW
Distribution: My own
Posts: 237

Rep: Reputation: 22
O.K. salasi you get it.
And I mean:
silicon plate = one part of a wafer.
CPU = such a wafer part where the CPU is on.
FPU = such a wafer part where the F_loating P_oint U_nit is on.
function = are some instructions between CALL and RET, say a c++ function or pascal procedure.
case = the plastic case all that wafer parts are infused, with leads, pins.
multicore CPU, one core CPU = a case with leads, pins (Multicore = x86-64 specific).
pipelining = a small memory the next instructions are on so the controlling can decide what to do with that instructions or work on it.
central pipelining unit = only one in a multicore CPU, splits the instructions in the described way. No programm, kernel, BIOS can control that. (only X86-64 specific, on other platforms software have to take part on it - S390, sparc. that's because of intel's downward compatibility)
 
Old 01-05-2009, 02:33 PM   #23
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 jailbait View Post
When booting on a multi-cpu system Linux boots on the first CPU just as if it is booting on a single CPU system. Once the kernel is established and set up it then goes into multi-cpu mode by scheduling threads on all of the available CPUs.
Once the kernel reaches this stage it is no longer sitting on a "master" CPU scheduling "slave" CPUs. All CPUs are equal.

Each processor is not running Linux per se. Each processor is running the thread it is currently assigned and executes application code and kernel code as the thread demands. Interrupts are processed by the CPU on which the interrupt causing event was generated. Thus the kernel interrupt code runs on which ever CPU has the latest interrupt. Likewise the scheduler runs on each CPU when that CPU reaches the next scheduling event.

So at any moment in time, after boot completes, you could have several CPUs running kernel code or one CPU running kernel code or no CPUs running kernel code.

-----------------------
Steve Stites
This is somewhat close to what I was thinking how the kernel code executes. So basically Linux kernel = Kernel code runs on both the CPUs/Cores depending on the need.
 
  


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

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

All times are GMT -5. The time now is 06:56 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