We all know that PSY’s Gangnam style is the most watched video on our planet earth, breaking all kinds of records of its kind. But what happened that led YouTube think over their programming?
We all have danced a lot with this epic song from the South Korean sensation PSY, and we can predict the viral effect of the song as it is the most watched video on YouTube till date. PSY smashed Justine Beiber’s record for having the highest views, but he also broke on more thing, the YouTube itself. YouTube could count upto 2,147,483,647 and then it stopped, but why? What happened that led to this? All are related to math and computer programming. Though there are some tweaks and PSY can be safe until the number crosses nine Quintilian views, precisely 9,223,372,036,854,775,808 views.
The answer involves zooming in to the very building blocks of computing. All numbers in digital computers, whether stored in silicon memory chips or on rapidly rotating magnetically charged hard-disk platters, are represented in binary digits, or bits. In base ten, numbers are represented using ten digits (zero to nine); in binary, or base two, they are represented using two digits (zero and one). For example, in base ten, the digits of a three-digit number correspond to hundreds, tens and units, and the largest number that can be represented is 999; in binary, the digits of a three-digit number correspond to fours, twos and ones, and the largest number that can be represented is 111 (in other words, seven). An eight-digit binary number, which can represent values from 0 to 255, is called a byte; larger numbers are represented using multiple bytes. Two bytes (or 16 bits) can represent numbers from 0 to 65,535; four bytes (or 32 bits) can represent numbers from 0 to 4,294,967,295; and so on. When YouTube was set up, its programmers decided to use a 32-bit number to store the number of views. That was quite reasonable choice at the time YouTube started, but now, looks like YouTube need more and more tweaks for troubleshooting these problems.
YouTube also explained the problem in their Google+ post.
“We never thought a video would be watched in numbers greater than a 32-bit integer (=2,147,483,647 views), but that was before we met PSY. “Gangnam Style” has been viewed so many times we had to upgrade to a 64-bit integer (9,223,372,036,854,775,808)!
Hover over the counter in PSY’s video to see a little math magic and stay tuned for bigger and bigger numbers on YouTube.”
YouTube is not the only one facing this kind of problem, other systems built years ago also run into numerical-overflow problems. The Unix operating system and all its derivatives, Android and iPhones, internet servers, Macintosh, all will run out of time on January 19th 2038, at 03:14:07 GMT. By default, Unix counts time in seconds from midnight GMT on January 1, 1970, using a 32-bit signed integer, which means it cannot count more than 2,147,483,647 seconds past that time, thus creating what is known as the “Year 2038 Problem”.