Not all gigabytes are equal

Gigabytes (GBs to simplify) are used to measure the capacity of hard disks or memories for example. They correspond to the billions of bytes that they can store in 2021, but not all GBs are equal. We will see that 1 GB of RAM memory does not generally correspond exactly to 1 GB of hard disk.

16GB MicroSD versus 16GB RAM

The difference between the two comes from the use of powers of two to express the capacity of RAM memories and of powers of ten to express that of hard disks. Both are correct but it can be confusing.

The International System of Units (SI) defines the prefixes which are used to express the powers of ten, for instance tens, hundreds, thousands, millions, etc… These prefixes are used in the common language to easily express large quantities. We say for instance that the frequency of a CPU is 4 GHz instead of 4,000,000,000 Hz when it is the same thing. The following table includes the list of the prefixes of the International System of Units frequently used in computer science and their corresponding value:

Power de 10 Prefix Symbol Value
100     1
103 kilo k 1000
106 mega M 1,000,000
109 giga G 1,000,000,000
1012 tera T 1,000,000,000,000
1015 peta P 1,000,000,000,000,000
1018 exa E 1,000,000,000,000,000,000

So far so good, and it is indeed these prefixes that are used to express the capacity in bytes of data storage devices such as hard disks for example. So, when a manufacturer indicates that the capacity of a hard drive is 1 TB, it corresponds to 1,000,000,000,000 bytes. Please note that this is the capacity of the disk before formatting, the capacity available after formatting will be smaller.

Things are getting more complicated now: for historical reasons related to the manufacturing process, the size of the RAM memory modules is a power of 2, but for simplicity, we nevertheless use the same SI prefixes to express their capacities in bytes. We say that 1 kB of RAM corresponds to 1024 bytes (2 10 bytes) or that 1 MB of RAM corresponds to 1024 kB (220 bytes). The problem is that 1024 is not 1000 even though it is a fairly close value. The following table allows you to see that the difference between the size of the RAM memory expressed using these prefixes (multiples of 1024) and the corresponding size using the SI units (multiples of 1000) increases rapidly:

  Power of 2 Capacity in bytes % of difference
1 kB 210 1024 2.40 %
1 MB = 1024 kB 220 1,048,576 4.86 %
1 GB = 1024 MB 230 1,073,741,824 7.37 %
1 TB = 1024 GB 240 1,099,511,627,776 9.96 %
1 PB = 1024 TB 250 1,125,899,906,842,624 12.59 %

 

To avoid this confusion, the International Electrotechnical Commission recommends the use of the following prefixes to express the RAM modules capacities: Ki (1024), Mi (1024 Ki), Gi (1024 Mi). etc… but in fact they are rarely used, and everyone uses the GBs to describe the capacity of RAM modules and not the GiBs.

Therefore, not all GBs are equal, 1 GB of RAM memory corresponds to 1,073,741,824 bytes while 1 GB of hard disk corresponds to 1,000,000,000 bytes. You just have to know.

One last thing: not all operating systems indicate hard disk capacity in the same way. If recent versions of MacOS or Linux correctly use the SI prefixes (powers of 10), the different versions of Windows use prefixes based on powers of 2. The capacity displayed in GB for the same hard disk will therefore not be the same depending on the operating system, but it will always be the same when it is expressed in Bytes.

 

The post Not all gigabytes are equal appeared first on EatYourBytes