Bugs for Lunch
Bugs for Lunch
This is for programmers. The rest of you, run away. Run away fast.
I just found a class of bugs in computer programs, that only occur when I am not looking at the display. Hey! I am not paranoid! They really are out to get me! Let me explain.
I was working on some genuine parallel processing — separate Unix programs with shared memory — on my 2006 model Macbook. Specifically, I was trying to chase down critical sections that I had inadvertently left unguarded. That model of Macbook has two separate processor cores, and it really helps with finding critical-section violations to have both cores running my programs; otherwise, I have to wait a long time before the switcher happens to decide to swap processes at exactly the right time to encounter the conflict.
My Macbook’s processor cores have other things to do, of course, even when I am not running any other user applications. There are lots of operating-system and support tasks that have to be accomplished regularly.
Among these routine tasks is drawing the display. My parallel programs under test typically produce lots of scrolling output, so the display routines have to work a bit to keep things refreshed. That increases the load on the processor cores, which reduces the proportion of time when they can both be running my parallel programs, which much reduces the chances that I will see any of the conflicts that I am looking for.
But when I walk away from the computer, to get lunch, to beat my head against a wall, or just to have a good cry, my energy-efficient, display-degradation-preventing sceen-darkener kicks in after just a few minutes of no keyboard activity, and turns the entire display pitch black.
It doesn’t take a lot of work to draw a pitch-black screen.
So both processor cores become more often available to run my processes under test, and the odds of finding critical section violations dramatically increase. And lo and behold, I have bugs that only occur when I am not looking at the display.
Jay Freeman’s Blog Entries
Tuesday, October 23, 2007