Bochs User Manual
<<< Previous | Tips and Techniques | Next >>>

# Simulating a Symmetric Multiprocessor (SMP) Machine

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 the Section called cpu in the Chapter called Setup 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 dynamicly 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. Still not supported by Bochs. (FIXME)

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 and WinNT 4.0 SMP.

- several parts of the APIC model which weren't needed before are not implemented yet and cause a panic. If you boot linux 2.4.3 for example, it says "panic: cluster model addressing not implemented".

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

<<< Previous | Home | Next >>>
Mounting a disk image using the loop device | Up | Setting Up Networking in DLX Linux