The cafeteria paradox: stop using the water dispenser while someone else does!


A water dispenser Most cafeteria water dispensers will let two (sometimes more) people fill a jug at the same time. This article uses simple maths to prove that it’s a waste of time. In other words, two people should never use the same water dispenser at the same time: I call this the cafeteria paradox.

An intuitive presentation

Let’s start with a little brain teaser:

Alice and Bob are at the cafeteria, seating at different tables. Alice stands up to refill her table’s water jug. Little after, Bob stands up with his own table’s jug, heading to the same water dispenser. That water dispenser is a perfectly standard one, with two taps, and Bob finds himself standing near Alice. After a small hesitation, Bob starts using the second tap to fill his own jug, thereby diverting part of the output previously devoted to Alice.

This grants him an exasperated and somewhat puzzled look from Alice. Why?

The reason is quite simple: though most people will act just like Bob, using the water dispenser while someone else does is — in most of the cases — a useless waste of time. Indeed, starting to fill his own jug before Alice is done will not save Bob any time, but it will waste some of Alice’s time. That’s the cafeteria paradox.

Fortunately, this paradox is readily explained: assuming both Alice and Bob are using similar jugs, and both start with an empty jug, Alice will finish before Bob does; when Bob leaves, therefore, the water dispenser will have dispatched precisely the countenance of two caferetia jugs.
Now, Since the combined output of the two taps equals that of only one, dispatching this amount of water will take a constant time (precisely twice the time that it would take to fill a single jug). Hence Bob will gain no time at all by starting to fill his jug right away, while some of Alice’s time will be wasted.

Not convinced? Imagine Bob and Alice are waiting for some pizza at a take-away restaurant. Given that Bob and Alice won’t start eating before they get to their respective homes, should Bob accaparate half of Alice’s pizza when it arrives, or let Alice get the full pizza first and wait for his own pizza? If Bob asks for half of Alice’s, both will wait for two pizzas to be ready; on the other hand, if Bob lets Alice go first, Alice will have only waited for one, while Bob will have waited for two. Clearly the second solution is better for Alice, and neutral for Bob; and the situation is exactly similar to that of the water dispenser.

Still not convinced? Read on for a full mathematical description of this situation. Otherwise, skip to the conclusion (and the sticker!).

A mathematically accurate description

Let \(t_A\) and \(t_B\) be the respective times when Alice and Bob reach the water dispenser, and \(t_A’, t_B’\) the respective times when they leave. Let \(t^*\) be the time when Bob starts using the water dispenser. The water dispenser has a flow rate \(f\), and each jug has a capacity \(c\).

From \(t_A\) to \(t^*\), Alice’s jug is filling at rate \(f\); from \(t^*\) to \(t_A’\), at rate \(f/2\). Hence Alice’s departure time \(t_A’\) satisfies the following equation: $$ (t^* – t_A) ⋅ f + (t_A’ – t^*) ⋅ (f/2) = c$$
which yields \(t_A’ = t^* + \frac{c}{f/2} – 2 ⋅ (t^* – t_A)\), so $$ t_A’ = 2 t_A – t^* + \frac{c}{f/2} $$

Similarly, Bob’s departure time \(t_B’\) satisfies the following equation: $$ (t_A’ – t^*) ⋅ (f/2) + (t_B’ – t_A’) ⋅ f = c$$
which yields \(t_B’ = t_A’ + \frac{c}{f} – (1/2) ⋅ (t_A’ – t^*) \), so $$ t_B’ = (1 / 2) ⋅ (t_A’ + t^*) + \frac{c}{f} $$

Finally, subtituting \(2 t_A – t^* + \frac{c}{f/2}\) for \(t_A’\) yields \(t_B’ = t_A + (1 / 2) \cdot \frac{c}{f/2} + \frac{c}{f}\); that is $$ t_B’ = t_A + 2 ⋅ \frac{c}{f} $$

To summarize, Alice will leave at \(t_A’ = 2 t_A – t^* + \frac{c}{f/2}\) (the later Bob starts, the earlier Alice will leave), while Bob will leave at \(t_B’ = t_A + 2 ⋅ \frac{c}{f}\), which does not depend on \(t_B\) or \(t^*\).

Conclusion

The socially optimal solution is that Bob waits until Alice is done before starting to use the water dispenser; otherwise, some of Alice’s time will be wasted, though Bob will not benefit from it. The key to understanding this is that Bob will not leave the water dispenser before both jugs are full, and filling both jugs takes a constant time (the time needed for the water dispenser to deliver twice the volume of a jug, spanning from Alice’s arrival to Bob’s departure). Thus using the water dispenser while someone else does is not only selfish: it’s downright stupid.

Shocked? Leave a message in the comments! Otherwise join our campaing to stop multi-threading in water dispensers: stick the following message on your cafeteria’s water dispenser and post a picture of your sticker in the comments!

Cafeteria paradox sticker

Title image © Cosmetal.

5 thoughts on “The cafeteria paradox: stop using the water dispenser while someone else does!

  1. OpenK

    Hey,

    On the opposite, having to spend some time next to someone you probably don’t know for the time of filling the jug is a great opportunity for Bob and Alice for example to talk together: this IS socially useful, while modeled as a waste of time !
    Cafeteria is socialy useful.

    Reply
    1. Clément Post author

      That’s quite right indeed. Now how do we model the social efficiency induced by standing next to your co-workers at the water fountain? :)

      Reply
  2. DaBam

    The initial assumption that the water pressure would sink significantly if two cans are filled at the same time is wrong in general. The thought experiment even assumes that the pressure would be cut in half, which in practice is never the case.

    Reply
    1. Clément Post author

      Hi DaBam, thanks for your comment!

      Actually, it’s more often the case than one might think, for multiple reasons. First, there’s always an incentive for manufacturers to reduce the waiting time for their users (in other words, filling the jug as fast as possible). Limiting the throughput when only one person is using the dispenser makes little sense, since it pretty much amounts to wasting their time (with no benefit, except perhaps that of not filling the jug too fast). Second, some dispenser systems are refrigerated, greatly limiting the throughput. Third, my (admittedly rough) experiments did indicate a reduction of the throughput in the order of one-half.

      Now, if one assumes that the throughput is not divided by two, then indeed the conclusions of this article do not hold. Further calculations would show when it is socially efficient to for the second user to start using the machine.

      Reply
  3. PixelSnader

    You’re missing a huge factor. Switching.

    If one cup is full it needs to be switched out for another. This only takes a fraction of a second, but nevertheless it takes time. However if one were to start filling the first cup, then cut in line with the second cup, there is no time wasted while waiting.

    It’s the basis for Fordian industry, and similar methods used in all modern computing pipelines.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>