This question has been asked before (see here and here, for example). However, things remain unclear to me. I was hoping someone can clarify them. The question is simple: Assume that there is no operating system, if I want a certain processor to execute some code at the same time as another processor, how is this accomplished? If needed, you may also assume some simple queue-based scheduler, which (in several other questions) still begs the question of how the scheduler spawns a thread/process or whatever in some other core. Thanks.
Asked
Active
Viewed 879 times
2
-
1What are you wanting to know that the accepted answer to http://stackoverflow.com/questions/980999/what-does-multicore-assembly-language-look-like does not cover? – Pete Kirkham May 05 '11 at 14:31
-
2The question does not cover how to wake up a second core if you start without OS – Gunther Piez May 05 '11 at 15:52
1 Answers
5
Starting up a second processor is usually very painful, as it involves a lot of ACPI stuff. This means, its not in the processor alone, you have to program the other hardware too.
Basically the other cpus are initialized via ACPI and start execution at some predefined address space containing trampoline code. From there on they are waiting to be scheduled.
But if you want to write your own smp stuff, you can of course instruct the second cpu to immediately execute some code for you.
If you want to have some example code, you can look at the linux kernel code:
http://lxr.linux.no/#linux+v2.6.33/arch/x86/kernel/smpboot.c

Gunther Piez
- 29,760
- 6
- 71
- 103