The Two Generals’ Problem

Share
HTML-code

Comments • 2 022

  • Tom Scott
    Tom Scott   3 weeks 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

    • Liberals Get the Bullet Too
      Liberals Get the Bullet Too  14 hours back

      Why don't the two generals have the messengers meet in the middle, and each return with confirmation of having met? This should immediately double the survivability of any particular messenger - they're only travelling half the hostile distance.
      Further, you could have a second set of messengers in an intermediate space to act as a witness or a redundancy.

    • steve d
      steve d  23 hours back

      Doesn"t mention food delivery company by name, shows headline with delivery company's name...

    • Andrew F
      Andrew F  2 days back

      How is it unsolvable? Wouldn't you just need a maximum of two confirmations sent in order after the original message? If you get at least one confirmation in the correct order after the original message then you know both parties received the original, right? What am I not understanding here?

    • john smith
      john smith  2 days back

      who would put the castle in the valley but a computer tech

    • ERMAN ATES
      ERMAN ATES  3 days back

      It was very well put. Animations were only fabulous. Thanks

  • alnoso
    alnoso  57 minutes back

    i dont get food delivery apps
    is it so hard to call a human and say "hey i want a pizza"

    • Sebastian Nielsen
      Sebastian Nielsen  3 hours back

      There is actually a way to "solve" this problem, and that is continually send messages. They could contain a number, my message number, and the last message number I saw from you. Of course they must be encrypted and end2end verified.
      Continuially send these messages, lets say with 10 minutes apart. Stop sending messages 1 hour before the attack.
      If you stop receiving messages, count 1 for each missed message, Reset counter if you receive a message. If count exceeds 6, attack.
      If the number "I last saw message number X" is more than 6 - (count), attack.

      Regardless on how the adversiary capture the messages, it will result in a successful attack.

      HINT: This is how alarm system works to prevent jamming of wireless signals.

      • Black Light
        Black Light  4 hours back

        youtube recommended, wtf? Why? I neither understand computer logics or having problems with my food arriving.

        • Alexander Cavrich
          Alexander Cavrich  5 hours back

          I

          • less kiss
            less kiss  4 hours back

            err, Works fine for me... sounds like user error....

        • Drake H.
          Drake H.  7 hours back

          Wouldn't you be able to include a signal response request in the initial message (talking about the two generals problem) - like general a gives a time and requests that general b light a large fire in a visible area to confirm receipt and agreement of the message.

          • [TRCZ] NoidEXE
            [TRCZ] NoidEXE  9 hours back

            4:55 but how can you make the same order three times and the server not notice it's the same order? I mean can't you use a pseudo random number generator or something? You only get the next random number if you receive a confirmation or cancel the order. That way if the server gets the same random number for the same client it can tell it's the same order. I'm just a game designer so maybe it's harder than this but I can't think of why it wouldn't work.

            • less kiss
              less kiss  4 hours back

              What if someone wanted to do the same order for multiple people. A certain restaurant verifies double orders

          • Mike Pratt
            Mike Pratt  10 hours back

            Suggestion for dinner next time - Salmon in a dishwasher..?

            • Alexi Hickin
              Alexi Hickin  10 hours back

              I work for deliveroo and I remember this evening, i delivered Wagamamas to a house who had already received their order. I had to wait with them while they got a refund, long story short I got 50 quids worth of Wagamamas for free.

              • Alexi Hickin
                Alexi Hickin  10 hours back

                I earn like 20 quid an hour for deliveroo it’s not bad 😂

                • Raymon Crane
                  Raymon Crane  10 hours back

                  Those look like HP 7933/7935 disk drives in back. Used to fix those back in the day.

                  • roasted pancakes
                    roasted pancakes  11 hours back

                    Just send two million messengers with a paper each towards the blue army. The paper should have a time to attack and a check mark at the bottom of the page. Make the blue army check every single paper and send all of the messengers back. Then both armies will have a reasonable guarantee that each army got the message. Alternatively, reroute one of the armies to meet the other army and have a combined attack with both armies.

                    • TelFiRE
                      TelFiRE  11 hours back

                      There’s nothing unethical about ordering food. I work for Grubhub. Yes there are things I would rather have different, but wouldn’t at their job? By not ordering food all you’re doing is denying me money and making my job harder

                      • TelFiRE
                        TelFiRE  11 hours back

                        And frankly the only unethical think you’re is to frame this is a question of ethics. Businesses are allowed to have different policies and people are allowed to agree or disagree on those policies without it being a matter of ethics. If you don’t want to work there you don’t have to

                    • Simon Johnson
                      Simon Johnson  13 hours back

                      It's not "unsolvable", the word is "insuperable - Pedant

                      • Ask to seduce Miss
                        Ask to seduce Miss  11 hours back

                        knows if A made it and A knows B made it. Both army’s attack. Solved. I know this wouldn’t work in computers but it is a solution if it were just a puzzle

                    • invisiblebears
                      invisiblebears  13 hours back

                      Why couldn't they just continually send back messengers with confirmation until the proposed time and if one of the messengers didn't show up Abort or in the case of a computer disconnect or and endhandshake?

                      • Ask to seduce Miss
                        Ask to seduce Miss  11 hours back

                        A sends a messenger to b. If it makes it , b sends both that messenger and a new messenger from b to the castle. Messenger B turns back and messenger A continues to a

                    • lampree
                      lampree  15 hours back

                      why did this video get uploaded 3 times??

                      • Robert South
                        Robert South  16 hours back

                        Seems like once both generals have received at least one acknowledgement they can just attack since the time hasn't changed.

                        • 007one
                          007one  16 hours back

                          Bitcoin

                          • TheTech9
                            TheTech9  17 hours back

                            This channel is awsome, and this guy is pleasant voice to listen to. No homo

                            • Carl
                              Carl  19 hours back

                              Hey dude do you still see dead people?
                              oh nevermind.

                              • Jake Wish
                                Jake Wish  20 hours back

                                What if someone wanted to do the same order for multiple people. A certain restaurant verifies double orders

                                • Stuart Wilson
                                  Stuart Wilson  20 hours back

                                  err, Works fine for me... sounds like user error....

                                  • Tinka Like AngelOK
                                    Tinka Like AngelOK  20 hours back

                                    Justeat 😂

                                    • hmmm
                                      hmmm  20 hours back

                                      No plussed how this solves the two generals actual problem. Poorly explained.

                                      • xirsamoht x
                                        xirsamoht x  21 hours back

                                        Speckled Jim & his friends!

                                        • Imelda Chandra
                                          Imelda Chandra  22 hours back

                                          I wonder what if like this :
                                          Gen A sent message (8 pm) to Gen B

                                          Gen B reply (ok. 8 pm) to Gen A

                                          is it possible?

                                          • Imelda Chandra
                                            Imelda Chandra  22 hours back

                                            I wonder what if like this :
                                            Gen A sent message (8 pm) to Gen B

                                            Gen B reply (ok. 8 pm) to Gen A

                                            is it possible? or there is another hindrance?

                                            • Ailsa Ni
                                              Ailsa Ni  23 hours back

                                              ally with the other general, and then assume the message got through.

                                              • Verne Jules
                                                Verne Jules  23 hours back

                                                Tom, I understand that the idempotency token/key can solve the problem of double orders/messages. But how does that solve the Two Generals Problem? Forgive my slow brain.

                                                • Ailsa Ni
                                                  Ailsa Ni  23 hours back

                                                  So the solution to the two generals problem is to send a third of your army into the dangerous valley, all of them with a message to attack at a certain time with the survivors to

                                              • Cullenak47
                                                Cullenak47  24 hours back

                                                A sends a messenger to b. If it makes it , b sends both that messenger and a new messenger from b to the castle. Messenger B turns back and messenger A continues to a. B knows if A made it and A knows B made it. Both army’s attack. Solved. I know this wouldn’t work in computers but it is a solution if it were just a puzzle

                                                • Daniel Newton
                                                  Daniel Newton  1 days back

                                                  Have each army send a messenger when they're ready. When the two messengers meet in the middle (taking precautions to avoid getting spotted), each one goes back to their army and says "we're good to go". If the messengers don't make it back, they will assume that they died so can send another, until the two meet and send a return message.

                                                  • Kingsly9802
                                                    Kingsly9802  1 days back

                                                    >If you are in computer science and working on a problem that involves potential loss of life, I really hope you aren't watching a series called "The Basics".
                                                    But they're fun!

                                                    • soSAMuk's UK slot channel

                                                      Why do kids toys adverts have to say “batteries not included?”

                                                      • TheDeathMongrel
                                                        TheDeathMongrel  1 days back

                                                        2 Generals is an interesting conundrum in and of itself but I think it's a poor paradigm for avoiding the processing of repeated messages. In 2 Generals, no one proceeds without an acknowledgment. It's a Schrodinger's Cat problem. You don't know the answer until 8 p.m. when either everyone is at the castle or is still waiting for another acknowledgment. Applying idempotency (which would be against the "strict" rules) to 2 Generals, still wouldn't solve the problem. It would only affirm that additional messages, if any, are the same (attack at 8 p.m.), and only if the messages actually make it. 2 Generals doesn't guarantee message delivery in either direction, so even with idempotency tokens, Army B may still take no action if they don't get their acknowledgment.


                                                        With the delivery issue, if the additional messages don't make it, it doesn't matter, the other side will respond appropriately to the original message. In delivery, the return acknowledgment goes far beyond the 2 Generals' (receipt of message), as you can get an erroneous message, a success or failure, and is likely not to have an effect on processing if no acknowledgment is sent.


                                                        In any case, I think the delivery problem and applications of idempotency tokens as you've described, is its own best explanation of what's going on, not 2 Generals, which idempotency can't be used to solve (again strict rules).

                                                        • Max Mouse
                                                          Max Mouse  1 days back

                                                          General A sends "8pm" General B sends "8pm ack" - General a doesn't attack unless it receives the ack...

                                                          • Aaron
                                                            Aaron  1 days back

                                                            General A sends 2 Messengers. Both go to general B to confirm the message was received. Both go to General A but when passing the castle at the exact halfway point one messenger goes back to general b the other goes on to a. They both know the message was received by general b and the acknowledgement got through back to a.

                                                            • Jasmine
                                                              Jasmine  1 days back

                                                              An interesting follow up would be the Byzantine general's problem - what if there were multiple generals that could back stab each other?

                                                              • 1dgram
                                                                1dgram  1 days back

                                                                Hey, I'm allowed to watch a series called "The Basics" even if I am working on safety of flight software!

                                                                • 1dgram
                                                                  1dgram  1 days back

                                                                  @Jasmine It's one if those words that are pronounced differently in the UK than in the US. You have the correct American pronunciation.

                                                                • Jasmine
                                                                  Jasmine  1 days back

                                                                  Now, can you do one that explains why idempotency is pronounced like that? I've always read it as i-dem-potency

                                                              • KryskZ09
                                                                KryskZ09  1 days back

                                                                At the point where he's talking about sending 200 messengers, and I'm thinking of a solution right now, I will see how wrong I am once I finish the video.

                                                                General A sends a messenger to meet a messenger sent by General B half way to the valley, one with a letter of an estimated time and another of "Hey, here's my letter"
                                                                The messengers swap messages, both now know that once they leave the 50% point they're free of danger. They make their way back to their sending General with the opposing General's note in hand.
                                                                Repeat this process once the messenger arrives at their designated outpost, this time with the other General agreeing (or disagreeing) with the time. If they disagree, repeat this process.
                                                                Now they have the correct schedule and a guarantee that the messenger has arrived.

                                                                Edit: I guess I was incorrect, although my answer wasn't explored. I would assume that it would cause more margin of error though.
                                                                I still don't understand the concept of an idempotence key, sure you're ensuring nothing if fulfilled twice, but what if it breaks to begin with? There's no way for the other side to know...

                                                                • Aline Fernanda
                                                                  Aline Fernanda  1 days back

                                                                  You are so handsome hehe
                                                                  I like your channel! Greats from Brazil.

                                                                  • shinvergil
                                                                    shinvergil  1 days back

                                                                    The example was weak, imo. But good info.

                                                                    • X
                                                                      X  1 days back

                                                                      their is an almost guaranteed way to get it to work
                                                                      general A sends a message, general B continues to send a message until general A responses, if another messenger from general B arrives, General A can assume general B didnt receive the message, and send another message, once General As messenger arrived, at which point no more messages from general B will arrive, so they both attack
                                                                      edit: this is under the assumption that the fail rate of messengers is below 100% and their is plenty of time between attacks

                                                                      • Mr. Pinkpig
                                                                        Mr. Pinkpig  1 days back

                                                                        Wait couldn't one messenger for A and one messenger from B meet in the valley and give each other a set time?

                                                                        • Tulip
                                                                          Tulip  1 days back

                                                                          So this is how the generals communicate

                                                                          Messenger one: we attacking at 8
                                                                          General 1:cool let me sound a confirmation
                                                                          Messenger two: i can confirm that we are attacking at 8
                                                                          General 2: alright, let me send a confirmation Messenger one: we attacking at 8
                                                                          General 1:cool let me sound a confirmation
                                                                          Messenger two: i can confirm that we are attacking at 8
                                                                          General 2: alright, let me send a confirmation Messenger one: we attacking at 8
                                                                          General 1:cool let me sound a confirmation
                                                                          Messenger two: i can confirm that we are attacking at 8
                                                                          General 2: alright, let me send a confirmation Messenger one: we attacking at 8
                                                                          General 1:cool let me sound a confirmation
                                                                          Messenger two: i can confirm that we are attacking at 8
                                                                          General 2: alright, let me send a confirmation Messenger one: we attacking at 8
                                                                          General 1:cool let me sound a confirmation
                                                                          Messenger two: i can confirm that we are attacking at 8
                                                                          General 2: alright, let me send a confirmation Messenger one: we attacking at 8
                                                                          General 1:cool let me sound a confirmation
                                                                          Messenger two: i can confirm that we are attacking at 8
                                                                          General 2: alright, let me send a confirmation Messenger one: we attacking at 8
                                                                          General 1:cool let me sound a confirmation
                                                                          Messenger two: i can confirm that we are attacking at 8
                                                                          General 2: alright, let me send a confirmation Messenger one: we attacking at 8
                                                                          General 1:cool let me sound a confirmation
                                                                          Messenger two: i can confirm that we are attacking at 8
                                                                          General 2: alright, let me send a confirmation Messenger one: we attacking at 8
                                                                          General 1:cool let me sound a confirmation
                                                                          Messenger two: i can confirm that we are attacking at 8
                                                                          General 2: alright, let me send a confirmation Messenger one: we attacking at 8
                                                                          General 1:cool let me sound a confirmation
                                                                          Messenger two: i can confirm that we are attacking at 8
                                                                          General 2: alright, let me send a confirmation Messenger one: we attacking at 8
                                                                          General 1:cool let me sound a confirmation
                                                                          Messenger two: i can confirm that we are attacking at 8
                                                                          General 2: alright, let me send a confirmation

                                                                          • Killer Germ
                                                                            Killer Germ  1 days back

                                                                            This is a shitty hypothetical, as reasonable suggestions will not be accepted.

                                                                            • Jake Hartman
                                                                              Jake Hartman  1 days back

                                                                              pls get patreon and premium memberships and no cemmercials thnx

                                                                              • Z-Statistic
                                                                                Z-Statistic  1 days back

                                                                                So the solution to the two generals problem is to send a third of your army into the dangerous valley, all of them with a message to attack at a certain time with the survivors to ally with the other general, and then assume the message got through.

                                                                                • Hater Bart
                                                                                  Hater Bart  1 days back

                                                                                  Initially, I completely misread the title.