The Dryer Protocol

I’m becoming increasingly interested in systems engineering, but still don’t really know much about the subject. One thing that I read about recently (though I completely forgot where) was about how to choose a robust cooperation protocol, using the communal clothes dryer as an example.

In a system there’s often more that one way of doing things, or more that one way of ordering the things that need to be done. When it comes to drying your clothes, we have the two basic strategies:

  1. EmptyLintFirst
    The program can first empty the lint trap, and then dry the clothes.
  2. EmptyLintLast
    The program can first dry the clothes, then empty the lint trap and leave it clear for the next agent to use.

So, obviously, both of these strategies will work with themselves quite well. If everyone follows the EmptyLintLast protocol then the lint trap will always be clear when you begin to dry your clothes. So, how to choose between the two strategies? First we set up a cost function for when things go wrong, one that reflects the actual system cost. For this example, we’ll charge 1 minute for emptying the lint trap, if it was already clean, and 60 minutes for drying clothes with a dirty lint trap. Then we ask the all important question: In a mixed system what is the associated cost for each strategy?

  1. EmptyLintFirst
    Half the time the EmptyLintLast guy will have left a clean lint trap, so, being simple-minded folk, we clean it again at a penalty of 1 min. But the trap is always clean when we go to dry the clothes, so no penalty there.
    Total cost: 0.5 minutes.
  2. EmptyLintLast
    Half the time the EmptyLintFirst will have left a dirty lint trap, so we end up with soggy clothes for a penalty of 60 minutes. But the trap is always dirty when we go to clean it, so no penalty there.
    Total cost: 30 minutes.

Clearly the EmptyLintFirst is the more robust of the two strategies, not only does it work if everyone follows this strategy, but it also has a much lower cost in the mixed environment. Most of the time in software development, the setup and initialization cost (cleaning the lint trap) is much less than the actual computation cost (drying the clothes), so it clearly pays to always initialize your environment prior to using it, even if you think it’s unnecessary, it’s an incremental cost that buys you a more robust and reliable system. And since you can’t depend on that junior programmer (or yourself) to always clean up the environment after using it, you save yourself maintenance nightmares down the road.

So from Systems Engineering 101:

    Robust Protocol Selection

  1. List all the alternative ways of performing the task.
  2. Associate a cost for when each thing can go wrong.
  3. Evaluate each of the alternatives in a mixed environment.
  4. Choose the protocol with lowest cost.

If the cost analysis results in a tie, then adjust the cost function to arbitrate some differences.