How many 𝗯𝘆𝘁𝗲𝘀 are there in 𝟭𝗞𝗕 of data?
A. 1000 B B. 1024 B
If you answer "A", you are correct, but if you ask IEC standard or JEDEC Memory standard, then you've earned my respect.
Many engineers often misused the prefix when quantifying data. This confusion is derived due to lot of them is taught that in binary a kilo is 1024 instead of 1000. However, this is a widespread misconception as this was supposed to be an approximation instead of definition.
Back in the old day, computer engineer found that it is really convenience to use 2¹⁰ (1024) to represent a kilo (1000). This approximation allows engineer to convert any value to kilo prefix simply by shifting the binary to the right 10 times. This approximation become widely adopted in the field of computer and memory engineering, and the term binary kilo which represent prefix of 1024 is born.
However, as demonstrated having multiple definition for a prefix could be confusing. Therefore, the new prefix Ki is defined by IEC to address the misused of the SI prefix in the binary system. According to IEC 80000-13:2008, 1 Kilobyte (KB) represents 1000 B, while 1 Kibibyte (KiB) represents 1024 B. However, in some standards, such as JEDEC Memory Standard, 1 Kilobyte (KB) still represents 1024 B.
Recently, I've been a victim of this misconception. I was tasked to estimate the performance of a high-speed data transfer protocol. After some measurement I figured out that the protocol is running at 0x1b9234fb4 Bps (7401066420 Bps). Swiftly, I shift the number to the right by 20 places and obtain 0x1b92 MBps (7058 MBps). If you did the math properly on the raw data, the protocol is actually running at 7401 MBps instead of 7058. 𝗧𝗵𝗮𝘁 𝗶𝘀 𝟱% 𝗼𝗳 𝗲𝗿𝗿𝗼𝗿 𝗶𝗻 𝘁𝗵𝗲 𝗺𝗲𝗮𝘀𝘂𝗿𝗲𝗺𝗲𝗻𝘁.
Key takeaway:
- Always check the standards of any documentation provided
- If the standard is not specified, use IEC standard as default.
- Be wary of any memory related documentation as it usually adopted JEDEC memory standard