<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Brain on Fire &#187; Two-Generals-Problem</title>
	<atom:link href="http://www.brainonfire.net/blog/tag/two-generals-problem/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.brainonfire.net/blog</link>
	<description>Tim McCormack, distilled</description>
	<lastBuildDate>Fri, 25 Jan 2013 02:23:06 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>&#8220;Two Generals&#8217; Problem&#8221; doesn&#8217;t make sense</title>
		<link>http://www.brainonfire.net/blog/two-generals-problem-paradox/</link>
		<comments>http://www.brainonfire.net/blog/two-generals-problem-paradox/#comments</comments>
		<pubDate>Tue, 31 Jul 2007 23:15:48 +0000</pubDate>
		<dc:creator>Tim McCormack</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Contemplation]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[communication]]></category>
		<category><![CDATA[failure]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[paradox]]></category>
		<category><![CDATA[protocol]]></category>
		<category><![CDATA[Two-Generals-Problem]]></category>

		<guid isPermaLink="false">http://www.brainonfire.net/2007/07/31/two-generals-problem-paradox/</guid>
		<description><![CDATA[Two armies are preparing to attack a city from opposite sides. The General of army A is orchestrating the attack, and has decided that they must attack simultaneously at noon on March 3rd to succeed. He sends a sealed, encrypted letter by messenger across the valley to the General of army B, informing him of [...]]]></description>
				<content:encoded><![CDATA[<p>Two armies are preparing to attack a city from opposite sides. The General of army A is orchestrating the attack, and has decided that they must attack simultaneously at noon on March 3rd to succeed.  He sends a sealed, encrypted letter by messenger across the valley to the General of army B, informing him of the plan, but worries that the messenger might be intercepted, so General B may not be informed. (If the attack is not simultaneous, both attacking armies will be destroyed by the defenders.)</p>

<p>As it so happens, General B does receive the message, but knows that General A cannot be sure of this. He sends back a receipt of the attack plan. Then he wonders... will it go through? What if General A does not receive it and decides not to attack, being unsure of B's knowledge? And even if General A sends over an acknowledgment of the plan's receipt, there is no guarantee it will arrive.</p>

<p>Given this faulty communication channel, how will the generals coordinate their plan?</p>



<p>I originally stumbled across this problem in the context of email. Remember how unreliable it used to be, back in the early nineties, how you were never quite sure that your message had gotten through? I explored the idea of return receipts and counter-receipts, but I never quite managed to come up with a satisfactory answer. Then a few days ago, I came across a Wikipedia entry on the <a href="http://en.wikipedia.org/wiki/Two_Generals%27_Problem">Two Generals' Problem</a> while reading about Google's distributed database networks. The article stated that <em>there is no solution</em> to the problem.</p>

<p>This took me by surprise. Surely, after 50 meta-receipts have successfully passed in each direction, surely then both parties would know that the original message was successfully sent. But I couldn't prove it. Part of the problem is that we aren't interested in proof that the message has actually arrived, but rather in both parties being certain that the message has arrived <strong>and</strong> that the other party knows this. In other words, given an agreed-upon communication protocol, there must be sufficient information <em>on each "side"</em> to conclude that the message has arrived.</p>

<h3 id="heading-some-assumptions">Some assumptions</h3>

<p>For the sake of simplicity and without loss of generality, I'd like to set the following assumptions:</p>

<ul>
	<li>Messages are instantaneous</li>
	<li>Each message is either delivered (instantaneously) or destroyed (without a trace)</li>
	<li>Forgery is impossible, due to cryptography</li>
	<li>If a General repeatedly tries to send a message, it will *eventually* get through</li>
</ul>

<h3 id="heading-naive-protocol">Naïve protocol</h3>

<p>General A sends the original message (numbered 0.0) to General B, and continues sending it (messages 0.1, 0.2, 0.3...) until he receives message 1.x (a receipt) from General B. He starts sending a counter-receipt, starting with 2.0. When 100 is reached, it is <em>impossible</em> for either party to be unsure about the status of the original message.</p>

<p>Message 100.x is sent by General A in response to 99.x from B, but we have two problems: 1) How does General B know when to stop sending 99.x? 2) How long should General A keep resending 100.x to let him know? Crap. It's the same problem!  But the very <em>existence</em> of messages 90.x through 95.x (for example) tells both parties that message 0.x got through.</p>

<h3 id="heading-halting-problem">Halting problem</h3>

<p>Ultimately, this appears to be one of the worst sorts of paradoxes in computing: A halting problem. There comes a point at which the original question has been answered ("Do both parties agree on a battle plan?  Yes.") but the algorithm is still running.</p>

<p>I'm still convinced there's a way around it, but I can't seem to find the key. Any ideas?</p>]]></content:encoded>
			<wfw:commentRss>http://www.brainonfire.net/blog/two-generals-problem-paradox/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
	</channel>
</rss>
