Why Computers Can't Count Sometimes

Share
Embed
  • Published on Nov 12, 2018
  • Sometimes, numbers on sites like TVclip and Twitter jump up and down; subscriber counts lag, like-counts bounce all over the place. Why is it so hard for computers to count? To answer that, we need to talk about threading, eventual consistency, and caching.
    Thanks to my proofreading team, and to Tomek on camera!
    The Cambridge Centre for Computing History: www.computinghistory.org.uk/
    I'm at tomscott.com
    on Twitter at twitter.com/tomscott
    on Facebook at facebook.com/tomscott
    and on Instagram as tomscottgo

Comments • 1 389

  • Tom Scott
    Tom Scott  6 months ago +2621

    This was a really difficult script to write! Folks who know 'eventual consistency' as a more formal term may be annoyed that I'm using it a bit loosely here. Hopefully this works as an explainer for folks who are new to it, though!

    • Itz Hyde
      Itz Hyde Month ago

      Really well explained, thanks Tom :)

    • Aquire
      Aquire 3 months ago

      There's always a person who'll spoil thefun

    • ArumesYT
      ArumesYT 4 months ago

      Certainly worked for me. Too bad you don't work with Computerphile anymore. I still like your computer related videos, but there's too much other (for me uninteresting) content on your own channel for me to subscribe.

    • Erkin Alp Güney
      Erkin Alp Güney 6 months ago +1

      @Tom Scott you will also need to wait for the queue to clear to be able to upload a new video.

    • TheFcukinBest
      TheFcukinBest 6 months ago

      0.50 s

  • Hirobot
    Hirobot 9 hours ago

    but im not a computer... 🤔

  • arxaaron
    arxaaron 17 hours ago

    Where was this recorded? LOVE all the functioning antique computers!

  • Chain Leigh
    Chain Leigh 4 days ago

    You'd better to revise the title to "Windows 10 Can't Count Sometimes."
    This is a true story that Windows 10 destroyed my external hard drives.
    I paid my price to learn not to switch to new Windows too fast.
    Microsoft should slow down the step to release a new update until it is stable and reliable.

  • Taylor John
    Taylor John 7 days ago

    This now applies to that charles dudes sub count

  • Leonie
    Leonie 16 days ago

    There is also *sharding* of counter fields, when scaling but not scaling that huge.
    Helps with the much faster read than write speed.

  • Mubashir AR
    Mubashir AR 17 days ago

    I wish you were my college professor

  • Palte
    Palte 23 days ago

    Thanks, I finally understand what race condition means! Nice work and Editing; your videos are really easy to understand that way!

  • dodeca hedron
    dodeca hedron 25 days ago +1

    Having worked with databases and nosql databases as well as having written some parallel code, I thought this video would be rather crap
    To my surprise, it's actually well done and while you might want to spilt hairs over some of the initial points around eventual consistency, I think those points were done in such a way so as to keep the detail at a level where others who do not have such technical depth can understand things. Perhaps a little more explanation on acid compliance of traditional databases and using the typical bank account updating might have helped differentiate eventual compliance from stuck transactional sequencing using a queuet?
    This video gets a Hat Tip from me :-)

  • Edgars Lacis-S
    Edgars Lacis-S 25 days ago

    you gotta *acount* that computers are just machines!

  • CheesyQuokka YT
    CheesyQuokka YT 26 days ago

    67
    68
    69

  • Sergey Piterman
    Sergey Piterman 26 days ago

    Love these videos

  • Christopher Hales
    Christopher Hales Month ago

    No it 69

  • Anonymous bub
    Anonymous bub Month ago +2

    When TVclip says there are only 8 views but 762 likes

  • Stuff We Play
    Stuff We Play Month ago

    Science is a liar sometimes

  • Jack Neeleman
    Jack Neeleman Month ago +1

    I've had this problem before with only two computers writing requests!

  • Jimmy Siwik
    Jimmy Siwik Month ago

    Minor correction. TVclip is a database of videos, verbal abuse, and verbal excrement. Mostly the last two
    Edit: TVclip also doesn't need to calculate Ad Revenue

  • ひカゲMika
    ひカゲMika Month ago

    Who else is here because of blackpinks vi3ws cut?

  • Subhojit Dey
    Subhojit Dey Month ago

    The complain is why don't they add more cache servers to turn that eventual consistency to instantaneous consistency?

  • Beedy KH
    Beedy KH Month ago

    Other quistions: Why games loading bar, and programs installing bar doesn't move smoothly? Why it stops at some points then jump big distance to another point to stop there again?
    I NEED TO KNOW!

  • Ken MacDonald
    Ken MacDonald Month ago

    Twitter and youtube also delete dislikes and add likes to videos management likes and does the opposite for videos management doesn't like.

  • Bradley Caylor
    Bradley Caylor Month ago

    This channel is my favorite ever. I just found it a couple weeks ago and have been watching 10 videos a day, while I work and exercise. It’s very interesting and oddly calming

  • Gav H
    Gav H Month ago

    Do you use an auto-queue? If not, what a memory!

  • Erik Hendrych
    Erik Hendrych Month ago

    "Computers are just overgrown calculators" ... Thanks bro, my computer is offended. I have to write this on my phone.

  • Michael E
    Michael E Month ago

    Really neat info! Subscribed for sure!

  • Paul Noonan
    Paul Noonan Month ago

    If possible, they could check if it's been updated since then if it takes longer than expected to avoid backtracking. As an example, the view count on a video.

  • Charlie Jonas
    Charlie Jonas Month ago

    It's a good example for illustration purposes, but it's likely that the view count is actually a "derived" or calculated value (not persistently stored but cached). Instead a "Video View" record is created in the database so they can store related analytics like User, IP address, Browser, etc.

    • Charlie Jonas
      Charlie Jonas Month ago

      TVclip probably has a separate process runs (probably based on a Set queue where video Id's get added when new views occur) to sum the "Video View" table. In this way they can avoid the complexity you discuss above and reduce load on their database by minimizing the required number of reads (since they are decoupled from the writes). This is supported by the fact the view count on youtube only update incrementally.
      Set it, Forget it, use it later

  • Kinda Something
    Kinda Something Month ago

    We've all used a calculator to do 3+5 (or something like that)

  • Legomonster33
    Legomonster33 Month ago

    when I saw this video it had 699969 views omg.

  • 周韩
    周韩 Month ago

    This is why some modern systems(e.g. Taobao/Tmall from China) use blockchain related method to keep consistence.

  • Daniel Maletic
    Daniel Maletic 2 months ago

    That means the computer tehnology is quite bad, extremly slow for ammount of peoples online. And that's quite sad. Or this made me thinking, the peoples are not quite smart enought to count. If processor can count billion numbers every second than peoples who make computer work like that are not clever enough, because they shuld count 100 bilion numbers every second, and there is not enought peoples in the world to slow down computer. So basicly we made terrible computers who need to make 100 bilion calculation to add 1 number to the database.

  • cgwworldministries
    cgwworldministries 2 months ago

    This explains the human brain, why some people are super smart and others not so much.

  • mdh6977
    mdh6977 2 months ago

    Can someone tell me if he's 15 or 40... thx

  • Rodríguez
    Rodríguez 2 months ago

    Nice vid, i didnt know that

  • Mark Hollas
    Mark Hollas 2 months ago

    new favorite paradigm "Eventual Consistency"

  • Frankjc3rd
    Frankjc3rd 2 months ago

    Overgrown pocket calculators with delusions of grandeur.

  • Lucas G
    Lucas G 2 months ago

    Absolutely brilliant! Well made, well done!

  • Thaddeus Melchior
    Thaddeus Melchior 2 months ago

    What would cause post 2010 technology to take SEVEN+ YEARS to catch up? 🤔

  • Santosh P.S.S.
    Santosh P.S.S. 2 months ago

    Well, this video... IS AWESOME! I am really surprised and amazed at Tom Scott’s performance! Really learned a lot!

  • Hans Hoerdemann
    Hans Hoerdemann 2 months ago

    ???

  • Bobofro
    Bobofro 2 months ago

    Ohh thank you! Now I know why it sometimes says that there are more likes than comments! :)

  • FishStix
    FishStix 2 months ago

    Interesting

  • Kill Kardashian
    Kill Kardashian 2 months ago

    Tom i love you and think you're great but i swear down if you say 'Math' instead of 'maths' again i will have to kill you

  • Imtiz Hawk
    Imtiz Hawk 2 months ago

    Nice video! :)

  • A random Lizard
    A random Lizard 2 months ago

    This explains t-series's ten minute win

  • Viktor Åsbrink
    Viktor Åsbrink 2 months ago

    What is the point of the hand gesture at 0:46???

  • hblaub
    hblaub 2 months ago

    So, 'counting at scale' is hard

  • EyeDentify
    EyeDentify 2 months ago

    Love when you talk about computer Stuff Tom :) your making it fun and interesting with a bit of humor in the mix. Keep it going.

  • Booyamakashi
    Booyamakashi 2 months ago

    Im actually surprised that you know what you are talking about when it comes to that stuff. :)

  • PX3UAden
    PX3UAden 3 months ago

    How do youtube live sub counters work then?

  • vanmaren962
    vanmaren962 3 months ago

    My discrete math courses are feeling useful all of the sudden

  • Dan Bardos
    Dan Bardos 3 months ago

    Twitter is going to make the views on this video blow up.
    Edit: And then drop right back down.

  • Morgan Stasney
    Morgan Stasney 3 months ago

    This still doesn't explain why the machines at staples take a full minute to calculate the cost of printing 5 pages at 11 cents each.

    • Joe Casson
      Joe Casson 3 months ago

      Never had that problem at Staples. :)

  • Anonymous bub
    Anonymous bub 3 months ago +2

    Sometimes when I go onto a new video and it has like 102 likes but no views.

  • scratadu
    scratadu 3 months ago

    69

  • Jason Dunne
    Jason Dunne 3 months ago

    So it basically sends each view to an available computer cache, which will eventually send its data to the main view count, after it makes sure no other computers are sending that data simultaneously? Do the individual computers count views one at a time?

  • Minvox
    Minvox 3 months ago +1

    I've seen your videos but haven't seen this new series... You have a unique way of thoroughly explaining things and this "new" coding/compsci based topics are exciting..

  • ROBO karizma
    ROBO karizma 3 months ago +1

    Statement 1(P): The next statement is true.
    Statement 2(Q): The previous statement is false.

  • ui_wizard
    ui_wizard 3 months ago +1

    Multi-threaded environments (or processes) will often use mutual exclusion (mutex) to deal with race conditions, where multiple processes would access the same resource (like some state or value) at the same time. It does this by "locking"-or acquiring the mutex of-the resource and other processes will be blocked from doing the same until the mutex has been returned.
    There are different kinds of mutex that determine the rules of how they are acquired and returned.
    In large scale environments, like most large/medium scale services on the web, where state and values changes all the time, a mutex would be not be a great choice because it would be really slow.

  • TheMightyKinkle
    TheMightyKinkle 3 months ago

    The noise of those old CRT's must have been deafening. Ahahaha

    • TheMightyKinkle
      TheMightyKinkle 2 months ago

      +Joe Casson All CRT's make a high pitched noise. Tom even made a video about it in this very room

    • Joe Casson
      Joe Casson 3 months ago +1

      What Noise? You must have been around some really defective CRTs to think that.

  • Myfree Red
    Myfree Red 3 months ago

    This is why quantum computing is so much better

  • Death By Snail
    Death By Snail 3 months ago

    From what i see the computers are as follows;
    TI-99, SINCLAIR ZX81, Commodore 64, chair blocks view,blurry atari 800?,apple II se?,Commodore PET.

  • Robert Poutine
    Robert Poutine 3 months ago

    1:35 The cake is a lie.

  • TetrisKid48
    TetrisKid48 3 months ago

    1,496,000 sub wooooo

  • Ian James
    Ian James 4 months ago

    Now everyone go look at the comments on the Gilette video and see why this video is important; people have no idea that view counts can drop and increase and they're making conspiracies about it.

  • Edgar Renje
    Edgar Renje 4 months ago

    Is this the reason, why "likes" on e.g. Twitter sometimes don't stick?

  • 280alex
    280alex 4 months ago

    Anyway I'll keep constantly updating the egg-likes count.

  • Malou Lewin
    Malou Lewin 4 months ago

    social blade? live sub count?

  • Sean Sopata
    Sean Sopata 4 months ago

    Because of replication. There's nothing complicated about it. If TVclip or twitter had one server, this wouldn't happen. But they have farms around the globe, and replication isn't instant

  • I know you're right, but

    3-3:50 I understand it more like problem with dirty write into the database. It is not the app's fault isn't it?

  • Getaimed NotiC
    Getaimed NotiC 4 months ago

    UPDATE `TVclipVideo` SET `views` = `views+1` WHERE `watch_id` = `RY_2gElt3SA`
    Simple enough to "make" but they can still collide by ticks. Perfectly explained. Subscribing!

  • Bob Saget
    Bob Saget 4 months ago

    Interesting

  • Awesome Aasim
    Awesome Aasim 4 months ago

    If only TVclip took the number, add one, then subtracted one to check that the number is the same as the current view count...

  • Balázs Szeidl
    Balázs Szeidl 4 months ago

    "that is a mess we really don't want to get into..... _right now_"

  • Maroki06
    Maroki06 4 months ago

    oh ok that explains a lot
    im waiting for the next ⏩

  • Kevin Siebert
    Kevin Siebert 4 months ago

    Ok fine, I'll watch it youtube
    Just take it off my recommended after

  • Nitin Patel
    Nitin Patel 4 months ago

    4:15 was watching on full screen.. got scared if something happened to my computer!

  • Gabe
    Gabe 4 months ago

    This all could be prevented sometimes with asynchronous task solving... Like you said at 4:04

    • Gabe
      Gabe 4 months ago

      actually, 404 is quite a bad number when you're a web developer...

  • Tarik Zakaria Benmerar
    Tarik Zakaria Benmerar 5 months ago

    The queues and evantual consistency are not the solution for all issues. For a small app, just use relational database locking. That's basically the case I came across in my experience.

  • Ashwini Kulkarni
    Ashwini Kulkarni 5 months ago

    I have newfound respect for servers

  • spyhunter99
    spyhunter99 5 months ago

    good old concurrency problems

  • Sara Graves
    Sara Graves 5 months ago

    I've been watching Tom Scott for years and only just realised the red t-shirt is "his thing".

  • Parth Parekh
    Parth Parekh 5 months ago

    Hi tom. I was really hoping this might also include how computers cant really absolutely correctly figure out and handle and count numbers with fractions or decimals. I know this is some what different, but i do know for sure that this surely something computers aren't perfect at. That's because i do know of a problem that can be caused in major computer systems because of this very issue.

  • doodskie999
    doodskie999 5 months ago

    How can someone look like a 35 year old and 16 year old at the same time?

  • Bringidon
    Bringidon 5 months ago

    0:50 math?

  • GiggitySam Entz
    GiggitySam Entz 5 months ago +1

    I'm going through your video and mimicking the body language to learn XD

  • GiggitySam Entz
    GiggitySam Entz 5 months ago +1

    One take ? :O

  • GiggitySam Entz
    GiggitySam Entz 5 months ago +1

    Amazing video!!!

  • GiggitySam Entz
    GiggitySam Entz 5 months ago +2

    4:49 Am I the only one to have heard "But for science dealing with Big Data" ? XD

  • North East Tech
    North East Tech 5 months ago

    mfw ryzen 2700x 16 threads

  • cutcc
    cutcc 5 months ago

    For some reason I'm reminded of that scene in Bruce Almighty where Bruce was overwhelmed by all the prayers happening simultaneously =p.

  • JamesCiastko
    JamesCiastko 5 months ago

    Right now my computer says that 8*10^2=800 and thats true, but when i want to add it to variable which equals to 0 it suddenly says it's 799 .-.

  • Dino 1839
    Dino 1839 5 months ago

    Still counts better than my older sister.

  • Bryon Lape
    Bryon Lape 5 months ago

    Who is paying more attention to the 80's computers behind him than to the monologue?

  • What The?
    What The? 5 months ago

    Thanks for this video, used it to explain a K Pop fan that TVclip didn't take away BTS's views on purpose

  • Jimmy Tremblay
    Jimmy Tremblay 5 months ago

    "Computers are basically just overgrown calculators"
    -Tom Scott, 2018

  • Martin Cattell
    Martin Cattell 5 months ago

    Looks like frogger in the background

  • Jacob Saunders
    Jacob Saunders 5 months ago

    i just came here to say 69

  • Dylan Kirdahy
    Dylan Kirdahy 5 months ago

    Really informative, thanks!

  • ИWOЯⱭ
    ИWOЯⱭ 5 months ago

    this guy looks young and old at the same time