Tuesday, January 03, 2006

Eureka! (continued)



The past 24 hours I have been feverishly trying to find a bug in the multiprocessing code (usually, the last 5% of anything non-trivial I make takes 50% of the time).

Even worse, usually I manage to build horrendously complex things without the slightest problem, only to be stumped by an obscure bug in a seemingly insignificant line of code.

The weird thing was that with 4 CPU's harvesting patterns, substantially less patterns were found than with 1 CPU, in spite of using Critical Sections around global data. For the rest, everything worked fine and dandy.

I finally concluded it must be due to some use of global data that I had missed, which turned out to be true. I confess to occasionally using global data with the aim of simplifying the architecture (DoTheSimplestThingThatCanPossiblyWork), but with the advent of multiprocessing, this is even less of a good idea than it already was :)