4/27
Part 1 of 7 · Messages instead of callsLearn and do

The network picks the order

The tests own the network. It keeps a list of pending messages, each one (from, to, message). Each step, it takes one message out and calls receive on the machine it was sent to. That call can send more messages, which join the same list.

Which message comes out next is the network's choice. The tests try three rules:

  • First in, first out (fifo): the oldest pending message.
  • Last in, first out (lifo): the newest one.
  • Shuffled: a random one, from a seeded random generator so a failure can be repeated.

Here are the eight messages of a count of the five-machine tree, in fifo order. Step through them:

The count of 0: [1, 2], 1: [3, 4], first in, first outInteractive
0 → 1 ask. The root asks both children, 1 first.

In lifo order the same eight messages arrive in a different order. The root's ask to 2 was sent last, so it comes out first:

Predict

In last in, first out order, which message is delivered second?

Pick an answer above to see the rest