Bochs can now simulate an SMP machine when you use
--enable-smp in the
configure command. SMP support was added by Bryce Denney, who
was very interested in watching a multiprocessor operating system work
at a low level. It should also be helpful to operating system developers
who are writing SMP drivers, or just for users who want to test drive
an SMP machine to see what it looks like.
Starting with Bochs 2.2.6 you can set up the number of processors in the bochsrc. See Section 4.3.4 how to set up the number of processors.
It is important to understand that configuring bochs for 4 processors will NOT make your single-threaded applications run faster in general! On the contrary, it has to spend time simulating idle processors as well as the ones doing your task. The point is to simulate an SMP system, not to speed up a uniprocessor application.
What was required to make SMP work in Bochs?
local APIC on each processor with timer
one I/O APIC model
implement RDTSC (read time stamp counter)
a data structure called the Intel Multiprocessor Configuration must be present in BIOS memory space. An SMP-aware operating system probes BIOS memory to find the structure, which contains information about how many processors, their IDs, interrupt sources, etc. Starting with Bochs 2.2.5 these structures are dynamically created by Bochs.
ACPI support is required to boot SMP system in most of modern operating systems. For example WinXP 64 bit require ACPI support even for single processor configuration.
What needs to be done to improve SMP support?
debugger support is still limited. For example, you can set breakpoints, but you can't specify which processor you want to set the breakpoint for.
test on any possible SMP operating systems. Currently success reported for Knoppix 4.0.2, WinNT 4.0 and WinXP SMP.
several parts of the APIC model which weren't needed before are not implemented yet.
A number of people have suggested using threads to simulate each CPU in a different thread. Then on a real SMP machine, the threads can execute in parallel. This is a great idea, but it's not done at present.