Tuesday, March 4, 2008

Not Enough Chopsticks to Go Around

Five philosophers are sitting around a dinner table with a large bowl of noodles in the center. Being philosophers, they mostly sit and think, but being at a dinner table, they sometimes decide to eat. When they are thinking they aren't eating, when they are eating they aren't thinking, and they never talk to each other. When one decides to eat, he reaches for each of a pair of chopsticks, one on the left and one on the right. Unfortunately, they are in an extremely cheap restaurant which only put out five chopsticks, one between each of the philosophers. This unlikely situation is a classic computer science analogy about synchronization.

Synchronization: the process of maintaining one thing in step with another thing. Syncing issues abound, not just in computer engineering and programming, but in life too. Parents of more than one child know all about synchronization, and the consequences of things getting out of lockstep. Manufacturing processes depend on the supply chain keeping enough parts available for production to continue. If your doctor overbooks her morning schedule or has an unexpected emergency to handle, she's not going to get to your appointment on time in the afternoon. Planes must be serviced, fueled, and crewed in an orderly fashion to ensure air travel happens as planned. One broken traffic light can snarl city traffic for blocks. In both comedy and love, timing, we are told, is everything.

So, the next time you are forced to kill an unresponsive program, give your computer the old three-finger-salute, or are just twiddling your thumbs waiting for a web page to load, picture a hungry philosopher holding a chopstick. The next time you feel you aren't making any progress in your work or life, pause and look for what's blocking you. It's worth noting that the dining philosophers problem is easy to solve if the philosophers start talking to each other. And occasionally, when you find yourself trying to eat noodles with a single chopstick, it can be worth leaving the table to find a good burger joint.

No comments: