Why Computers Can't Count Sometimes

  • 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 327

  • Tom Scott
    Tom Scott  3 months ago +2454

    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!

    • Aquire
      Aquire Day ago

      There's always a person who'll spoil thefun

    • ArumesYT
      ArumesYT Month 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 3 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 3 months ago

      0.50 s

    • plasmaburndeath
      plasmaburndeath 3 months ago +1

      Ty for explaining how this works for the trolls who always scream "this video is 40 minutes old why are there 1,000 likes for 35 minute video and only 200 views" so on

  • PX3UAden
    PX3UAden Day ago

    How do youtube live sub counters work then?

  • vanmaren962
    vanmaren962 4 days ago

    My discrete math courses are feeling useful all of the sudden

  • Dan Bardos
    Dan Bardos 7 days ago

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

  • Morgan Stasney
    Morgan Stasney 7 days 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 6 days ago

      Never had that problem at Staples. :)

  • Anonymous bub
    Anonymous bub 8 days ago +2

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

  • scratratadu
    scratratadu 11 days ago


  • Jason Dunne
    Jason Dunne 12 days 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 14 days 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 15 days ago +1

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

  • ui_wizard
    ui_wizard 15 days 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 18 days ago

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

    • Joe Casson
      Joe Casson 6 days ago +1

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

  • Myfree Red
    Myfree Red 21 day ago

    This is why quantum computing is so much better

  • Death By Snail
    Death By Snail 23 days 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 25 days ago

    1:35 The cake is a lie.

  • TetrisKid48
    TetrisKid48 29 days ago

    1,496,000 sub wooooo

  • Ian James
    Ian James Month 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 Month ago

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

  • 280alex
    280alex Month ago

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

  • Malou Lewin
    Malou Lewin Month ago

    social blade? live sub count?

  • Sean Sopata
    Sean Sopata Month 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 Month 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 Month ago


  • Awesome Aasim
    Awesome Aasim Month 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 Month ago

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

  • Maroki06
    Maroki06 Month ago

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

  • Rony McJony
    Rony McJony Month ago

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

  • Nitin Patel
    Nitin Patel Month ago

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

  • Gabe
    Gabe 2 months ago

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

    • Gabe
      Gabe 2 months ago

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

  • J A
    J A 2 months ago

    I was going to say, why deal with trying to update on multiple threads? Just send updates to a central server that will handle the updates in a queue.

  • Tarik Zakaria Benmerar
    Tarik Zakaria Benmerar 2 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 2 months ago

    I have newfound respect for servers

  • spyhunter99
    spyhunter99 2 months ago

    good old concurrency problems

  • Sara Graves
    Sara Graves 2 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 2 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 2 months ago

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

  • Bringidon
    Bringidon 2 months ago

    0:50 math?

  • GiggitySam Entz
    GiggitySam Entz 2 months ago +1

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

  • GiggitySam Entz
    GiggitySam Entz 2 months ago +1

    One take ? :O

  • GiggitySam Entz
    GiggitySam Entz 2 months ago +1

    Amazing video!!!

  • GiggitySam Entz
    GiggitySam Entz 2 months ago +2

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

  • dogbird
    dogbird 2 months ago

    mfw ryzen 2700x 16 threads

  • cutcc
    cutcc 2 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 2 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 King 1839
    Dino King 1839 2 months ago

    Still counts better than my older sister.

  • Bryon Lape
    Bryon Lape 2 months ago

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

  • What The?
    What The? 2 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 2 months ago

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

  • Martin Cattell
    Martin Cattell 2 months ago

    Looks like frogger in the background

  • Jacob Saunders
    Jacob Saunders 2 months ago

    i just came here to say 69

  • Dylan Kirdahy
    Dylan Kirdahy 2 months ago

    Really informative, thanks!

    ИWOЯⱭ 2 months ago

    this guy looks young and old at the same time

  • iamthinking2202 _
    iamthinking2202 _ 2 months ago

    Would this be why people use other sites like socialblade or some live subscriber count instead of simply just checking their channel homepage when they want to see if they hit 1M?

  • philthedirector
    philthedirector 2 months ago

    His mannerisms and voice remind me of nick clegg!

  • Haywire TV Digital
    Haywire TV Digital 2 months ago

    Toms an absolute pro at hand gestures

  • myungskywalker
    myungskywalker 2 months ago

    Please do some shoulder exercises and get a buzz cut. Love ur videos.

  • Victoria
    Victoria 2 months ago

    This is really interesting. I've always wondered why the view count would be stuck for awhile on certain videos.

  • mad cobra
    mad cobra 2 months ago

    3:56 race condition shouldnt happen because programmers force the computer to be single threaded when it comes to reaching the same data at the same time. but i dont know which parts of youtube have forced single threading or not.
    You dont have to put the user on queue to make this. You can let user watch the video and start a new thread that waits to add one to the view count.

  • eɪtʃ mīndər
    eɪtʃ mīndər 2 months ago

    what should that be ? a part of some kind of "truth" ?! we all know that all plattforms arent political independend. all internet platforms are controlled to hide the truth for the success of a small group of oligarchs. all you told might be correct, but at the end of the day it is not possible to have less likes than in the beginning of it !!!

  • Joshua Sweetvale
    Joshua Sweetvale 2 months ago

    That's a DUMB use of multithreading.

  • Twinrehz
    Twinrehz 2 months ago

    Hehey, I have a Texas Ti 99/4A too! In working order, no less.

  • Reza Karami
    Reza Karami 2 months ago


  • Moore Time in the Kitchen

    Yesterday, on my main channel page my subscriber count was showing as 925. In reality it was 66. Still not entirely sure how it ended up that wrong even after watching this very well put together explanation.

  • Raine Riny 7
    Raine Riny 7 2 months ago

    Sometimes I have noticed the number of likes exceed the number of views in TVclip.

  • Jesse Okeya
    Jesse Okeya 2 months ago

    Tom Scott for president!

  • Mnoppee e
    Mnoppee e 2 months ago

    I'm just gonna say it's amazing how this was done without cuts

  • 2Tri
    2Tri 2 months ago +1

    0:00-0:03 What?
    0:04 Then wouldn’t every tweet be brilliant?

  • Coco_EC
    Coco_EC 2 months ago

    Well explained! Thanks!

  • Drew Puffer
    Drew Puffer 2 months ago

    Is this why it takes 10 business days to unsubscribe from spam email?

  • Tularis
    Tularis 2 months ago

    I love it when Tom explains something. I makes it sooo easy to understand! ❤️

  • SuperBlueBomb
    SuperBlueBomb 2 months ago

    Now I have found out why on very new videos by popular channels have more comments than views

  • Matthew Eargle - AirborneSurfer

    Single-thread computing: Bake a cake.
    Eventual consistency: The cake is a lie. Or it isn't. Maybe.

  • WeShall4ttack
    WeShall4ttack 2 months ago

    Is that the logo of National Geographic behind you? :P

  • Brian White
    Brian White 3 months ago

    The absolute nerve of you to make me slightly less ignorant. How DARE you, good sir! /s

  • Matt Douglas
    Matt Douglas 3 months ago

    Thank you for this!
    Because of the whole Diablo mobile TVclip dislike thing that went on this is both very relevant and explains a lot to people who jumped on the angry bandwagon that assumed there were some dodgy dealings going on with TVclip

  • Chris Musix
    Chris Musix 3 months ago

    I've been staring at that initial tweet for a week trying to figure out why exactly it's brilliant.

  • Dazzling Sky
    Dazzling Sky 3 months ago


  • Leonard Wong
    Leonard Wong 3 months ago

    i always unlike if i liked something by mistake

  • Ivan Vučica
    Ivan Vučica 3 months ago

    You're doing the FSM's work here.

  • Yung Kirk
    Yung Kirk 3 months ago

    var VIEWCOUNT = 0;
    if (VIDEO_WATCHED == true){

  • Ba A
    Ba A 3 months ago


  • Marco Bertoglio
    Marco Bertoglio 3 months ago

    Old guy says... You help me to understand, and that is a great gift. Thank you!

  • d610
    d610 3 months ago


  • Joseph Louwerse
    Joseph Louwerse 3 months ago

    So this is why t-series got 9000 subs in one second

  • Social Blade
    Social Blade 3 months ago

    Great video! We get people asking about this topic all the time!

  • nikoli gogle
    nikoli gogle 3 months ago

    People used to do these manually in past days. WOW! 😱

  • Adam Ricks
    Adam Ricks 3 months ago

    Is this guy 18 or 45?

  • ganymede Jupiter
    ganymede Jupiter 3 months ago

    Nice timing ,I was just reading os processes and scheduling..

  • ganymede Jupiter
    ganymede Jupiter 3 months ago

    Great vid

  • Mark Penrice
    Mark Penrice 3 months ago

    Threading weirds arithmetic?
    Also I wonder if this explains the difficulty EDF had with sending me a correct bill, even though it only took me a couple of minutes to work out the correct amount by hand (and an hour to call them up, wait on hold, then get them to remedy the incorrect figures) each time...

  • Ryan Morris
    Ryan Morris 3 months ago

    I just want to complement you, Tom, on your narration. I've noticed the One-take approach before on your videos, but this one was impressive. It can't be easy to keep your inflection and pacing interesting for such a long take, let alone doing it in such a conversational tone.

  • kmccravy
    kmccravy 3 months ago

    Thanks for coming to ThinkerCon!

  • Walter Burton
    Walter Burton 3 months ago

    I ❤ TI-99/4A

  • Dan Dart
    Dan Dart 3 months ago


  • Dan Dart
    Dan Dart 3 months ago

    I created the infrastructure from the ground up on two high traffic, big data systems, and this is similar to how I used to do things, however I just stuck to the caches, and had a couple of replicated queues that hit one replicated database at some point. In this case, it was the database doing the queueing up of the big bundles, and the read-only database clones that were being asked for bundles of data to be calculated. Still an amazing subject to cover, and you make it really simple to understand!

  • Emmo Hernández
    Emmo Hernández 3 months ago

    This reminded me of so many things I learnt on my Operating Systems lectures so long ago.

  • ҉
    ҉ 3 months ago

    I wish everyone saying "lmao 15 likes 0 views youtube is high 😂😂😂" saw this video

  • FlyTech Videos
    FlyTech Videos 3 months ago

    Knock knock, race condition, who's there?

  • theSPUDereHD
    theSPUDereHD 3 months ago

    You said "math" ... not "maths" ... I'm disappointed