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.
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