SEGGER standard for units of Memory size

From SEGGER Wiki
Revision as of 10:26, 5 August 2021 by Rolf (talk | contribs) (Units of memory size)
Jump to: navigation, search

In computing, the size of a memory is usually a power of two. The same is true in most Embedded Systems, where memory sizes such as the size of Flash memory or RAM are usually given in units of 2^10 = 1024 bytes or 2^20 = 1048576 bytes. These have historically been called kB and MB. Unfortunately, this conflicts with the SI-System, where the k-prefix stands for 1000 (10^3) and the M-prefix represents 1000000 (10^6). In order to avoid confusion, we decided to use KB for 1024 bytes and document our conventions.

This article describes the units used by SEGGER for memory sizes and transmission speeds, used in programs, manuals and on the web.

Bytes and Bits

  • b stands for bit
  • B stands for Byte (8 bits)

Prefixes

SEGGER has adopted the following convention on prefixes:

  • k = 1000 (10^3)
  • K = 1024 (2^10)
  • M = 1000000 (10^6)
  • Mi = 1048576 (2^20)

These are being used in all SEGGER products and documents. However, this is a process that will take some time, and older programs and documents will not be updated.

Units of memory size

In most cases, binary-based values (K or Mi) are used.
Where possible, K is preferred over Mi as it is more easily understood, so 2048 KB is preferred over 2 MiB
Metric units can be used, but usage is typically limited to contexts related to storage, such as capacity of a storage medium.

kB

The unit kB represents 1000 bytes

KB

The unit KB represents 1024 bytes.

MB

The unit MB represents 1'000'000 bytes

MiB

The unit MiB represents 1'048'576 bytes

Units of Throughput (speed)

  • All combinations of the above can be used. Which one is used depends on the context.
  • Typically, communication speeds are typically given in metric values, such 100 Mb/s
  • Typically, memory related transfer speeds are often specified as binary-based values, such as 500 KB/s

Examples:
kB/s = 1000 bytes per second
KB/s = 1024 bytes per second
MB/s = 1'000'000 bytes per second
MiB/s = 1'048'576 bytes per second
Mb/sec = 1'000'000 bits per second