1MiB = 1024KiB = 2^10. Nonetheless, why not use just 1000 byte instead 1024 to calculate size?

691 views Asked by At

1024 = 2 to the power 10. Computers use binary system where the base is 2 (0 and 1). Humans use decimal system where the base is 10. So if I have 1 byte which contains 8 bit in modern computers I can represent up to 256 different states, possibilities, values or such. 10 bits can represent 1024 states. Well..so what? What does it have to do with memory? I think memory size it's about number of bits/bytes not about number of states that bits and bytes can represent. I'm confused. What the technical benefit from thinking 1K(i)B = 1024 and not 1000 bytes?

I think I need more technical explanation maybe something related how CPU works or how data actually stores at hard drive. Not just: hey computer use binary form so we use 2^10 and not 10^2.

3

There are 3 answers

0
Sergey Kalinichenko On BEST ANSWER

What does it have to do with memory?

It has to do with memory addressing, which is done using binary numbers as well.

On a very high level, a typical memory chip works like this: it has pins of three types - address pins, data pins, and control pins. When CPU needs to read or write memory, it sets up a combination of zeros and ones on the address pins of a memory chip, sends a read or write signal to the control pins, waits a little, and then reads or writes data using the data pins.

The combination of zeros and ones placed on the address pins is called memory address. It is a binary number in the range from zero to 2n, where n is the number of address pins.

This is how the powers of two get into measuring the capacity of memory. Conveniently, 1024 was very near 1000, so "K" was borrowed to mean 1024 when talking about memory size.

Note that measuring data sizes using binary multiples is not universal. For example, capacities of hard drives are often quoted using decimal, not binary multiples, because hard drives do not inherently use binary addressing (and the number of decimal gigabytes is higher, which helps marketing the product).

0
atlaste On

What does it have to do with memory?

Obviously all these sizes are powers of 2. The reason it's 1024 and 1024^2 is because it's an exact description of what you get.

It's easy to address memory when you use the building blocks of a computer. These building blocks are address pins, and having more corresponds to powers of 2.

That said, we can also just call it '1000'. It's just less exact in most cases, and therefore makes less sense in the general case. There are exceptions though: most harddisks actually use powers of 10 for the capacity. You notice that when you put it in your computer, and the '24' suddenly starts to make a difference. :-)

4
user3344003 On

Memory management is historically done in powers of two because powers of two can be performed using bit shifts. If the system had 1024 pages, the hardware can identify the page simply extracting (or shifting) bits.

In disk drives, 1K is 1000 bytes. This was done for marketing purposes. Disk drive manufacturers could advertise slightly larger capacities. This is true even though drives work with blocks whose sizes are powers of 2.