Saturday, May 30, 2015

k, K, kB, KiB and the "Konfusion" behind!

Today I want tell you about "k"(small k), not "K" (capital K), and its meaning in the computing world.

"k" is the abbreviation for kilo, and kilo stands for one "thousand", 1000. Period!
So, 1 kg is 1000 g, 1 km is 1000 m and so on... or at least this is the case until you speak about things that have nothing to do with computers.

When it comes to computers, and computer-things, the usage of "k", as well as "M", "T", etc is INCONSISTENT. In different contexts within IT, "k" can be:

  • 1000
  • 1024

The same "konfusion" (sorry I couldn't resist!) apply for the other  multipliers mega, giga, tera, etc.
How many bytes are 1 kilobyte (1 kB), 1 megabyte (1 MB) or 1 gigabyte (1 GB) ?
Well IF you are talking about RAM:

1 kB = 1024 bytes 

1 MB = 1024 kB
1 GB = 1024 MB

So your 8 GB RAM is actually 8*(1024)^3 = 8*1 073 741 824 bytes = 8 589 934 592 bytes this is 7.4 % MORE than if you would have applied the"1000" rule, i.e. the same rule you commonly apply in contexts like measuring weights or lengths. This happens due to architectural reasons that make convenient to deal to multipliers that binary based and 2^10 = 1024  is pretty close to 10^3!!!

Suppose you going to buy an external hard drive, let's say a 2 TB external hard drive... how many bytes can you store there? (let's assume for simplicity you can use all the space, which is not for several reasons....)

Guess what... this time, YOU MUST apply the "common" 1000 rule, because the when it comes to "hard drives", the IT industry use the multipliers kilo, mega, giga, tera etc in a way that it consistent as the International System of Units (SI) defined them!
So your 2 TB disk holds 2 000 000 000 000 bytes = 2 * 10^12 bytes!

Hard Drives' capacity is not the only IT context when you use the SI-multipliers as SI define them.
How fast is your internet connection? 10 MBit/s? That "MB" still means 1000 kB = 10^3 Bytes!

How fast is the clock of your CPU? 2.7 GHz, that "G" means, again, 1000 M so... 2.7 x10^9 Hz!

Just to had more fun, do you know that Operating Systems have different conventions as well?

A "300 GB" hard disk on a Microsoft Windows system appears as 279 GB, but on OSX (from version 10.6) and on Ubuntu (from 10.10) is still 300 GB! Windows defines k, M, G as 1024 B, 1024 kB and 1024 MB respectively, while OSX applies the SI conventions! Confused? Yes, it's normal!

To clarify the confusion, in 1998 the Inernation Electrotechnical Commission (IEC) proposed a new set of prefixes, kikibyte (KiB), mebibyte (MiB), gibibyte (GiB) to denote 1024 bytes, 1048576 bytes, and 1073741824 bytes,  but they had no big success so it's normal if you haven't seen them.

Your take away...

  • The multipliers for your RAM are binary based, so 1 GB = 1024 MB = 1024 * 1024 kB = 1024^3 bytes
  • For everything else normally the decimal base is used. Your 2 TB hard drive holds 2x10^12 bytes!
  • If you want to be precise, IEC offers you the "new" binary prefixes KiB, MiB, GiB etc

Bonus fact

Please, please ... "k" as 1000 is written in lower case! So 1 kilometer is km NOT Km!!!! 
K as capital letter means Kelvin, and is a unit for temperature!


Agent Kelvin in mibibyte  ;)

Interesting readings

No comments: