The Two Generals’ Problem

Share
HTML-code
  • Published: 12 August 2019
  • Time to tell a story about idempotency, computer science, and the Night of the Multiple Orders. • Sponsored by Dashlane —try 30 days for free at: https://www.dashlane.com/tomscott

    MORE BASICS: https://www.youtube.com/playlist?list=PL96C35uN7xGLLeET0dOWaKHkAlPsrkcha

    Written by Sean M Elliott and Tom Scott
    Directed by Tomek
    Graphics by Mooviemakers https://www.mooviemakers.co.uk/
    Audio mix by Haerther Productions https://haerther.net/

    Thanks to Dashlane for sponsoring the video! If you're techie enough to watch this video, you should be using a password manager. Get a 30-day free trial at https://dashlane.com/tomscott

    I'm at https://tomscott.com
    on Twitter at https://twitter.com/tomscott
    on Facebook at https://facebook.com/tomscott
    and on Instagram as tomscottgo

Comments • 2 679

  • Tom Scott
    Tom Scott   4 months back

    Yes, I had help with the graphics for this series. There's no way I'd have animated that myself! On that note, thanks to Dashlane for sponsoring and helping me hire an animator: their free trial link is https://www.dashlane.com/tomscott

    • Akin Turhan
      Akin Turhan  1 months back

      I have thought about dashlane I want to know the advantage over Google chrome random password generator and manager that is synced with one master password. they don't know any of the passwords either.

    • The Superginge
      The Superginge  2 months back

      As glad as I am that you're getting sponsored, I feel I should tell people that Firefox is starting to offer this password security option for free, though before anyone gets angry at me, I don't know what level of security it is, comparatively, I just want to make people aware of options!

    • Matti Lüdke
      Matti Lüdke  2 months back

      Why not send a person from each army to the middle of the valley. Then both discuss a time and go back to their army. That way they will know if the message was received by the other army. As the Danger of the route lies in the middle of the valley they will get back safely.

    • صالح
      صالح  2 months back

      Hey there is a way to solve the 2 genrals problem and it's a horne or war drums because they are loud enugh to hear

    • Dark Thoughts
      Dark Thoughts  3 months back

      Now you know the issues protocol standards committees have to 'foresee' when designing a communication protocol.

  • Jo 1337
    Jo 1337  15 hours back

    It's 2 am and I regret nothing

    • Vysair
      Vysair  4 days back

      Or maybe both general could send dozen more message until it hit certain threshold and that will confirm it.

      • 10k12
        10k12  5 days back

        2:35 why not let them meet in the middle, so if they perish, they perish together and no message is received, but if they manage to meet, they can return and there are no threats on the way back to the generals.

        • Shaurya Pant
          Shaurya Pant  5 days back

          Well, after both the teams have received confirmation of the other party that they know that you know and will go at 8PM, I don't see any further need of sending messengers. Can someone explain, please?

          • Andre L
            Andre L  5 days back

            How come this problem exists at all, if the proposed time is 8 pm, and both of them acknowledged the acknowledgments, then why would A and B need to keep sending acknowledgments? They both acknowledged the proposal and acknowledgment, so it's already planned? They both already know that it made it to the other side at least twice, so what's the problem?


            This just feels like it's not really a problem.... How is this line of reasoning incorrect?

            • Markus B
              Markus B  6 days back

              I should be asleep but general B didn’t give me a confirmation

              • john wick
                john wick  6 days back

                Simply. General A sends a messenger which returns after delivery of the message. If the messenger does not return after a suitable time span. It is safe to assume something happend and another messenger needs to be sent

                • Space Griffin
                  Space Griffin  1 weeks back

                  but wouldn't a and b know they've received the message by the third message?

                  • DukeOfEarle88
                    DukeOfEarle88  1 weeks back

                    £7.74 word.

                    • UberKrassMann
                      UberKrassMann  1 weeks back

                      2:55 starts sweating.....

                      • Skepty
                        Skepty  1 weeks back

                        Just tell them to make a fire signal after they do, as confirmation. Not that hard.

                        • Ashor
                          Ashor  1 weeks back

                          for the two generals, couldnt one side send a messenger with the message telling them to attack at a certain time (sundown) but to ensure they both know they both have to shoot a cannon ball to the west of the other general at sunrise) if they both observe the cannon ball west of them then they know they will attack at sundown

                          • Midhunraj R Pillai
                            Midhunraj R Pillai  1 weeks back

                            I wonder how the generals problem is unsolvable. Please correct me whats the mistake of the solution below,



                            Step1: General A sends message saying attack at 6pm
                            (Here, A establishes the time)


                            Step 2: General B gets the message, sends back an acknowledgement 1 for the message 'we go the time'

                            (B gets the time)


                            Step 3: General A gets the ACK 1
                            (now, A knows that B got the time of attack. But B won't attack because B don't know that ACK 1 is reached at A. so..)
                            A sends a confirmation ACK 2 back



                            Step 4: General B gets the ACK 2
                            (now, B knows that both A and B establishes the time. Also B got the ACK 2, meaning B knows that ACK 1 reached A. But B knows that A won't attack until A confirm that B got the ACK 2. so...)

                            B sends a confirmation ACK 3 back


                            Ahhhh this trend continues and no one will attack since they cannot make sure that the previous ACK sent by them is reached at the other end!!! I am sorry (T_T)

                            • Ivan farlenkov
                              Ivan farlenkov  1 weeks back

                              Have generals send messagers at set periods of time even when there is nothing to send. If there is no messager, ask about it in the next message.

                              • Gareth H
                                Gareth H  1 weeks back

                                @Ivan farlenkov You really do not get it. Oh well, nevermind. Stick to flipping burgers.

                              • Ivan farlenkov
                                Ivan farlenkov  1 weeks back

                                @Gareth H Why not? If messagee is lost, request to resend will be eventualy get to the other side.

                              • Gareth H
                                Gareth H  1 weeks back

                                That is the ping approximation that is used. But it is not a solution to the problem, there is no solution.

                            • Monsieur P.
                              Monsieur P.  2 weeks back

                              My bank card would’ve texted me to confirm charge after being pinged to debit my account identical amount of money. It’s kind of stupid that nobody selling the food didn’t notice.

                              • Monsieur P.
                                Monsieur P.  2 weeks back

                                😂 these damn apps!

                                • novicetheaf
                                  novicetheaf  2 weeks back

                                  This is a classic lack of dev testing prior to sending it for testing prior to deploying it to the end user, and QA testing.

                                  • Kevi Kiru
                                    Kevi Kiru  2 weeks back

                                    Even your paid promotions are interesting to listen to!

                                    • Oasia
                                      Oasia  2 weeks back

                                      Why dont the say just to fire a cannon if they recieve the message

                                      • Julian Danzer
                                        Julian Danzer  2 weeks back

                                        2:57
                                        umm...

                                        • Floofzy Kitty
                                          Floofzy Kitty  2 weeks back

                                          1:38 What are you talking about? Of course they made it to the other side. Just not the side they intended.

                                          • Muhammad Adam
                                            Muhammad Adam  2 weeks back

                                            Surely after the 4 messengers they wouldn't need confirmation any further confirmation because both would have already known that it's agreed upon

                                            • Terrain
                                              Terrain  2 weeks back

                                              You didn’t solve the two generals problem, you solved another problem created by it being unsolvable, which arguably is more dangerous than the two generals problem

                                              • BeforeReform
                                                BeforeReform  3 weeks back

                                                per your ad... there is *always* the possibility of brute force getting through. It could take years, or decades on average, but there is always a chance someone gets lucky.

                                                • Angelmarauder
                                                  Angelmarauder  3 weeks back

                                                  TCP/IP

                                                  • its_a_trab
                                                    its_a_trab  3 weeks back

                                                    You could just send the original guy back.

                                                    • Emerald Block Boat
                                                      Emerald Block Boat  3 weeks back

                                                      I'd say that if B received two verifications then do it

                                                      • TARINunit9
                                                        TARINunit9  3 weeks back

                                                        Proposition for the two generals problem: instead of sending one messenger, send a pair of messengers. One messenger stays at camp B and the other returns to camp A. If no messengers return to camp A, then it's obvious that the message was intercepted on one of the two trips, so you send another pair

                                                        • Lloyd Thorpe
                                                          Lloyd Thorpe  3 weeks back

                                                          What they should have done is just starve the castle out like they most commonly did

                                                          • The Nintendo Fan
                                                            The Nintendo Fan  3 weeks back

                                                            Honestly, the red army would automatically assume the blue army got the message and would attack on that time

                                                            • Eric ON
                                                              Eric ON  3 weeks back

                                                              Atleast once invocation solves this issue as well. I.e. let the client keep spamming the same request until one confirm has been recieved.

                                                              • Emil Sørensen
                                                                Emil Sørensen  3 weeks back

                                                                I'd definitely not like having a master password that, if lost, renders my entire online life unrecoverable.

                                                                How can you possibly make your one password unforgettable? Chisel it into an immovable rock?

                                                                • ͔ ͔
                                                                  ͔ ͔  4 weeks back

                                                                  Send the entire army as the messenger

                                                                  • Beowulf Macbethson
                                                                    Beowulf Macbethson  4 weeks back

                                                                    I was watching a video about Morgoth from Lord of the Rings, why am I here.

                                                                    Also your video is great and informative.

                                                                    • TIMΞ СнΛИGΣ
                                                                      TIMΞ СнΛИGΣ  4 weeks back

                                                                      But the generals would know after a few acknowledgements? What am I missing here

                                                                      • andrew allen
                                                                        andrew allen  4 weeks back

                                                                        Good grief, a Hewlett-Packard computer I can do component level repairs and maintenance on!

                                                                        • man0z
                                                                          man0z  4 weeks back

                                                                          I may have double paid for Nandos last night

                                                                          • IlluminatiBG
                                                                            IlluminatiBG  4 weeks back

                                                                            We solved this problem for banking application at work. The app is designed to work offline and synchronize when online. The acknowledgment problem is that you do not know if a message did not reach the server or it reached the server, but the confirmation was lost. As a result each message is uniquely identified in the client and safe to repeat. You can resend a message to the server a million times, but it will result in one transaction only for both client and the server.

                                                                            • Curtis Moore
                                                                              Curtis Moore  4 weeks back

                                                                              This sort of thing happened to me 3 years ago through Amazon. The progress wheel after clicking "Buy Now" kept freezing when I hit it. I foolishly kept refreshing and hitting "Buy Now" again until getting to the confirmation screen. This was why, two weeks later, I had to ship back 15 identical USB phone chargers.

                                                                              • Joshua Anderson
                                                                                Joshua Anderson  4 weeks back

                                                                                So how does general A know that general B got the message?

                                                                                • Joshua Anderson
                                                                                  Joshua Anderson  3 weeks back

                                                                                  @lorvincent Thank you but I'm still not getting it for some reason. Are you saying that general A and B have 1000 other generals to get messages from? If general B relays the message to 1000 other generals how does general B know the other generals got the message? I'm stuck on something here...

                                                                                • lorvincent
                                                                                  lorvincent  4 weeks back

                                                                                  Because 1000 other generals also got the message, and general B relayed to all 1001 of them, which caused the other 1000 to relay to general A that B got the message. It isn't the method described in the video, but this is the basic idea behind distributed ledgers with byzantine fault tolerance.

                                                                              • Asma Hasmalaria
                                                                                Asma Hasmalaria  4 weeks back

                                                                                I have the solution: Instead of sending messengers to general B, general A picks up his phone, dials the number of the favorite pizzeria and says "I want a valley castle, with cheese dip and onions" and Deliveroo gets nothing while the pizzeria gets the money they deserve.

                                                                                • iHunterKiller
                                                                                  iHunterKiller  4 weeks back

                                                                                  We’re looking at this as a 2d plane. In 3d, don’t go through the castle, go around it, meet up, attack together. Done.

                                                                                  • MrCocktaiI
                                                                                    MrCocktaiI  3 weeks back

                                                                                    Few things are as boring as giving 'clever' answers to puzzles that totally disregard the actual problem

                                                                                • Banned From Existance
                                                                                  Banned From Existance  4 weeks back

                                                                                  So what if we get two messengers, one tries to go through the valley meanwhile the other observes the messenger at a safe distance. If the message gets killed, the other person can come back to let them know they failed! Thus they keep attempting until the get it right.

                                                                                  • BillyViBritannia
                                                                                    BillyViBritannia  4 weeks back

                                                                                    So the actual question is 'can you make sure a message arrives if you can't ensure the message' s arrival?'
                                                                                    Well, doesn't take a genius to see why that's impossible.

                                                                                    • BillyViBritannia
                                                                                      BillyViBritannia  4 weeks back

                                                                                      How is the comment section of such a technical/educational video so God damn funny.

                                                                                      • Jonny boy
                                                                                        Jonny boy  4 weeks back

                                                                                        Can quantum computing utilizing quantum entanglement solve this issue?

                                                                                        • Solo Playzz
                                                                                          Solo Playzz  4 weeks back

                                                                                          2 messengers meet in the middle before ya say

                                                                                          • Solo Playzz
                                                                                            Solo Playzz  4 weeks back

                                                                                            Ok so you dont come to this conclusion... I'm gonna get an ego problem

                                                                                          • Solo Playzz
                                                                                            Solo Playzz  4 weeks back

                                                                                            Wait... do you not come to this conclusion??