1 / 23

Program Design Tutorial #3

Program Design Tutorial #3. The Two Generals Problem. Two armies are camped on the outskirts of either side of an enemy city. The Two Generals Problem. Army 1. Army 2. The Two Generals Problem.

preston
Télécharger la présentation

Program Design Tutorial #3

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Program DesignTutorial #3

  2. The Two Generals Problem • Two armies are camped on the outskirts of either side of an enemy city.

  3. The Two Generals Problem Army 1 Army 2

  4. The Two Generals Problem • The generals of the armies can only communicate via messengers who must travel through enemy territory and are thus subject to delays or capture.

  5. The Two Generals Problem Message

  6. The Two Generals Problem Message Acknowledgement

  7. The Two Generals Problem • The two generals have previously agreed on a plan of attack, but they must communicate to set up the attack time. • If one army attacks but the other doesn’t they will be defeated and then the enemy city will defeat the other army.

  8. The Two Generals Problem • If the first general decides to send the message saying, • “Let’s attack at noon tomorrow”

  9. The Two Generals Problem • One of three things could happen • Scenario 1 • Scenario 2 • Scenario 3

  10. The Two Generals Problem • SCENARIO 1 The message could intercepted when it is being sent to the second general

  11. The Two Generals Problem Message

  12. The Two Generals Problem Message

  13. The Two Generals Problem Message

  14. The Two Generals Problem • SCENARIO 1 • So what? • Well Army1 will attack at noon, but Army2 won’t. • Army1 will be defeated. • Army2 will be attacked and defeated.

  15. The Two Generals Problem • SCENARIO 2 • The message could be received by the second general but the acknowledgement that is sent back could be intercepted.

  16. The Two Generals Problem Message Acknowledgement

  17. The Two Generals Problem Message Acknowledgement

  18. The Two Generals Problem Message Acknowledgement

  19. The Two Generals Problem • SCENARIO 2 • So what? • Well Army2 will attack at noon, but Army1 won’t know if the message was received so Army1 won’t attack in case Army2 doesn’t. • Army2 will be defeated. • Army1 will be attacked and defeated.

  20. The Two Generals Problem • SCENARIO 3 • The message is received by the second general and the acknowledgement is sent back.

  21. The Two Generals Problem Message Acknowledgement

  22. The Two Generals Problem • SCENARIO 3 • So what? • Army1 and Army2 attacked together, and defeat the enemy.

  23. The Two Generals Problem • In groups of three or four, think of five ways to help ensure that both armies attack together.

More Related