Sandwich Provider Protocol

by Charles Miller on March 9, 2007

Ordering a sandwich is a flow control problem.

If you provide too much information at once, you'll overflow the buffer of the person serving you. This will cause an unknown amount of information to be dropped on the floor, and for safety you'll have to start again from scratch to ensure no ingredients are missed.

You can just treat the whole thing as a challenge-response protocol. In fact, this is the best thing to do when approaching a new sandwich server, as there are subtle variations in the order of serving. (Are they going to ask for butter? When are they going to ask about salt and pepper?). But challenge-response wastes time, as you pay double the cost of the latency between you and the person behind the counter.

Once you know the order in which the data is required, though, the trick is to keep the pipeline full without (a) overflowing the buffer, or (b) emptying the buffer and dropping back to challenge-response.

Estimating the buffer capacity of someone serving you your sandwich, however, can be tricky.


Previously: Electrical Storm

Next: Patch, Rinse, Repeat.