|
Saturday, 11 February 2006 |
The Two-Army problem is often used in schools to illustrate to students the problems faced by electronic networking protocols, and discuss methods of dealing with them, including CRC, TCP, MD5 and DES. I've pasted the general gist of the story here as its handy when explaining networking to people.
Two allied armies, led by General Bonaparte and General Alexander, are encamped on opposite sides of the enemy army. If both armies attack together then they will emerge victorious, but if they attack at different times they will be defeated. Their only mode of communication is a messenger who is subject to capture by the enemy army. Bonaparte decides it is time to attack so he sends a message reading, �Let�s attack tomorrow at dawn.� Alexander receives the message and responds, �Sounds good. See you at dawn.� The messenger manages to make it through the enemy line and Bonaparte receives the message. Both armies ready themselves for attack.
Later that day, Bonaparte realizes that Alexander does not know if the messenger made it back safely. So Bonaparte sends the messenger back across enemy lines to deliver a message of confirmation to Alexander. He does not know, however, if Alexander received it. No matter how many times they agree in advance to confirm confirmations, its always possible for the last one to be lost, and one General will not attack because he is unsure if the message was received.
There is in reality no perfect solution to this dilemma. Modern networking protocols rely on many layers of redundant confirmations and timeouts to provide a mostly seamless experience; but it is always still impossible to be 100% sure a remote side got your message.
On IRC networks, this becomes important when discussing how to route messages between users and servers, and servers and servers. |