maxresdefault

How Did Psy’s Gangnam Style Break YouTube?

Earlier this week it was reported that everyone’s favorite Korean pop hit, “Gangnam Style”, had accumulated 2.1 billion views and broke its YouTube view counter.  Me being a software developer, I knew exactly what would have happened to do it.  Let’s explain what’s so special about that 2.1 billion number.

Computers Don’t Count Like Humans

Computers are brilliant, unfathomably-fast machines that can beat chess grandmasters and solve DNA puzzles that have plagued scientists for years — but they do not count like we do.  Instead, they use a counting system called binary.  Binary numbers are represented by a series of only two different digits: 0 and 1.  Contrast this with how we count which is using ten different digits: 0 through 9.  We call this counting system decimal and it’s hard not to believe that it has something to do with the fact that we human beings have 10 fingers. (Some carpenters excepted.)

So, why do computers count in binary? Well, I already answered it, unleeeeeess…you know a computer that has hands?!   Computers don’t have hands.  What they do have is a power cord that plugs into a power outlet.  And that power comes in one of two forms.  It’s on, or it’s off!  That’s why computers count in binary, because they map power-on to 1 and power-off to 0.  Don’t worry, your computer is always plugged in, it simply manipulates these signals internally.

Let’s take a look at it.  Here’s how binary looks counting from 1 to 10:

  1. 00000000000000000000000000000001
  2. 00000000000000000000000000000010
  3. 00000000000000000000000000000011
  4. 00000000000000000000000000000100
  5. 00000000000000000000000000000101
  6. 00000000000000000000000000000110
  7. 00000000000000000000000000000111
  8. 00000000000000000000000000001000
  9. 00000000000000000000000000001001
  10. 00000000000000000000000000001010

Whoa!  What are all those 0’s for?  Ignore them for now, but pay attention to the right side of these numbers where you see a few smatterings of 1.  The last digit, just like with decimal, means 1 if it’s 1 and 0 if it’s 0.  That’s just like human counting, but the second-to-last number means 2 if it’s 1.  It means 10 for us!  The next number over represents 4 and, after that, 8.  If you count up the 1’s of each number you’ll see how we’re counting from 1 to 10 in binary.

Now, let’s get back to all those 0’s.  Those 0’s don’t add to the number in any way.  While we don’t prepend our decimal numbers with 0’s, if we did then you could see that the number would remain the same. 023 is 23 which is also 00000023.  We simply don’t use them.  Computers do.  And if you count them up, each one of these numbers has 32 digits in them.

These 32 digits, or binary digits, or bits, might be somewhat familiar sounding to you.  Most computers today are 32-bit machines. (We’ve been seeing a steady migration to 64-bit for many years, actually).  Remember the “Bit Wars” of the 90’s between NintendoSega and Atari?  The Sega Genesis went 16-bit.  The Atari Jaguar then went 64-bit!  It got kind of crazy, but we’re talking about the same thing here that we did then.  Computers these days, by default, store integers as 32-bit numbers.

I Get Your Binary; Now How Did YouTube Break?

Alright, computers store numbers as 32-bit integers internally.  What does this have to do with Psy and that song I’ve been humming in my head non-stop while writing all this?  Well, it comes down to what is the maximum number you can express in 32-bits?  That number is 4,294,967,296!  That’s over 4 billion!  Certainly way more than 2.1 billion…what gives?  Well, in addition to positive numbers (greater than 0) we also need to express negative numbers (less than 0), too.  Computers commonly do this by using the first bit as a signal. (It’s not as simple as just flipping the bit, but I’m not going to explain two’s compliments to you right now.) Taking this bit out of the equation (ha!), you cut the maximum number you can express in half.  And that number is:

2,147,483,648

And then…crunch.  I don’t know exactly what happened or what may have appeared on the YouTube page, and it does sound like Google pulled a little prank on us, but I still wanted to explain the significance of the number because these problems have been appearing in computer programs for years!  The result of increasing a number passed the maximum is either a rollover (back to -2,147,483,647), a 0, an error, an exception state, or the app might even just crash, too.  It all depends on how the programming was done.

And now you know why watching “Gangnam Style” broke YouTube.

Follow us on Twitter @JinjaBobot or Find Us on Facebook to get updates on new articles, contests, collectors’ finds and more!

About John Blanco

John Blanco is an avid game collector and loves to write about his hobby as much as he participates in it. He run the Denver Retro Gamers Facebook group in Denver, Colorado, and coordinates swap-style meetups with dozens of other collectors every couple of months.

Leave a Reply

Your email address will not be published. Required fields are marked *