Content deleted Content added
Citation bot (talk | contribs) Add: s2cid, url. Removed URL that duplicated unique identifier. Removed parameters. Some additions/deletions were actually parameter name changes. | You can use this bot yourself. Report bugs here. | Suggested by SemperIocundus | via #UCB_webform |
Hairy Dude (talk | contribs) →Definition: don't use contractions; fix use of invalid description list for indentation Tags: Mobile edit Mobile web edit Advanced mobile edit |
||
(26 intermediate revisions by 20 users not shown) | |||
Line 1:
{{short description|Thought experiment}}
[[File:2-generals.svg
In computing, the '''Two Generals' Problem''' is a [[thought experiment]] meant to illustrate the pitfalls and design challenges of attempting to coordinate an action by communicating over an unreliable link. In the experiment, two generals are only able to communicate with one another by sending a messenger through enemy territory. The experiment asks how they might reach an agreement on the time to launch an attack, while knowing that any messenger they send could be captured.
Leslie Lamport. [https://lamport.azurewebsites.net/pubs/solved-and-unsolved.pdf "Solved Problems, Unsolved Problems and Non-Problems in Concurrency"]. 1983. p. 8. </ref> An important consequence of this proof is that generalizations like the Byzantine Generals problem are also unsolvable in the face of arbitrary communication failures, thus providing a base of realistic expectations for any distributed consistency protocols. ==Definition==
Two [[army|armies]], each led by a different [[general]], are preparing to attack a fortified city. The armies are encamped near the city, each in its own valley. A third valley separates the two hills, and the only way for the two generals to communicate is by sending [[Runner (war)|messenger]]s through the valley. Unfortunately, the valley is occupied by the city's defenders and there
While the two generals have agreed that they will attack, they haven't agreed upon a time for an attack. It is required that the two generals have their armies attack the city
The thought experiment involves considering how they might go about coming to a consensus. In its simplest form, one general is known to be the leader, decides on the time of the attack, and must communicate this time to the other general. The problem is to come up with algorithms that the generals can use, including sending messages and processing received messages, that can allow them to correctly conclude:
Allowing that it is quite simple for the generals to come to an agreement on the time to attack (i.e. one successful message with a successful acknowledgement), the subtlety of the Two Generals' Problem is in the impossibility of designing algorithms for the generals to use to safely agree to the above statement.{{cn|date=June 2024}}
==Illustrating the problem==
The first general may start by sending a message: "Attack at 0900 on August 4." However, once dispatched, the first general has no idea whether or not the messenger got through. This uncertainty may lead the first general to hesitate to attack due to the risk of being the sole attacker.
To be sure, the second general may send a confirmation back to the first: "I received your message and will attack at 0900 on August 4." However, the messenger carrying the confirmation could face capture, and the second general may hesitate, knowing that the first might hold back without the confirmation.
Further confirmations may seem like a solution—let the first general send a second confirmation: "I received your confirmation of the planned attack at 0900 on August 4." However, this new messenger from the first general is liable to be captured, too. Thus, it quickly becomes evident that no matter how many rounds of confirmation are made, there is no way to guarantee the second requirement that each general
== Proof ==
{{unsourced section|date=November 2019}}
Because this protocol is [[Deterministic_system|deterministic]], suppose there is a sequence of a fixed number of messages, one or more successfully delivered and one or more not. The assumption is that there should be a ''shared certainty for both generals to attack''. Consider the last such message that was successfully delivered. If that last message had not been successfully delivered, then one general at least (presumably the receiver) would decide not to attack. From the viewpoint of the sender of that last message, however, the sequence of messages sent and delivered is exactly the same as it would have been, had that message been delivered. Since the protocol is deterministic, the general sending that last message will still decide to attack. We've now created a situation where the suggested protocol leads one general to attack and the other not to attack—contradicting the assumption that the protocol was a solution to the problem.
A
▲A nondeterministic protocol with a potentially variable message count can be compared to an edge-labeled finite [[tree (graph theory)|tree]], where each node in the tree represents an explored example up to a specified point. A protocol that terminates before sending any messages is represented by a tree containing only a root node. The edges from a node to each child are labeled with the messages sent in order to reach the child state. Leaf nodes represent points at which the protocol terminates.
==Engineering approaches==
{{unsourced section|date=November 2019}}
A pragmatic approach to dealing with the Two Generals' Problem is to use schemes that accept the [[uncertainty]] of the [[communication]]s channel and not attempt to eliminate it, but rather mitigate it to an acceptable degree. For example, the first general could send 100 messengers, anticipating that the probability of all being captured is low. With this approach, the first general will attack no matter what, and the second general will attack if any message is received. Alternatively, the first general could send a stream of messages and the second general could send acknowledgments to each, with each general feeling more comfortable with every message received. As seen in the proof, however, neither can be certain that the attack will be coordinated. There
Assuming that the generals must sacrifice lives every time a messenger is sent and intercepted, an algorithm can be designed to minimize the number of messengers required to achieve the maximum amount of confidence the attack is coordinated. To save them from sacrificing hundreds of lives to achieve
==History==
The Two Generals' Problem and its impossibility proof was first published by E. A. Akkoyunlu, K. Ekanadham, and R. V. Huber in 1975 in "Some Constraints and Trade-offs in the Design of Network Communications",<ref name="AEH">{{cite book|url=
|title=Some constraints and trade-offs in the design of network communications |pages=67–74
|publisher=Portal.acm.org |accessdate=2010-03-19|year=1975
|last1=Akkoyunlu
|first1=E. A.
|last2=Ekanadham
|first2=K.
|last3=Huber
|first3=R. V.
|s2cid=788091
}}</ref> where it is described starting on page 73 in the context of communication between two groups of gangsters.
This problem was given the name the ''Two Generals Paradox'' by [[Jim Gray (computer scientist)|Jim Gray]]<ref>{{cite web|url=http://research.microsoft.com/~Gray/JimGrayHomePageSummary.htm |title=Jim Gray Summary Home Page |publisher=Research.microsoft.com |date=2004-05-03 |accessdate=2010-03-19}}</ref> in 1978 in "Notes on Data Base Operating Systems"<ref>{{cite
Online version: {{cite book|url=http://portal.acm.org/citation.cfm?coll=GUIDE&dl=GUIDE&id=723863 |title=Notes on Data Base Operating Systems |date=January 1978 |pages=393–481 |publisher=Portal.acm.org |isbn=978-3-540-08755-7 |accessdate=2010-03-19}}</ref> starting on page 465. This reference is widely given as a source for the definition of the problem and the impossibility proof, though both were published previously as mentioned above. ==References==
{{reflist|30em}}
== See also ==
* [[Consensus algorithm]]
[[Category:Distributed computing problems]]
|