Slashdot Mirror


Debugging SMP Code with UML

chromatic writes "It's easy to write code that works fine on single-processor systems but dies horribly on multi-processor boxes. Instead of spending thousands of dollars on a four- or eight-way system, you can use UML to emulate a multi-processor machine."

2 of 20 comments (clear)

  1. Bochs also does this by mcgroarty · · Score: 4, Interesting
    Bochs will also emulate SMP machines. Bochs pretends to be an x86 machine with one or more processors, and runs on all Linux architectures, as well as Windows, Mac OS X and several BSDs.

    It's no speed demon, but it's about the nicest free tool for machine-level debugging.

  2. Re:Not the final solution by pstemari · · Score: 2, Interesting
    Depending on how the user-mode kernel is implemented, it may actually be better at reproducing SMP bugs than an actual SMP device. Typical SMP-only bugs are assumptions about cache operation that aren't seen on single processor machines with a single cache and synchronization issues on non-atomic memory access.

    An appropriately malicious emulation of SMP hardware can force these faults out much faster than they would appear in real life. One simple example would be cache emulation. IRL cache is limited and will be flushed automatically at some point. The emulation can treat cache as unlimited and only flush it on operations that guarantee cache flush. This will shake a lot of difficult-to-reproduce bugs out quickly.