Data Storage

How do we measure the data storage in a computer?

A computer stores information in binary format. The Binary system is a number system which uses bits to store data. A bit is a “binary digit”, the smallest increment of data on a machine. A bit can hold only one of two values: 0 or 1.

Because bits are so small, you rarely work with information one bit at a time. Bits are usually assembled into a group of 8 to form a byte or "binary term". Computer memory is typically byte addressed – each byte has a unique address.

Bytes are often used to store characters (they contain enough information to store a single character), but they can also be used to store numerical values.

A byte can store a numerical value between 0 and 255 or between -127 and 127 if we are considering the negative numbers too.

There are 28 = 256 different byte values:

Bit valuesBit values

For the purposes of storing numerical data values, bytes are grouped together into words, which are typically 2 bytes.

short int, unsigned short 16 bits (2 bytes)
int, unsigned int 32 bits (4 bytes)
long int, unsigned long 32 or 64 bits (4 or 8 bytes)
Data type definition

Data units of 512 bytes or more are called data blocks. Each operating system has a specific block size.

1 byte 8bits
1 kilobyte 210 bytes 1’024 bytes
1 megabyte 220 bytes 1’048’576 bytes
1 gigabyte 230 bytes 1’073’741’824 bytes
1 tetrabyte 240 bytes 1’099’511’627’776 bytes
Conversion table

Example

A good example is given by digitized images: a single DIN A4 (8.2 x 11.6 inches) color picture (4 colors) scanned at 300 dpi with 8 bits/pixel/color, produces 30 MBytes of data.

Challenge: Try to calculate how to arrive at that result (30MB)

Solution (Click here for more information)

Storing characters

“A”= 01000001
“B”= 01000010
“C”= 01000011

Storing colors

The computer screen uses a RGB (Red/Green/Blue) model, in which each color is represented by 16 bits.

In the following table the 16 principal Windows colors are illustrated.