Why Computers Can't Count Sometimes
Why Computers Cant Count Sometimes

Follow by Email
Sometimes, numbers on sites like YouTube 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: http://www.computinghistory.org.uk/ I'm at http://tomscott.com on Twitter at http://twitter.com/tomscott on Facebook at http://facebook.com/tomscott and on Instagram as tomscottgo


Matt Snyder : FIRST!! I actually was. My local server just held onto my comment for a while.

Lindsay Daly : *Tom Scott* *Tom Scott Returns* *Tom Scott Forever* *Tom Scott and Robin* *Tom Scott Begins* *The Dark Programmer* *The Dark Programmer Rises* *Tom Scott vs. VSauce: Dawn of Knowledge*

Tommy Callaway : A programmer is going to the grocery store and his wife tells him, "Buy a gallon of milk, and if there are eggs, buy a dozen." So the programmer goes, buys everything, and drives back to his house. Upon arrival, his wife angrily asks him, "Why did you get 12 gallons of milk?" The programmer says, "There were eggs!"

Abbreviated Reviews : "Eventual Consistency" is the method I use for getting enough sleep. I'm sure it'll get there one day.

T : Q. Why did the multithreaded chicken cross the street? A. To the get other to side

Fergus Griggs : Good ol' 301 views.

Thurston Cyclist : This would be an ironic video in which to wonder why there are more likes than views.

Potato K : *_Overgrown calculators_*

Skills With Phil : I've learned so many random things thanks to this channel. These are types of the channels that deserve a YouTube Premium show.

Squiggs 【Glitches - ROM Hacks - Speedruns】 : Your editing is so on-point in these videos... it really helps to make what you're talking about easier to understand.

iRacecraft : Right, did TOM SCOTT just say "Math" ?? National Treasure status revoked.

T33K3SS3LCH3N : That is a great explanation, but there is one more thing at work! Many large social media sites deliberately send out slightly randomised numbers to make it impossible for clients to see if their views and votes are counted. This is to enable so-called Shadowbanning, where an account's comments and votes are no longer counted, but the user is not supposed to find out. With this method they can ban vote bot accounts without the owner noticing it (which would simply cause them to delete and replace the bot) thereby reducing the viability of vote manipulation. On some platforms it is even used to deal with generally toxic users.

Charky : Finally, something we can link on those "omg more likes than views" comments! I could've sworn there was already a video covering that, but I've never managed to find it.

Fabian Huber : What counts as a youtube view? Watching 100% of the video? What if I skip 10 seconds? 🤔 What if I have the video on loop over night, does the Youtuber get all my views for his revenue?

ano1nymus1 : There's also vote fuzzing, which intentionally give as an inaccurate number to discourage manipulation by making it harder to tell whether it actually works or not.

Deryck Chan : There were 48 views and 21 comments when I started watching this (3min after the video was posted). A few minutes later I refreshed the page; there were 24 comments and there were 179 likes but the number of views stayed stuck at 48 views - fewer views than likes due to sync lag - nice illustration of your point.

BlackBear345 : This is perfect timing because I have been binge watching your videos!!

J.J. Shank : There are some systems that get _easier_ with scaling, not harder. For example, the behavior of a crowd is easier to predict than the behavior of an individual. The ideal gas law is awesomely simple and effective, but only works when you lump together a trillion trillion particles. Larger ecosystems are more resilient and self-sufficient than smaller ones. And so on. Fun fact of the day.

El Queso : When I worked for Big Software, one of our products had a notoriously inaccurate progress bar. Our lead programmer explained why making the progress bar more accurate was a "bottom of the list" priority item: "The task that the computer is showing the progress bar takes up about 98% of the computer's processing power, with about half of what's left (1% of the total processing power) going to figuring out progress and animating the progress bar. If we want to make that progress bar more accurate, we have to take processor time away from the task (which is supposed to be most important,) to give it to the progress bar animation. This will make the actual task take longer, in a logarithmic curve to where the task will take forever and the progress bar will show an infinite amount of time remaining, if we let it."

Vespirit : *B I G D A T A*

Chain Leigh : 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.

The Killer Spud : This seems to be the way reporting on an election in the U.S. works.

Anton Timeboy : Did you have to adjust the camera to the screens in the background? Or did it just work

Jared McCray : This is actually legit interesting to me. As soon as you started to explain each part it made perfect sense, but I've never really thought about it.

LapisSea : It's not the counting that is the hard part. It's the communication that is hard

Kadderin : Cassandra Database Engineer checking in, this was a wonderful explanation!!

Timothy McLean : I think it's fair to say that counting accurately, _quickly,_ is the difficult part. If numbers are flooding in faster than your counter can count, which is certainly possible with how big the Internet can make things, you're gonna have a bad time (or some clever engineering).

SilentDreamcast : when the client gives 2 requirements: host 4K videos quickly and have a view counter. Dev team says: okay we can implement the video stream in a week but the counter will take us 3 months. This kind of "hard thing is easy and easy thing is hard" happens so much in development.

DynamicWorlds : Want to try explaining why US voting machines seem to be unable to count? They keep claiming it's just a software error where huge numbers of votes can be lost from a single machine with a single user at a time and that sounds like BS to me.

GoldenKnight175 : Thank god, I was looking for something good to watch then you uploaded. Saved me from watching some boring video on YouTube

Gosforth Handyman : Aww... CPC464... getting all nostalgic there! 😢 My second computer after a Tandy TRS80. Because of this I'm now a woodworker.

Anonymous bub : When Youtube says there are only 8 views but 762 likes

Vyker : OMG, you said "math".... honour your British heritage... in old blightly we say "maths"...

KarolaTea : Machining systems also usually single--threaded. If there's more than one processor they'll use a master-slave system (the master requesting/sending information to each slave along the same single thread) or if there's more than one master via token-passing, each master being assinged a set time to send & recieve. That way you can ensure you got the numbers right, and your robot arm isn't still in the machine when it starts grinding. Thanks for the video, really great to hear an example of how counting can get messed up :D

TheOyvind99 : Not everyday I watch a video the second it goes up

ui_wizard : 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.

Minvox : 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..

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

SirBanana : i guess i'm a computer

dodeca hedron : 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 :-)

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

Isaac Aren : 3:42 Ad Revenue? It's not 2016 :PP

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

Panossa : Developer: "Is 1+2 = 3?" JavaScript: Nope.

Read more : This is a really good video! I haven't got much else to say

Metalstorm : They may also be using algorithms like 'HyperLogLog' for the 'count-distinct problem', remember they also need to know who liked the view or tweet so the same person can't just keep liking it.

Rena Kunisaki : tl;dr sometimes you get stale information because keeping everyone fully up to date is infeasible.

Batuhan : "Computers are overgrown calculators" That analogy

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