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 www.dashlane.com/tomscott
"A single human error is never the root cause" Because if a single human error _is_ the root cause, then the blame also lies with everyone who allowed the project to be susceptible to a single human error.
Even then, there were multiple poor decisions leading up to that problem (e.g. not taking a backup, working on the live system, not starting a transaction) - so, that case is another example in favour of his point.
@@mr.animation5259 A system should ideally have its own backups put in place as a collective decision (I don't know the context of the database deletion, so I don't know if this was just a personal project or one done by a company). Everything else is on the single Tom though, even if it is multiple poor decisions being made compounded to one outcome.
"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." had me dying omg
The real problem is when the castle intercepts the message and sends back a guy in the messengers clothes changing the time of the attack so they both attack at the wrong time.
Then, when someone comes up with asymmetric crypto, you can introduce the integrity problem, where I don’t care what false time I sent, only that it is different :) it’s a fun little conceit!
@@ameliagryffon7097 asymmetric crypto is when you don't use a single password for both encryption and decryption... Like how the "public key + private key' system works. And integrity is just a hash (checksum) that you can check in order to determine whether the message was changed in transit or not.
When I worked at the warehouse of a well-known internet retailer, I found myself picking 25 copies of Adele's new CD. I began to wonder if someone had accidentally typed the album title into the quantity box.
Finally I understand the Two Generals Problem. It’s dressed up as something fancy, but all it is saying is that if you don’t have a reliable means of communication, you don’t have a reliable means of communication.
As far as I can tell, I have a half-solution to the problem: General A sends a messenger to General B proposing a messenger meeting in the valley, say through 8:00PM to 8:10PM, General A doesn't care if anyone replies, but replies acknowledging that General B has heard the message are welcome. At 8:00PM, send a second messenger to the valley. If no one comes back by 8:10PM, or a messenger died during that meeting, assume failure, repeat the above. If a messenger comes back saying the other messenger made it out alive with a proposed attacking time, that must have been a success. Both armies are ready to attack. This ensures that neither army attacks individually, only that no army attacks or both armies attack.
@@legendgames128this doesn't ensure that though. What if the two messengers meet and agree, but one of them dies before making it back to report? The original problem still exists.
@@legendgames128 only if they know about it, which they can't. The messengers meet and agree, but you cannot trust that both messengers make it back to their generals with the information. If you could trust in that, you wouldn't have this problem to begin with.
@@legendgames128 Keep in mind that, as this is a parallel to sending data, any messenger can die at any point, and the messengers wont be able to see each other or check each others status whilst moving. You could have them 'meet in the valley' on a third server, but either messenger could 'die' on the way back from that meeting without the other messenger or other general knowing.
As astronaut John Glenn put it: "As I hurtled through space, one thought kept crossing my mind - every part of this rocket was supplied by the lowest bidder."
@@Roxolan Labour power has a set price generally rather than going to auction. I actually can't think of any time where workers have gone to auction that I know of.
"If you're in computer science and work on a problem which involves potential loss of life, I really hope you're not watching a series called The Basics." And here I am. Because Tom Scott.
There are only two hard problems in distributed systems: 2. Exactly-once delivery 1.Guaranteed order of messages 2. Exactly-once delivery ~ Mathias Verraes
This issue is so old, it's delightful, anyone who's ever run a print server in a school can tell you just exactly how common it is, especially when a printer suddenly starts handling spooled jobs that have been spooling up for an entire day, that it for some reason didn't start before, and it won't stop running them until well on into the night. And most of them are duplicates. Thankfully there are mitigation methods for that these days, but there didn't used to be
once at a school i worked as it supoort the printer got stuck due to trash wifi (thanks hp for making it internet based) and when it got resolved it started printing a math test 7 times 32 copies. and when you think it finaly stops, it just start another stack of test. i think i would be good to have a quick erase print queve button and not need to nail that 5 sec between print jobs
In some (rare) cases you are right, because when I buy one it's cheaper than buying multiple. I know it sounds totaly wrong and in my opinion it is wrong, however, some shops make an error, like, buy 3 get one free, buy 5 get 20% discount. (yep, buy 3 get 1 free is getting 4 items and translates in 25% discount)
This "Two Generals Prob." has been quite frequently happened to us but in are minds eye we generally calculatingly cop it. Scott is just bring it out to the forefront in layman's terms, i.e the snag. That's is why most apps., have a cart order for the one order.
Addison Chan but then again the entire army could be destroyed just like how any number of messengers could be destroyed and then you only have one army
That was my thoughts exactly. I would immediately notice duplicate orders on my line. Similar is one thing, happens all the time. But duplicates, exactly the same is rare and noticable.
i mean if it was something like a fast food place, theyre making a billion copies of the same order already anyway. a big mac is a big mac is a big mac. or in this case, a pizza
@@gwen6622 small, simple orders sure. But most people order a combination of things, especially when they're already paying to get it delivered. I'm a delivery driver. Unique orders are DEFINITELY very rare and noticeable.
I worked at a pizza place where our system failed one year due to time change, so we'd get orders when they arrived, and 1 hour after they arrived, we ended up with like 60 extra pizzas that night, it was chaos XD.
@@joshyoung1440 And in this case, since the system is bugging out at the payment acknowledgement step and giving a retry prompt on the spot, the duplicate orders would be coming in at rapid succession. Which always looks dodgy.
I’ve been saved so many times by this video. I remember to always double check when it says “order failed” after I get that check mark. That check mark, that Tom explained the significance of, saves me every time.
"If you're in computer science and working on a problem that could cause a potential loss of life, I really hope you aren't watching a series titled 'the basics.'" Oh. If it's any comfort, I'm watching because it's my Lunch break and I love your videos.
Sometimes intelligent people get too inside their own heads, and going back to basics can greatly help eliminate unnecessary considerations, leaving you with a clear answer.
@@derek96720 sometimes, especially in programming, it leads to a programmer stopping his trust in certain packages/libraries and them reinventing the wheel.
@@marclurr Depends. Sometimes it produces a worse solution, sometime it produces a better solution... that only works for a certain specific type of cart.
A very similar thing happened on Uber Eats a few months ago. I'm a driver, and I repeated a route from a specific restaurant to a specific home at least six times.
No, the generals need a way of knowing one another is there while also not being able to coordinate. For example if you were across a real valley you could see an army encampment on the other side if there was one, but you wouldn't be able to see well enough to make out specific people or to coordinate an attack properly. If it was the inverse then you'd have no idea another general is on the opposite base of the mountain also trying to attack the castle.
"I was lucky" it's the opposite. You were cursed with the computer science knowledge. Had you made multiple orders you would have gotten a refund and also eat 5 meals :D
Another solution is what we would do in the electronics industry. Sometimes when you press an analog button, due to the speed of electricity, if the button doesn't make a clean connection, it registers multiple presses. To combat this, we would use a 'debounce' circuit, where a single press of the button temporarily disconnects the button through a semiconductor. This then means that the button will no longer work until a time-delay (usually discharge of a capacitor) has taken place. This would be akin to the solution mentioned here where an order to a restaurant could not be repeated for a specified duration (An hour, for example).
@imahumanandimagamer can you imagine spending 50k and when you get an error, you don't immediately call the seller in panic but you just try and try again
@imahumanandimagamer Not having to go to a Dealer and just instantly getting what you want with no faff sounds amazing to me. You would only really need to see the car if it was used
2:53: “if you’re dealing with a problem that involves potential loss of life, I really hope your not watching a series called the basics.” The military drone programmer watching this: *sweats profusely*
As someone working in IT without any formal training, I hate how much of this I understood. I really like how easily you explain this complex idea in a way normal people... could... could, understand.
Same here... not my main job, but I do design and tweak safety systems at work when needed (robotic welding cells, etc.). Rule #1: "Why is this wrong?"
This really opens your eyes as to how the financial system works when you pay for something. Like, the reality there is no solution to the two general problem. So anything, no matter how advanced and seemingly secure with how it works everyday, is limited by this. Anything is a work around, which just happens to work 99.9999% of the time
There a multiple solutions to the two generals problems. Smoke signals have been used throughout history to solve problems just like this. I hate when metaphors completely miss the point in life and EVERYONE eats it up thinking it's some higher wisdom
@@unsolicitedditkapics9722the metaphor is to try to visualize a computer problem. Which tbh isn’t a real problem, the way we solve this is by having an authoritative source in the middle, that say stores the order with a timeout, then repeat orders cannot be placed until acknowledged, then the server can set it a sack low edged and the client can see it’s been acknowledged. If the timeout is exceeded both now to cancel that order and it has to be booked again by the client.
I find the idea of two armies going one by one through a valley sending acknowledgments back and forth until everyone is dead hilarious Just imagine the army in the castle being confused.
@@Nonsense010688 That would work better for the problem actually. If the castle is in a valley the two armies would be able to see each other but if it was on a hill there wouldn't be a direct line of sight between the armies.
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.
the fact that it's 2023 and this exact thing has happened to me TWICE in the past month. I'm just tired at this point. HOW is this still happening. thank you for describing what's been happening to me i thought it was a me problem for the longest time
Tom: The Two Generals Problem is a classic of computer science. Me: Given how much the development of computer science was tied up with World War II and then the Cold War, I wonder if there's any bonus military history insights. Tom: So there's a castle in a valley... Me: The insight is that computer scientists don't know military history.
The thing is though, the valley has nothing to do with the problem. If it was a flat plane, or a castle on a hill, you could still have the same problem. I wonder if the valley was in the original version of the problem?
@ivan ivanovitch ivanovsky If all my sent messengers are killed on their way back, how do I know the messengers I sent weren't killed on the way there instead of on the way back? If they were killed on the way there, the other army wouldn't know when they're supposed to attack, so our attack would fail.
Or general A could just move himself to general B... I guess that means going to the pizza place & leaving your computer at home. Now I have the mental image of a guy driving his car to a pizza place, but with his entire massive desktop computer along with all of the peripherals in his car with him - "I brought my army".
@@Vousie if general a moves to general b's position, the army will get intercepted on the way and wiped out, since you need both armies to win a battle
Data transactions solved this problem decades ago where the database only writes the transaction if it’s successful end-to-end. If any part of the transaction fails, then the database rolls back the entire transaction. Therefore, if the system was telling users that the transaction was successful when bits of it failed, then that’s either a transaction design or programming mistake.
General A just sends the messenger over and over again until they receive a reply?! General B knows that as long as the message keeps arriving then his own messenger hasn't gotten through?
@@stephencooper5155 This. If both A and B sends messengers and calls them back with the confirmation of an 8pm attack, they will know 100% that the other side got the message. 2-3 messengers does the trick. This "problem" is like elementary school level, I don't understand how can't people figure it out.
@@stephencooper5155 How does general B know that "as long as the message keeps arriving then his own messenger hasn't gotten through"? You send a pre-message to tell what the strategy is? Human intuition? This is fantasy computer land, these things do not apply
@@Lamawalrus Yea they are missing the point, that this is computers. Say general (computer) A spams general B, B sends message to A saying let's go at 8. A receives the message, yes, but B can't know for sure that A received the message just because A stopped sending messages to B. If B doesn't get to A, and A stops because it eventually has to stop, how does B know it got through? If A updates the message it was spamming to say "We got your message, attack at 8 am doubly confirmyed!" then A can't know for sure that B is receiving THAT message.
Ah, but why does that single human have so much power to completely ruin such a system by themselves? In which case the root cause is actually poor change management or lack of adherence to principle of least privilege or lack of protections for certain key equipment. The key word is "root" cause which dives down much further than the fact that a single human may have caused the problem, but isn't themselves the "root" cause. And a malicious actor bringing down something is not really an "error", and even still may have root causes in poor security measures.
It's not a SINGLE error. Tom mentions a couple things that should be there (the token, the inability to order the same thing in a set period, that sort of thing).
Usually most failures of systems are a culmination of various factors that either together or independently causes something to behave in unintended ways
EpicKaiserTom sometimes a single programming error can bring down an entire operation (I think once an unmanned spacecraft crashed because a typo). There really isn’t any think that could’ve been done to prevent it, it’s not a result of poor choices or management, it’s just the way things are in this world
@@KaiserTom Ahem Ahem Y2K was caused by one dude saying "Lets do dates DD/MM/YY and everyone copying him. Single human could've destroyed almost all computers if no one had picked up on it.
2:45 What if each side sends a guy to the middle, and they communicate at the middle, and they each return and each report the success of an agreement.
the problem is that even if their messenger returns from such an arrangement in the middle neither general will be able to know with one hundred percent certainty that the other sides messenger has made it home safely since they would only know if their respective messengers arrived safely .
@@mohammedhussain6749 genius, that was exactly what i wanted to comment about, the algorythim just knows that this video is talking about food deliveries but not if good or bad :D
“I know.” “I know you know.” “I know you know I know.” … When I was little, I was so confused by this. Good to know it’s actually an unsolvable problem!
It's solvable - if you send a person to deliver a message tell them to come back once they have delivered it. If they don't come back send another message until one person comes back. Then you know they got the message and therefore will attack at the same time.
It's solvable - if you send a person to deliver a message tell them to come back once they have delivered it. If they don't come back send another message until one person comes back. Then you know they got the message and therefore will attack at the same time.
Is this problem the thing where you send a text message and it says “message not sent” so you spam it and then your friend says you sent 10 of the same message?
And the solution is anti-spam bots in twitch chat. You try to say the exact same thing twice in a row and it will let you know your duplicate message won't go through and you need to wait X amount of time before posting the same message again.
@@MrJoeDone Depends on how they implement the bot. Since the bot will have a cache of the original messages, it could update the id of the message to be the same as the id of the old message thus making it effectively the same exact message as far as the system is concerned.
If I was an engineer working on a computer science problem with human lives on the line, I might still watch a series titled "the basics" because Tom Scott is worth watching.
Because of this video I avoided a similar problem with uber eats, it said there was a problem ordering and I remembered this video, made sure to check my bank account. Sure enough while Uber said the order wasn't placed, the money was out of my account. 20 minutes later my order arrives, thanks Tom!
The CS solution I learned in my network analysis class: 1. "A" sends a messenger (MSG) to "B". It waits a specified amount of time. If it has not heard back an acknowledgement (MSG-ACK) from "B" within this time, it resends another messenger. 2. When "B" receives a MSG from "A", it sends back a MSG-ACK to "A". Every time that "B" receives another MSG from "A" or some specified amount of time passes, it will send that same MSG-ACK in response. 3. When "A" finally receives one of these MSG-ACKs from "B" , it will send back its own acknowledgement (ACK) to "B". Again, it will send back one of these ACKs for every MSG-ACK it receives, but NOT after some specified time period like it did previously. 4. Once "B" receives this ACK from "A", it knows it can stop sending MSG-ACKs, since an ACK from "A" means it has received B's MSG-ACK. At this point, both A and B have authenticated the other's messages. If I missed anything or was wrong about something let me know!
Question: How does A know that B has received its ACK. It seems you're relying on the absence of MSG-ACKs to signal that. But, the same absence of MSG-ACKs could be produced if: * the ACK from A gets dropped, and * every retransmitted MSG-ACK from B also gets dropped. In that case, A will have sent its final ACK and decide to attack, but B will still be waiting for A's ACK and decide not to. There's also the question of how long A should wait for retransmitted MSG-ACKs before comitting to an attack time. The goal is for A and B to come to a consensus about when to attack within a bounded amount of time. But in your approach, A might have to service MSG-ACKs indefinitely. You'd have to tell A to assume B received the ACK if it doesn't see MSG-ACKs for some time. It's possible that B was sending MSG-ACKs for that entire time, but none of them were getting through. In that case, A will decide to attack but B won't. It's worth noting that the approach you describe is what's used by TCP when terminating a connection. Because of the Two Generals Problem, the last person to send an ACK can't be sure the ACK has gone through. So, we tell them to keep the connection open for some TIME_WAIT period - 120s by default. If they see a retransmission within that time, they resend their ACK and (I think) reset their timer. If the TIME_WAIT period expires and we haven't seen any retransmissions, we assume the network will never fail so badly as to deliver no retransmissions for that long, and we conclude that B has seen our ACK and we can terminate the connection.
Maybe the castle should be on the hill, and the armies on two valleys. It'd eliminate the need to say 'don't use flags' too, since the armies wouldn't have line of sight.
"If you're in computer science and work on a problem which involves potential loss of life, I really hope you're not watching a series called The Basics." Meanwhile, everyone at StackOverflow...
My solution: Send the entire army as messengers and all attack together from 1 side (I know that this only works in the 2 Generals Problem and not in the real world but I was still pleased to find a work-around)
Just set up a protocol: General A sends a messanger. If more than twice the time it takes a messanger to get to the other side and no messanger got back this means one of the messangers failed. So general A sends another one.
what if the messenger gets lots on the way back from general B? then general B received the message but general A didnt receive the confirmation. now general B might attack while general A is still sending another messenger
I almost ordered pizza multiple times recently when they said payment wasn't recieved, but I was too tired to care about reordering and gave up. Imagine my surprise when it showed up an hour later, lmao
As a computer science student, it's really cool to see Tom introducing problems like these to the general public! This is one of the many things people learn in their network communication courses in undergrad! It's crazy how many seemingly simple problems there are with communicating in distributed systems
Message 1: We attack at 8. Message 2: Okay, 8 it is. Message 3: Great. See you then. Message 4: Great. Don't both parties know what's up at this point? This is hurting my head.
"I was tired and I was hungry, as are a lot of their drivers" Jim Ross: Tom Scott Slam! Tom Scott Slam! GOOD GOD ALMIGHTY he's destroyed them! 21 seconds, TWENTY ONE SECONDS and its all over.
I mean, for women it's kind of like that. No matter how many other soldiers you send, once she's preparing your order you'll have to wait for it to be delivered to order a new one.
For once, this is a very helpful sponsorship. I thought it was concerning that all of someone's passwords are stored in one location, so thanks for clearing that up!
One evening in late 2018, our neighbours came over and gave us free pizza saying they received more than they ordered, but we never knew why or what happened. Funny that this video seems to have solved that mystery haha
This is how you solve the two generals problem. You move your entire army to the other side, that way there will be no one left to not know whether the message came through. And then you just attack together.
Since the messengers can not go around, the place where the castle stands is the only connection between the sides. That makes it a strategically important point.
@@schwarzerritter5724 But building a castle in a low point means besieging parties can set up siege engine on the hills and bombard with a height advantage. If the valley can project force in the surrounding area, the hill can do it better.
It is debatable, if the valley is really that important and the local garrison is big enough said fortress may be always able to hold out until reinforcements arrive
The real issue is linear pathing who decided the rules of point a to point b If this was real internet with reverse dns you can go from point A to point C to point B cause a+b failed connection
I'm gonna be honest, as a military history nut, and someone who's convinced that computers are magic boxes, I completely missed the part at the beginning where you mentioned that this was a metaphor for computer related witchcraft, so I was just like, "send up a smoke signal or something when the message is received"
Me: no you can't have pizza for dinner. 7 year old Son:Why not? Me: because you had pizza for lunch. Son: why can't I have pizza for lunch and dinner. Me: because of idempotency.
Everyone else: Goes to bed a reasonable time Me: Stays up all night trying to solve the unsolvable general problem with 0 knowledge of computer science
You'd only be attacking from one side. Which in this metaphor would translate to the two computers being somehow physically conjoined and not connected to the internet at all.
@@dipperjc then just send the army back as “messengers” again. Atleast now you had communication with the other side. Ofcourse, this doesn’t really apply since it’s a computer science question as mentioned in the video. But yk just having some fun
Reminds me of my Christmas shopping experience last year: I ordered some gifts from a store that I hadn't ordered from in a while and didn't realize that the credit card still linked to that account has expired in the meantime. So I ordered and used the stored credit card info to pay and the website didn't notice either. It just displayed the usual "thanks for your order" page and I went on to different things. A week later I wondered why I still haven't received the stuff and realized that I hadn't gotten an order confirmation per e-mail either. So I ordered again and the website got me through checkout again, saying everything's fine. This time I monitored my inbox and after two hours of nothing, checked my order history in my account, found no order and ordered again, but got no mail again. It took two days of back and forth with the customer support for them to find out why my orders weren't processed. I wonder why they were confirmed on the website though... 🤔
I would imagine a check and prompt for a card expiration would be one of the must-have features in any webshop. Crazy to think that on this day and age someone didn't implement it.
"The root cause is that our processes aren't robust enough to prevent a person making this mistake" - a former colleague set this as a slack autoresponse any time any dare write the letters "RCA"
Hey, for those interested in the physical background of this problem, the two generals problem is an anology related to the limitations of synchronizing two clocks (due to the speed of transfering information). Since information can't travel (up to our best knowledge) faster than the speed of light (which means that there must be a finite value for it's speed so that there can't be instantaneous change of information) both clocks will always be differing by some amount of time. Very very tiny small difference of course (unless they are super spaced but that's not the case of the valley here). However, that tiny difference is enough to say the atack is not simultaneous as general A and B will advance with a slight time diference (like clock A and B that can't be synchronized).
That's a great way to look at the problem. But that means that the answer to this question is telephones. That large difference is a small one with our current technology.
But can’t you use that knowledge to ‘sync ahead’ the other clock so they are both equal? Like move Clock B so it appears 1 femtosecond ahead, but in reality is the same, just lagging.
@Aaron you missed the point. in that situation the root cause isn't the single influential person, its the system, which has been built up to allow such a thing by multiple errors compounding over time. the point being that there is a difference between the *instigating event* and the *root cause*
That was about what I expected to be the solution - just send several messages if you don't get a reply and find a way for the server to identify duplicate requests.
I think it would be instructive to add that TCP/IP recognizes this problem and includes a packet ID. The two generals problem explanation increases my appreciation for TCP/IP. Thanks!
I'm surprised there is no mention about Byzantine Faults (a.k.a the Byzantine generals problem), and there are solutions that claim to be "Byzantine compliant" or "Byzantine fault tolerant", and this is a big thing in the cryptocurrency space right now.
@@OrigamiMarie Google podcasts does something similar when I delete a podcast after I've finished listening but there's still a few seconds of audio left.
It's always striking to me how on one hand you seek to dispel memes, stereotypes, tropes, and misconceptions yet intersperse your videos with interjections of sociopolitical memes, stereotypes, tropes, and misconceptions.
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 www.dashlane.com/tomscott
2 weeks ago?!?
whattt
2 weeks ago... Hmm...
Tom Scott time travelling tom
for those asking this was uploaded 2 weeks ago but just scheduled to be released today
I also put in a food order that night... and 30 minutes later a messenger showed up with orders about attacking some castle. Crazy night!
So did the other army show up at the same time as you?
What a crazy knight
@glyn hodges we were waiting on your acknowledgement of our acknowledgment.
@@michaelfranciotti3900 I told you this is why we needed an idempotency key.
@glyn hodges your attack was pitiful from my view in the castle....
"A single human error is never the root cause"
Because if a single human error _is_ the root cause, then the blame also lies with everyone who allowed the project to be susceptible to a single human error.
This is funnier if you just came from Tom's fireworks video
content content content
Remember the episode where Tom accidentally deleted an entire database?
@@KnakuanaRka where the supervisor that tasked Tom with converting the database should've maybe backed it up in some way? Yes.
*Writes entire application on my own for my own personal solo venture*
*Issues arise with the application*
"At least it's not ALL my fault!"
Tom Scott: A single person can never be the root problem.
Also Tom Scott: ONCE I DELETED AN ENTIRE DATABASE
Even then, there were multiple poor decisions leading up to that problem (e.g. not taking a backup, working on the live system, not starting a transaction) - so, that case is another example in favour of his point.
@@christopherstokes9393 good point actually! Thanks for the insight, I was thinking the same way as the guy above you.
Like @Christopher Stokes said there were multiple errors that lead up to that.
@@christopherstokes9393 weren't they still all his fault? Multiple mistakes by one Tom
@@mr.animation5259 A system should ideally have its own backups put in place as a collective decision (I don't know the context of the database deletion, so I don't know if this was just a personal project or one done by a company). Everything else is on the single Tom though, even if it is multiple poor decisions being made compounded to one outcome.
"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." had me dying omg
Me too. I laughed out loud.
What. is this series ? i searched for the series I got a comedy show related series.
@@AjayKumar-fd9mv This video is part of a series called The Basics, in witch Tom explains The Basics of computer science
You lost your life
Same
The real problem is when the castle intercepts the message and sends back a guy in the messengers clothes changing the time of the attack so they both attack at the wrong time.
Then, when someone comes up with asymmetric crypto, you can introduce the integrity problem, where I don’t care what false time I sent, only that it is different :) it’s a fun little conceit!
@@berksterb8475 I don't know what asymmetric crypto and integrity problem are XD
@@ameliagryffon7097 asymmetric crypto is when you don't use a single password for both encryption and decryption... Like how the "public key + private key' system works. And integrity is just a hash (checksum) that you can check in order to determine whether the message was changed in transit or not.
@@irrelevant_noob Oh okay I think I understand.
I sort of like these little hypothetical scenarios, like you have to take it at face value and no other way or it’ll quickly fall apart.
the real question: why do you put a castle in a valley??
Ur right they were always on hills
Mathieu Kransfeld the problem actually makes more sense if the castle was in a hill, then you wouldn’t be able to see the other army
@@ExaltedPhoenix someone didn't get the joke
MACHICOLATIONS!!!
Cheers if you get the reference.
ha ha ha
When I worked at the warehouse of a well-known internet retailer, I found myself picking 25 copies of Adele's new CD. I began to wonder if someone had accidentally typed the album title into the quantity box.
Maybe it was Adele bumping her numbers up.
@@tactcom7 actually it was a very devoted Latin American dictator who was a fan of hers
@@DespicableDishwasher Nah, that only happens to Cherlene.
100 BUCKS says he's at amazon
@@jonmendelson1104 but that only happens with outlaw country music
Finally I understand the Two Generals Problem. It’s dressed up as something fancy, but all it is saying is that if you don’t have a reliable means of communication, you don’t have a reliable means of communication.
As far as I can tell, I have a half-solution to the problem: General A sends a messenger to General B proposing a messenger meeting in the valley, say through 8:00PM to 8:10PM, General A doesn't care if anyone replies, but replies acknowledging that General B has heard the message are welcome. At 8:00PM, send a second messenger to the valley. If no one comes back by 8:10PM, or a messenger died during that meeting, assume failure, repeat the above. If a messenger comes back saying the other messenger made it out alive with a proposed attacking time, that must have been a success. Both armies are ready to attack.
This ensures that neither army attacks individually, only that no army attacks or both armies attack.
@@legendgames128this doesn't ensure that though. What if the two messengers meet and agree, but one of them dies before making it back to report? The original problem still exists.
@@JordanYee Would the other messenger not realize their death and thus report that death?
@@legendgames128 only if they know about it, which they can't. The messengers meet and agree, but you cannot trust that both messengers make it back to their generals with the information. If you could trust in that, you wouldn't have this problem to begin with.
@@legendgames128 Keep in mind that, as this is a parallel to sending data, any messenger can die at any point, and the messengers wont be able to see each other or check each others status whilst moving. You could have them 'meet in the valley' on a third server, but either messenger could 'die' on the way back from that meeting without the other messenger or other general knowing.
As astronaut John Glenn put it: "As I hurtled through space, one thought kept crossing my mind - every part of this rocket was supplied by the lowest bidder."
Including the astronaut! Even if the labour market has a little more friction.
@@Roxolan
Labour power has a set price generally rather than going to auction. I actually can't think of any time where workers have gone to auction that I know of.
@@Graknorke slavery, graknorke. It was during slavery.
Are slaves auctioned? I would've assumed it was just a set price.
@@Graknorke I think it was both
"If you're in computer science and work on a problem which involves potential loss of life, I really hope you're not watching a series called The Basics."
And here I am. Because Tom Scott.
What are you working on? - if I may ask :)
*USE MIRROR FLASH*
Tamashii M. H. What do you work on?
@@tummasmohr7160 getting sum likes... I hope...
He's working on killer robots, obviously.
There are only two hard problems in distributed systems: 2. Exactly-once delivery 1.Guaranteed order of messages 2. Exactly-once delivery
~ Mathias Verraes
I'll thumb you up to let you know I received your message.
Don’t forget, messages of order guaranteed.
WMTeWu I received message regarding the 10 million dollars you’re giving me.
I laughed oud loud! :D
This issue is so old, it's delightful, anyone who's ever run a print server in a school can tell you just exactly how common it is, especially when a printer suddenly starts handling spooled jobs that have been spooling up for an entire day, that it for some reason didn't start before, and it won't stop running them until well on into the night. And most of them are duplicates. Thankfully there are mitigation methods for that these days, but there didn't used to be
once at a school i worked as it supoort the printer got stuck due to trash wifi (thanks hp for making it internet based) and when it got resolved it started printing a math test 7 times 32 copies. and when you think it finaly stops, it just start another stack of test. i think i would be good to have a quick erase print queve button and not need to nail that 5 sec between print jobs
Oi nothing wrong with ordering the exact same things 5 times in a row I have my reasons
Order five copies of the same thing in the same order you're not fooling anyone at the restaurant
Lots of us do this. But there's normally a week or so between each of the orders not 1 minute :)
In some (rare) cases you are right, because when I buy one it's cheaper than buying multiple. I know it sounds totaly wrong and in my opinion it is wrong, however, some shops make an error, like, buy 3 get one free, buy 5 get 20% discount. (yep, buy 3 get 1 free is getting 4 items and translates in 25% discount)
This "Two Generals Prob." has been quite frequently happened to us but in are minds eye we generally calculatingly cop it. Scott is just bring it out to the forefront in layman's terms, i.e the snag. That's is why most apps., have a cart order for the one order.
“Haha… I ordered this all for a bunch of friends!”
**cries eating 5 pizzas alone**
Have you tried negotiating with the lord of the castle? Was peace even an option?
*P E A C E W A S N E V E R A N O P T I O N*
I can think of a solution. Move A to B (or vice versa). Two armies!
@@addisonchan3053 I was looking for that comment.
Addison Chan but then again the entire army could be destroyed just like how any number of messengers could be destroyed and then you only have one army
This is magical computer science land, so *peace was never an option.*
Imagine being the line cooks on that day. "I swear I made this order two times already."
That was my thoughts exactly. I would immediately notice duplicate orders on my line. Similar is one thing, happens all the time. But duplicates, exactly the same is rare and noticable.
i mean if it was something like a fast food place, theyre making a billion copies of the same order already anyway. a big mac is a big mac is a big mac. or in this case, a pizza
@@gwen6622 small, simple orders sure. But most people order a combination of things, especially when they're already paying to get it delivered. I'm a delivery driver. Unique orders are DEFINITELY very rare and noticeable.
I worked at a pizza place where our system failed one year due to time change, so we'd get orders when they arrived, and 1 hour after they arrived, we ended up with like 60 extra pizzas that night, it was chaos XD.
@@joshyoung1440 And in this case, since the system is bugging out at the payment acknowledgement step and giving a retry prompt on the spot, the duplicate orders would be coming in at rapid succession. Which always looks dodgy.
I’ve been saved so many times by this video. I remember to always double check when it says “order failed” after I get that check mark. That check mark, that Tom explained the significance of, saves me every time.
"If you're in computer science and working on a problem that could cause a potential loss of life, I really hope you aren't watching a series titled 'the basics.'"
Oh. If it's any comfort, I'm watching because it's my Lunch break and I love your videos.
Sometimes intelligent people get too inside their own heads, and going back to basics can greatly help eliminate unnecessary considerations, leaving you with a clear answer.
@@derek96720 sometimes, especially in programming, it leads to a programmer stopping his trust in certain packages/libraries and them reinventing the wheel.
@@marclurr "explodes when you try to burn it"... doesnt that defeat the purpose 🤔
@@marclurr Depends. Sometimes it produces a worse solution, sometime it produces a better solution... that only works for a certain specific type of cart.
same here, and I'd never heart of 2 generals
"Next time i'll just cook for myself"
I was expecting:
"This series of the Basics is sponosred by Blue Arpon"
Same thought, but with Hello Fresh since I listen to NDQ and Hello Internet podcasts.
@@diamondflaw Fellow Tim I see
@LueLou WOAH THAT'S AWESOME! Step up California
something something The Basics with Babish
I thought "That's a lie, and you know it."
4:49
"A single human error is never the root cause"
Me: *looking at line 456 of my code that has a missing semi-colon* "SEE?"
Never
Well that’s not your only life error making you miss that semi colon
😅😅😅😅
@@da4127 My exact excuse of a thought
Missing a semi-colon, app would just not work and not result in such catastrophe.
A very similar thing happened on Uber Eats a few months ago. I'm a driver, and I repeated a route from a specific restaurant to a specific home at least six times.
@Cal Alaeragod damnit david
For me it would be more logical if the castle was on a hill. In that case the generals couldnt just see eachother
you make a really valid point
Or even more logically, a long ridge, so they can't just go around the side.
It's also a more logical place to build a castle.
most castles also are on hills
Can’t they just go around the hill then?
No, the generals need a way of knowing one another is there while also not being able to coordinate. For example if you were across a real valley you could see an army encampment on the other side if there was one, but you wouldn't be able to see well enough to make out specific people or to coordinate an attack properly. If it was the inverse then you'd have no idea another general is on the opposite base of the mountain also trying to attack the castle.
"I was lucky" it's the opposite. You were cursed with the computer science knowledge. Had you made multiple orders you would have gotten a refund and also eat 5 meals :D
😂😂🤔
true though
you... are right
Or not gotten anything at all
@SublimeHawk6 who doesnt?
"But I was tired, and i was hungry. As are a lot of their drivers"
sheeeeeesh, that was a harsh one xD
Another solution is what we would do in the electronics industry. Sometimes when you press an analog button, due to the speed of electricity, if the button doesn't make a clean connection, it registers multiple presses. To combat this, we would use a 'debounce' circuit, where a single press of the button temporarily disconnects the button through a semiconductor. This then means that the button will no longer work until a time-delay (usually discharge of a capacitor) has taken place. This would be akin to the solution mentioned here where an order to a restaurant could not be repeated for a specified duration (An hour, for example).
Tesla just had this issue with their website. Someone ordered 28 cars by clicking the buy button again and again after it said there was an error.
XD
@imahumanandimagamer tesla is full online
@imahumanandimagamer can you imagine spending 50k and when you get an error, you don't immediately call the seller in panic but you just try and try again
@@huisbaasbob1923 When you have money for a Tesla, you probably don't worry about getting charged twice.
@imahumanandimagamer Not having to go to a Dealer and just instantly getting what you want with no faff sounds amazing to me. You would only really need to see the car if it was used
“When something goes this drastically wrong… A single human error is never a root cause.” Challenge accepted
but your birth required 2 people
@@mrocto329 :D
@@mrocto329 yooooooooooooo
@@mrocto329 yooooooooo duuuuuuuuuuude
uncool
@@mrocto329 OHHHHHHHHHHHHHHHHHH dude....
-"So what are we having? Chinese? Mexican?"
-"Byzantine".
Constantinople.exe stopped working.
Do you want to execute Istanbul.exe?
Asrın Yiğit Execute Constantine
We will take Jerusalem.
Then the winged hussars arrived!
0:07 "A certain food-delivery app"
5 seconds later:
Deliveroo
2:53: “if you’re dealing with a problem that involves potential loss of life, I really hope your not watching a series called the basics.”
The military drone programmer watching this: *sweats profusely*
swets
Swets
@@ignotuscapillary8313 oh, ya. Better correct that.
You're.
y
o
u
r
So it's like double posting by accident?
I see what you did there.
Urrgh, hate when this happens.
Yes
Bravo
wp mon ami, wp!
As someone working in IT without any formal training, I hate how much of this I understood.
I really like how easily you explain this complex idea in a way normal people... could... could, understand.
This guy is something between 20 and 60 years old i cant tell
I literally have no idea what his age is
I... I think you just discovered a new paradox
He’s 34
@@colbyd7618 so OP was spot on!
Welcome to computer science...
Tom, I am a safety critical programmer and I am watching a series called the basics, but more cause I like your stories and less for use at work :)
Robby Maura is potential loss of life involved? 😂
But how do you solve this problem at work?
Same here... not my main job, but I do design and tweak safety systems at work when needed (robotic welding cells, etc.). Rule #1: "Why is this wrong?"
@@ratdude747
Rule #2 : Why is this right?
It is also a good idea to get a refresher now and then, especially when it is entertaining.
This really opens your eyes as to how the financial system works when you pay for something. Like, the reality there is no solution to the two general problem. So anything, no matter how advanced and seemingly secure with how it works everyday, is limited by this. Anything is a work around, which just happens to work 99.9999% of the time
Except that there is a solution. And he showed it to you.
@@stargazer7644 There is still a fault in that system. Just rewatch the part at 5:50
@@stargazer7644 that isn't a foolproof solution, because the return data is still impossible to confirm
There a multiple solutions to the two generals problems. Smoke signals have been used throughout history to solve problems just like this. I hate when metaphors completely miss the point in life and EVERYONE eats it up thinking it's some higher wisdom
@@unsolicitedditkapics9722the metaphor is to try to visualize a computer problem. Which tbh isn’t a real problem, the way we solve this is by having an authoritative source in the middle, that say stores the order with a timeout, then repeat orders cannot be placed until acknowledged, then the server can set it a sack low edged and the client can see it’s been acknowledged. If the timeout is exceeded both now to cancel that order and it has to be booked again by the client.
I find the idea of two armies going one by one through a valley sending acknowledgments back and forth until everyone is dead hilarious
Just imagine the army in the castle being confused.
“Why do they keep attacking one at a time?!?”
I'm more confused on who builds the castle IN the valley and not on a Hill...
Si Wi it’s over anakin! I have the high ground!
@@Nonsense010688 That would work better for the problem actually. If the castle is in a valley the two armies would be able to see each other but if it was on a hill there wouldn't be a direct line of sight between the armies.
What about them both sending a messenger at 8pm so they will meet in the middle to sync there attacks.
See you all in 2023 when this video gets recommended again
I know right?
lmao
See you there slick
*Eyy fellas*
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.
That's rather _selfish_
wtf is a wagamama
Sorry but do you speak English? I have no idea what what you are talking about :(
@@luckymouse1988 underrated pun right there.
No actually, wtf is a wagamama someone pls
the fact that it's 2023 and this exact thing has happened to me TWICE in the past month. I'm just tired at this point. HOW is this still happening. thank you for describing what's been happening to me i thought it was a me problem for the longest time
"I was tired and hungry... as are a lot of their drivers."
Never stop being savage.
@@DvH_2 ikr? I had no clue the word savage had anything to do with the Pauls.
Tom: The Two Generals Problem is a classic of computer science.
Me: Given how much the development of computer science was tied up with World War II and then the Cold War, I wonder if there's any bonus military history insights.
Tom: So there's a castle in a valley...
Me: The insight is that computer scientists don't know military history.
The thing is though, the valley has nothing to do with the problem. If it was a flat plane, or a castle on a hill, you could still have the same problem. I wonder if the valley was in the original version of the problem?
Possible if the castle is protecting something like a holy site or is an important crossroad between mountains, for example.
Like there would be military history when a point needed to be made. Peoples attention spans are at stake here!
@@noahjordan6761 and so are the two generals
The insight is that it's not supposed to resemble a real military situation.
General A could just move his whole army to general B.
I guess that involves driving to the pizza place though.
Haha
@ivan ivanovitch ivanovsky What if all the sent messengers are killed on their way back?
@ivan ivanovitch ivanovsky If all my sent messengers are killed on their way back, how do I know the messengers I sent weren't killed on the way there instead of on the way back? If they were killed on the way there, the other army wouldn't know when they're supposed to attack, so our attack would fail.
Or general A could just move himself to general B... I guess that means going to the pizza place & leaving your computer at home.
Now I have the mental image of a guy driving his car to a pizza place, but with his entire massive desktop computer along with all of the peripherals in his car with him - "I brought my army".
@@Vousie if general a moves to general b's position, the army will get intercepted on the way and wiped out, since you need both armies to win a battle
Data transactions solved this problem decades ago where the database only writes the transaction if it’s successful end-to-end. If any part of the transaction fails, then the database rolls back the entire transaction.
Therefore, if the system was telling users that the transaction was successful when bits of it failed, then that’s either a transaction design or programming mistake.
"it's unsolveable"
me at 2 am: well, there must be a way ...
General A just sends the messenger over and over again until they receive a reply?! General B knows that as long as the message keeps arriving then his own messenger hasn't gotten through?
@@stephencooper5155 This. If both A and B sends messengers and calls them back with the confirmation of an 8pm attack, they will know 100% that the other side got the message. 2-3 messengers does the trick. This "problem" is like elementary school level, I don't understand how can't people figure it out.
@@stephencooper5155 How does general B know that "as long as the message keeps arriving then his own messenger hasn't gotten through"? You send a pre-message to tell what the strategy is? Human intuition? This is fantasy computer land, these things do not apply
@@abeltutor9034 If a famously unsolvable problem appears to be an elementary school level problem, then it's more likely you misunderstood the problem
@@Lamawalrus Yea they are missing the point, that this is computers.
Say general (computer) A spams general B, B sends message to A saying let's go at 8. A receives the message, yes, but B can't know for sure that A received the message just because A stopped sending messages to B.
If B doesn't get to A, and A stops because it eventually has to stop, how does B know it got through? If A updates the message it was spamming to say "We got your message, attack at 8 am doubly confirmyed!" then A can't know for sure that B is receiving THAT message.
"A single human error is never the root cause"
A single human error: I'm about to end this man's whole career
Ah, but why does that single human have so much power to completely ruin such a system by themselves? In which case the root cause is actually poor change management or lack of adherence to principle of least privilege or lack of protections for certain key equipment. The key word is "root" cause which dives down much further than the fact that a single human may have caused the problem, but isn't themselves the "root" cause. And a malicious actor bringing down something is not really an "error", and even still may have root causes in poor security measures.
It's not a SINGLE error. Tom mentions a couple things that should be there (the token, the inability to order the same thing in a set period, that sort of thing).
Usually most failures of systems are a culmination of various factors that either together or independently causes something to behave in unintended ways
EpicKaiserTom sometimes a single programming error can bring down an entire operation (I think once an unmanned spacecraft crashed because a typo).
There really isn’t any think that could’ve been done to prevent it, it’s not a result of poor choices or management, it’s just the way things are in this world
@@KaiserTom Ahem Ahem Y2K was caused by one dude saying "Lets do dates DD/MM/YY and everyone copying him. Single human could've destroyed almost all computers if no one had picked up on it.
4:48 Old Tom: A single human error is *never* the root cause.
18 or 19 y.o. Tom: *ONOSECOND*
Or you know, *accidentally deleting an entire data base* do get the joke tho if there is one
@@j.hawkins8779 "onosecond" is a reference to that exact video you're talking about
@@SSM24_ yes, I know
@@j.hawkins8779 You know, but how do I know that you know? And if I know then how do you know that I know that you know? AND IF YOU KN-.....
@@crimsonstrykr hm, yes. *infinite loop*
2:45 What if each side sends a guy to the middle, and they communicate at the middle, and they each return and each report the success of an agreement.
What if one person doesn't return
the problem is that even if their messenger returns from such an arrangement in the middle neither general will be able to know with one hundred percent certainty that the other sides messenger has made it home safely since they would only know if their respective messengers arrived safely .
imagine if the sponsor at the end was deliveroo
😅 That would be fun!
I got a pre video ad for deliveroo.
@@mohammedhussain6749 genius, that was exactly what i wanted to comment about, the algorythim just knows that this video is talking about food deliveries but not if good or bad :D
Who Deliveroo? 😬
@@seanmurphy4465 A chinese owned version of uber eats
“I know.”
“I know you know.”
“I know you know I know.”
…
When I was little, I was so confused by this. Good to know it’s actually an unsolvable problem!
It's unsolvable, I know.
@@RGC_animation I know you know it's unsolvable.
@@jebbsredemption I know you know I know it’s unsolvable.
It's solvable - if you send a person to deliver a message tell them to come back once they have delivered it. If they don't come back send another message until one person comes back. Then you know they got the message and therefore will attack at the same time.
It's solvable - if you send a person to deliver a message tell them to come back once they have delivered it. If they don't come back send another message until one person comes back. Then you know they got the message and therefore will attack at the same time.
Watched this months ago and now I'm being told to watch it again by my university professor. Tom Scott never fails to impress.
*Am I the only one who realises that this still doesn't solve the 'classic problem' involving the 2 armies?*
Is this problem the thing where you send a text message and it says “message not sent” so you spam it and then your friend says you sent 10 of the same message?
yep
And the solution is anti-spam bots in twitch chat. You try to say the exact same thing twice in a row and it will let you know your duplicate message won't go through and you need to wait X amount of time before posting the same message again.
@@airkami well in twitch its just identical messages not the same message (different massage id if you would create one)
@@MrJoeDone Depends on how they implement the bot. Since the bot will have a cache of the original messages, it could update the id of the message to be the same as the id of the old message thus making it effectively the same exact message as far as the system is concerned.
That sometimes happens on yt too
If I was an engineer working on a computer science problem with human lives on the line, I might still watch a series titled "the basics" because Tom Scott is worth watching.
Everyone can always learn something new. The secret is keeping your mind open to different ways of doing things.
@@maxximumb There's also the aspect of "That's a really good way of putting what I wasted an hour trying to explain to that one manager!"
ishmael
Exactly!
Because of this video I avoided a similar problem with uber eats, it said there was a problem ordering and I remembered this video, made sure to check my bank account. Sure enough while Uber said the order wasn't placed, the money was out of my account. 20 minutes later my order arrives, thanks Tom!
The CS solution I learned in my network analysis class:
1. "A" sends a messenger (MSG) to "B". It waits a specified amount of time. If it has not heard back an acknowledgement (MSG-ACK) from "B" within this time, it resends another messenger.
2. When "B" receives a MSG from "A", it sends back a MSG-ACK to "A". Every time that "B" receives another MSG from "A" or some specified amount of time passes, it will send that same MSG-ACK in response.
3. When "A" finally receives one of these MSG-ACKs from "B" , it will send back its own acknowledgement (ACK) to "B". Again, it will send back one of these ACKs for every MSG-ACK it receives, but NOT after some specified time period like it did previously.
4. Once "B" receives this ACK from "A", it knows it can stop sending MSG-ACKs, since an ACK from "A" means it has received B's MSG-ACK.
At this point, both A and B have authenticated the other's messages.
If I missed anything or was wrong about something let me know!
Question: How does A know that B has received its ACK. It seems you're relying on the absence of MSG-ACKs to signal that. But, the same absence of MSG-ACKs could be produced if:
* the ACK from A gets dropped, and
* every retransmitted MSG-ACK from B also gets dropped.
In that case, A will have sent its final ACK and decide to attack, but B will still be waiting for A's ACK and decide not to.
There's also the question of how long A should wait for retransmitted MSG-ACKs before comitting to an attack time. The goal is for A and B to come to a consensus about when to attack within a bounded amount of time. But in your approach, A might have to service MSG-ACKs indefinitely. You'd have to tell A to assume B received the ACK if it doesn't see MSG-ACKs for some time. It's possible that B was sending MSG-ACKs for that entire time, but none of them were getting through. In that case, A will decide to attack but B won't.
It's worth noting that the approach you describe is what's used by TCP when terminating a connection. Because of the Two Generals Problem, the last person to send an ACK can't be sure the ACK has gone through. So, we tell them to keep the connection open for some TIME_WAIT period - 120s by default. If they see a retransmission within that time, they resend their ACK and (I think) reset their timer. If the TIME_WAIT period expires and we haven't seen any retransmissions, we assume the network will never fail so badly as to deliver no retransmissions for that long, and we conclude that B has seen our ACK and we can terminate the connection.
Total War AI is so advanced it doesn’t need a two generals problem to just rush towards a castle without waiting for your half of the army.
Nobody would put a castle in a valley between two perfectly good hills, therefore the entire video is invalid.
Maybe the castle was on a hill but then the two generals order there army to pill up to hills on the two sides. ;)
That is not true. There were a bunch of castles in valleys.
For example one that comes to mind is Castle Eltz in Germany.
Maybe the castle should be on the hill, and the armies on two valleys. It'd eliminate the need to say 'don't use flags' too, since the armies wouldn't have line of sight.
@@mrnice4434 Actually, that would make more sense in two ways, as the hill would also create a (irl) barrier for transmitting messages
@@Jehty_ was about to say that, there are pros and cons to building a castle in a dip
"If you're in computer science and work on a problem which involves potential loss of life, I really hope you're not watching a series called The Basics."
Meanwhile, everyone at StackOverflow...
Not a lot to go wrong when all you have is a "Ctrl", C and a V Button to use :>
"Hey so I got this error, it says 'Segmentation fault (Core Dumped)'. You know what I did wrong?
Kaleb Bruwer oh that’s nothing, just turn ur computer off and on again and it should be fine.. computers just tired
what the hell is the basics
Unknow0059 One of his video series. This episode belongs to it.
My solution: Send the entire army as messengers and all attack together from 1 side
(I know that this only works in the 2 Generals Problem and not in the real world but I was still pleased to find a work-around)
Option C: Both sides just sit there and let the forces in the castle who are cut off from the outside sit and run out of supplies
The attacking sides would run out of supplies before the castle would.
Option D: smoke signals
@@goekhanbag seems unlikely if they can figure out how a supply wagon works
Well that was a strategy used during the Civil War in the USA; Check the Fort Sumter
@@chanclink2383 sieging has been a thing since forever
"That's how to solve the two generals problem", but that doesn't really solve it right? It just is a good way to deal with it.
Correct, it's just a way to work around it in practice.
bitcoin solves it.
@@hairyairey it already did tho
...otherwise known as a solution?
Only in that very specific orders repetition case :v
lesson learned: if you want to attack a castle, just cook for yourself
Just set up a protocol:
General A sends a messanger. If more than twice the time it takes a messanger to get to the other side and no messanger got back this means one of the messangers failed. So general A sends another one.
what if the messenger gets lots on the way back from general B? then general B received the message but general A didnt receive the confirmation. now general B might attack while general A is still sending another messenger
Moral of the story: If you want to be a programmer, learn to cook.
...wait.
"Would you like to pay again?"
Sounds like everything is working as intended to me.
Now special offering: All you can pay!
I almost ordered pizza multiple times recently when they said payment wasn't recieved, but I was too tired to care about reordering and gave up.
Imagine my surprise when it showed up an hour later, lmao
All I’m thinking is why the hell would you build a castle in a valley
"next time I'll just cook for myself"
Tom, we both know next time you'll order out again
As a computer science student, it's really cool to see Tom introducing problems like these to the general public!
This is one of the many things people learn in their network communication courses in undergrad! It's crazy how many seemingly simple problems there are with communicating in distributed systems
"A single human error is never the root cause"
Me: *observe*
Message 1: We attack at 8.
Message 2: Okay, 8 it is.
Message 3: Great. See you then.
Message 4: Great.
Don't both parties know what's up at this point? This is hurting my head.
what if message 4 doesnt arrive? that could mean message 3 didnt arrive to the other person and they would still be waiting, and they wont attack.
"I was tired and I was hungry, as are a lot of their drivers"
Jim Ross: Tom Scott Slam! Tom Scott Slam! GOOD GOD ALMIGHTY he's destroyed them! 21 seconds, TWENTY ONE SECONDS and its all over.
?
apple's lover It's a WWE reference. Jim Ross is a commentator and this is his legendary quote.
Much better qoute would be: "Wow, what'd you say after that one? Brutal, savage, rekt? Absolutley taken down..."
MUUUHHH GAWWD
idempotency: when you're able to have children, but just the one time.
Remember : killing your children is ok in IT.
Sounds like China needed this.
Twins have to fight for vaccination
I mean, for women it's kind of like that. No matter how many other soldiers you send, once she's preparing your order you'll have to wait for it to be delivered to order a new one.
@@satibel Me: child.kill();
processor: thats reasonable, let me do it for ya.
And that's how you do a sponsorship. Don't just be a talking billboard but actually do something with it. Great work (as always), Tom!
I don’t know what it is about this specific video of toms but I always find myself coming back to rewatch it
For once, this is a very helpful sponsorship. I thought it was concerning that all of someone's passwords are stored in one location, so thanks for clearing that up!
"next time I'll just cook for myself"
and ever since then, Tom Scott has cooked very meal he's eaten
One evening in late 2018, our neighbours came over and gave us free pizza saying they received more than they ordered, but we never knew why or what happened. Funny that this video seems to have solved that mystery haha
Damn, you've got some good neighbours
This is how you solve the two generals problem. You move your entire army to the other side, that way there will be no one left to not know whether the message came through. And then you just attack together.
The REAL problem is the general who built a castle in a valley…
I mean, you say that, but it seems to be working out for him so far
Since the messengers can not go around, the place where the castle stands is the only connection between the sides. That makes it a strategically important point.
@@schwarzerritter5724 But building a castle in a low point means besieging parties can set up siege engine on the hills and bombard with a height advantage. If the valley can project force in the surrounding area, the hill can do it better.
It is debatable, if the valley is really that important and the local garrison is big enough said fortress may be always able to hold out until reinforcements arrive
The real issue is linear pathing who decided the rules of point a to point b
If this was real internet with reverse dns you can go from point A to point C to point B cause a+b failed connection
do you want a new tom sc-
me: YES
I acknowledge I have seen your comment.
Joshua Stockin i acknowledge your acknowledgement of his reply of acknowledgement of the comment
So we're cloning Tom now? Cool! Do we have enough red shirts?
confirmed, loading new tom scat video
Mormon Freegan, i acknowledge your acknowledgement of the acknowledgement of his reply of acknowledgement of the comment.
After about the third acknowledgement I reckon the generals would know they were on the same page
If one starts to attack, wouldn't the other see this and attack too?
The Athiest Messiah, again, this is “magic computer science land”.
@@coltonbates629 And I think it would make more sense if the castle was on a hill so the army's couldn't see each other
I'm gonna be honest, as a military history nut, and someone who's convinced that computers are magic boxes, I completely missed the part at the beginning where you mentioned that this was a metaphor for computer related witchcraft, so I was just like, "send up a smoke signal or something when the message is received"
Me: no you can't have pizza for dinner.
7 year old Son:Why not?
Me: because you had pizza for lunch.
Son: why can't I have pizza for lunch and dinner.
Me: because of idempotency.
@Jay Arre You must be eating terrible pizza.
@@Clickum eating "good" pizza is what kills you, veggie pizza won't
but lunch != dinner, so idempotency has nothing to do with it ;-)
@@jlammetje not exactly, dinner can be lunch, but lunch is not necessarily dinner.
Everyone else: Goes to bed a reasonable time
Me: Stays up all night trying to solve the unsolvable general problem with 0 knowledge of computer science
Philip Melchert bitcoin solves it.
How hard could it possibly be? I mean I figured out which side to park my car to fill it with gas. Only took three tries.
I dunno, I don't think it's that hard, just have army A keep sending messengers until one of them returns
Sean Webb - same number of tries it takes me to plug in a USB cable
Like LABOUR and the Tories
Solution: Send the entire army as “messengers” combine with the blue, attack together.
You'd only be attacking from one side. Which in this metaphor would translate to the two computers being somehow physically conjoined and not connected to the internet at all.
@@dipperjc then just send the army back as “messengers” again. Atleast now you had communication with the other side. Ofcourse, this doesn’t really apply since it’s a computer science question as mentioned in the video. But yk just having some fun
@@DanksterPaws Suppose none in the army make it back?
Problem: No guarantee the messengers make the trip, remember.
army A could also send a messenger every "x" time interval until they get a reply
Reminds me of my Christmas shopping experience last year:
I ordered some gifts from a store that I hadn't ordered from in a while and didn't realize that the credit card still linked to that account has expired in the meantime. So I ordered and used the stored credit card info to pay and the website didn't notice either. It just displayed the usual "thanks for your order" page and I went on to different things.
A week later I wondered why I still haven't received the stuff and realized that I hadn't gotten an order confirmation per e-mail either. So I ordered again and the website got me through checkout again, saying everything's fine. This time I monitored my inbox and after two hours of nothing, checked my order history in my account, found no order and ordered again, but got no mail again.
It took two days of back and forth with the customer support for them to find out why my orders weren't processed. I wonder why they were confirmed on the website though... 🤔
I would imagine a check and prompt for a card expiration would be one of the must-have features in any webshop. Crazy to think that on this day and age someone didn't implement it.
"The root cause is that our processes aren't robust enough to prevent a person making this mistake" - a former colleague set this as a slack autoresponse any time any dare write the letters "RCA"
I like this
Why RCA specifically?
Root Cause Analysis, maybe, Idk
"Next time, I'll cook for myself"
**After 4 math tests in one week**
Me: Yes, I would like a pizza
Edit: Changed exams to tests
By ‘exams’ do you mean tests or exams?
Hey, for those interested in the physical background of this problem, the two generals problem is an anology related to the limitations of synchronizing two clocks (due to the speed of transfering information).
Since information can't travel (up to our best knowledge) faster than the speed of light (which means that there must be a finite value for it's speed so that there can't be instantaneous change of information) both clocks will always be differing by some amount of time. Very very tiny small difference of course (unless they are super spaced but that's not the case of the valley here). However, that tiny difference is enough to say the atack is not simultaneous as general A and B will advance with a slight time diference (like clock A and B that can't be synchronized).
That's a great way to look at the problem. But that means that the answer to this question is telephones. That large difference is a small one with our current technology.
But can’t you use that knowledge to ‘sync ahead’ the other clock so they are both equal? Like move Clock B so it appears 1 femtosecond ahead, but in reality is the same, just lagging.
"Next time I'll just cook for myself" - bit drastic! It's not that bad.
"A single human error is never the root cause"
This applies to almost everything.
@Aaron you missed the point. in that situation the root cause isn't the single influential person, its the system, which has been built up to allow such a thing by multiple errors compounding over time.
the point being that there is a difference between the *instigating event* and the *root cause*
Then again a rocket launched by NASA crashed due to a single error in coding.
6:11 “Next time I’ll just cook for myself”
I was REALLY a hoping that the sponsor for this video would’ve been Hello Fresh.
So in either case, the 5P rule applies: Prior Planning Prevents Poor Performance.
I learnt that the hard way while playing Factorio
That was about what I expected to be the solution - just send several messages if you don't get a reply and find a way for the server to identify duplicate requests.
I think it would be instructive to add that TCP/IP recognizes this problem and includes a packet ID. The two generals problem explanation increases my appreciation for TCP/IP. Thanks!
TCP, to be specific. TCP/IP is a protocol stack consisting of many different protocols
I'm surprised there is no mention about Byzantine Faults (a.k.a the Byzantine generals problem), and there are solutions that claim to be "Byzantine compliant" or "Byzantine fault tolerant", and this is a big thing in the cryptocurrency space right now.
Nakamoto consensus using proof of work for the win!
It's the same problem and still only solved by at-least-once delivery + idempotency.
*ERROR*
The operation completed successfully
ERROR:
"Uh.. nothing. Nevermind."
Error! AutoCAD has closed due to an unexpected situation!
Uh, I quit the program intentionally a couple seconds ago?
@@OrigamiMarie Google podcasts does something similar when I delete a podcast after I've finished listening but there's still a few seconds of audio left.
"ERROR: Keyboard not found, press F1 to continue" (actually a real error message!)
The operation failed successfully.
It's always striking to me how on one hand you seek to dispel memes, stereotypes, tropes, and misconceptions yet intersperse your videos with interjections of sociopolitical memes, stereotypes, tropes, and misconceptions.
"A single human error is never the root cause"
I would dare to disagree.
*o n o s e c o n d i n t e n s i f i e s*
The root problem in that situation was the company that allowed an inexperienced teenager to work on a live database without backups. Not one person.