8/27
Part 2 of 7 · Count with messagesLearn and do
A count that only works in order
Here is a tempting shortcut. Children are asked in list order, so surely they answer in list order, and a machine is done when its last child answers?
Look at the lifo run again. Machine 1 asks 3 and then 4, and 4's answer arrives first. Under the shortcut, machine 1 sees its last child answer and sends its parent a count of 2, with 3 still missing. In fifo order on a small test, the bug hides.
Machine 0 has children [1, 2]. Machine 1 is a leaf. Machine 2 has one child, 3. In fifo order, does the root hear from 1 or from 2 first?
Pick an answer above to see the rest