Too Much Milk: The Secret Origin Story


When I first taught operating systems 12 years ago, I based my teaching materials on a set of slides inherited from John Carter, the previous instructor at Utah. I was generally happy with these slides, and I’ve continued to evolve them since then, but one thing I was always curious about was the “too much milk” example that is used to introduce concurrency problems. It goes something like: “You see that you’re out of milk and leave to go buy some. A few minutes later your roommate comes home and sees that there’s no milk. Later: OH NO THERE’S TOO MUCH MILK because of a synchronization error between humans.” This always struck me as a bit of an idiosyncratic way to go about introducing synchronization but I didn’t have any reason to replace it and didn’t think about it much until one time while procrastinating on lecture prep I Googled “too much milk” and learned the shocking truth: some large fraction of operating systems courses at research universities use this same example. See this for yourself.

The intriguing possibility is that too much milk could be used as sort of a mitochondrial DNA to trace the evolution of OS course notes. I started to envision creating a tool for analyzing the lineage of Powerpoint files, but then totally forgot about it until a few weeks ago. While chatting with Ryan Stutsman about teaching OS, for some reason I mentioned the Too Much Milk phenomenon. He thought that this had probably originated with his advisor John Ousterhout. John then explained:

I believe that the “too much milk” example owes its popularity to me, in that I have been using it ever since the early 1980s in my courses. For many years in the 1980s and 1990s, whenever a PhD student graduated in the systems area, Dave Patterson gave them a complete set of lecture videos for a couple of systems classes, including my CS 162 lectures. As a result, a lot of the material from my CS 162 lectures has spread all across the country through Berkeley graduates, including the “too much milk” example.

However, I did not invent this example. Before I taught my first operating systems course at Berkeley, Mike Powell gave me a copy of his notes and the “too much milk” example was there. So, it goes back at least to Mike Powell. I don’t know if he invented it, or if he got it from someone else.

So there you have it.

This post doesn’t have too much of a point, but I thought this was a nice story and also it provides a bit of insight into how teaching actually works: figuring out how to teach course material is hard and in practice, most of the time we borrow a framework and adapt it to fit our needs. Every now and then I’ll discuss this in class and invariably one or two undergraduates are so surprised that I’ll get dinged on the course evaluations with comments like “Lazy professor doesn’t even develop his own course materials.” However, I’ve done three or four courses the other way — starting from scratch — and have found that it takes multiple iterations before the material converges, so it’s not really clear to me that it’s better to start from scratch in cases where a good set of existing material can be found.

,

4 responses to “Too Much Milk: The Secret Origin Story”

  1. One of my professors motivated condition variables by describing the situation of someone announcing that there’s beer in the dorm lounge, but by the time you arrive in the lounge there’s no more beer. I’m amused that you can’t switch the beverages in these two examples; particularly “OH NO THERE’S TOO MUCH BEER” is sort of implausible.

  2. Matt I would totally rewrite my lecture slides to be about Too Little Beer but that probably wouldn’t go over very well at Utah.

  3. The origin story you discovered sounds spot on. I recall one of my first purchases when I joined the Utah faculty oh-so-many years ago was a set of tapes from Berkeley with Dave Patterson’s OS lectures. I don’t recall if I snagged the example from there or brought them with me from my own OS lecture notes from Rice, but can certainly believe that’s where I got the “inspiration”.

    I believe, however, that I am responsible for switching “Dining Philosophers” to “Dining Lawyers” in my OS notes. I never found it credible that philosophers would refuse to cooperate, whereas when you make them lawyers, everybody in class nods. And there’s the extra degree of satisfaction (and laugh line) when you suggest that one way to break the fork dining lawyers deadlock is to shoot one or both of them. Plus, shooting lawyers is a much more satisfying (laugh) line than shooting philosophers.

    (Although, doing a similar “Dining Lawyers” “Operating Systems” search has more entries than I’d expect me switching would cause, so perhaps I’m mis-remembering.)

  4. Hi John, that’s funny, I never looked for the dining lawyers before!

    I also like the way those slides lead to a couple of good punch lines, you gotta go for a quick laugh when you can get it.