Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Linux Software

Debugging SMP Code with UML 20

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."
This discussion has been archived. No new comments can be posted.

Debugging SMP Code with UML

Comments Filter:
  • by mrblah ( 229865 ) on Friday March 07, 2003 @07:39PM (#5463844)
    Unless I'm missing something, while I believe that the simulation of multiple CPUS could certainly help find certain kinds of bugs (like those provided as examples in the article), a lot of the nastier issues will only manifest themselves when you really have multiple CPUs that are really doing work at the same time. Folks that work with threads see this a lot: where a multi-threaded application works great on a single-cpu box; but on a multi-cpu box where those threads are really running at the same time, problems occur. So while this is a nice tool, I can't see releasing code for production that has never been tested on a machine that actually has multiple CPUs.
    • 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.

    • Actually, I've seen plenty of race condition bugs that only manifest themselves on a multiprocessor machine running a particular version of an operating system. For example, AIX 4.3 and 5.1 use different scheduling algorithms, and many race conditions will only occur on 5.1 or above, because these versions of the operating system use a much more aggressive scheduler, and context switches tend to take less time. So, I am also skeptical about UML as a tool to "emulate" a multiprocessor box. If many bugs won't even manifest on a real multiprocessor box with a certain OS version, then it's highly unlikely that a uniprocessor box running some emulator will catch many bugs.
  • Bochs also does this (Score:5, Interesting)

    by mcgroarty ( 633843 ) <brian DOT mcgroarty AT gmail DOT com> on Friday March 07, 2003 @07:42PM (#5463862) Homepage
    Bochs [sourceforge.net] 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.

  • by larry bagina ( 561269 ) on Friday March 07, 2003 @09:01PM (#5464392) Journal
    Actually, you can by a dual processor system for not much more than a singel processor system. And have the benefits of a dual processor system. I'd trust that over an emulator.

    And be able to use the -j flag to make

    • After you 'by' said box, you have to give it a home and maintain it.
      Why not blow off all of the discussion with the management for the funding? You can thug some RAM from the manager's machine to support the extra address space requirements, and irritate his pointy-hair-edness at the same time.
      Only joking about the unethical behavior.

  • I wonder if there is limit to the number of simulated processors. Now people can simulate Linux running on a 1,000,000 CPU computer.

    Imagine a Beowulf Cluster of these things!
  • Surely they've heard of the Unified Modeling Language? Why do developers so often reuse acronyms that are already widely in use? I mean surely with only so many letters, you're going to get collisions, but with something as already well known as UML... jeez.
  • They should really change the UML acronym... Unified Modeling Language is very commonly known among software professionals. Of course, it peaked my interest on how they were using UML as a debugger....
  • SO..;.. what is it?? My favorite is HAVARTI!!!!! yummy yummy yummy next best is sharp cheddar.

The key elements in human thinking are not numbers but labels of fuzzy sets. -- L. Zadeh

Working...