The government: preserving rights and protecting justice. The Department of Motor Vehicles: our model of efficiency and equality. My car: newly titled and good luck finding parking in San Francisco.

While I was sitting at the CA DMV, I contemplated these things. Why did I register for an appointment at 9am on a Monday, especially when the lady behind the dispatchers desk didn't ask for any proof that I actually had a reason to be in the "Appointment Express!" line. No matter, it only took me 15 minutes to get in, hand in my homework, and get out. But all is not well at the DMV.

You see, while I was sitting there, waiting for my number to be called, I noticed something. For anyone that hasn't been to this particular DMV, here's what happens: there are two dispatcher desks, one for license issues and one for registration and other issues. The desks comes with long lines attached, one for people who just walk in and one for people pretending to have appointments. You walk up to the desk, tell the dispatcher why you're there, and she hands you the forms you need plus a number. Then you sit in a vast array of lawn chairs waiting for your number to be called and appear on the overhead monitors. The monitor tells you which clerk is ready to assist you.

When a clerk is ready to help someone, which is a small miracle, he pushes a button at his station. A voice calls out: "Ticket Number A005: Station #23." Then "A005@#23" appears on the monitors in the list of the last 10 or 12 station assignments. As long as only one assignment was done at a time, this worked fine. If two buttons were pressed at the same time, the voice would announce both assignments. Almost.

The problem I noticed was that if the voice (which took some time) hadn't finished speaking and the button for another station was pressed, without fail it would go through all the pending announcements and then make the first announcement a second time. At first I thought I was imagining this behavior; then I saw that the first announcement would appear twice on the monitors. It looks like someone skipped out on "concurrency issues" day.

Obviously, I don't have the code, so I can't prove this. Therefore, the challenge today is for you to reproduce this behavior.

And just for kicks, Stanley has some advice for anyone that has synchronization problems: don't try to fix the problem this way.

/* existing code here */

As he writes, "This morning I got an email from a co-worker who claimed to have fixed a rare but troublesome data corruption error in the Windows version of our product. There are at least two reasons why this doesn't do anything."