LESSON 05 –
FILES SIZES

 

 

LESSON NOTE

WHY BINARY?

 

Computers are made up of millions of tiny circuits.  These circuits can either hold a low voltage of 0 volts or a high voltage of 5 volts.  (Values may vary.)  Therefore, the circuits have two possible states – a low state (zero) and a high state (one).  By grouping circuits together, we get strings of 0s and 1s – binary.

 

COMPUTERS WITH DIFFERENT BASES

 

Some experimental computers use different bases such as tertiary (base-3) and even decimal (base-10).  However, such computers have been mostly unreliable to date.  This is why all mass-produced computers use binary.

 

One approach to implement a higher base number is to allow the computer circuits to store more values than just 0 or 5 volts.  For example, a tertiary circuit could store 0 volts, 2.5 volts and 5 volts.  However, this is not as simple as it sounds and has lead to many unreliability issues. 

 

BITS & BYTES

 

In computers, each value of either 0 or 1 is called a bit.  A byte is a series of eight bits stored together in memory.

 

Example:  01110011

 

FILE SIZE

 

file is a sequence of bits stored as a single unit.

 

The size of a file is the amount of bits or bytes that the file uses up in memory (RAM, hard drive, flash disk, …).

 

The file size depends on the amount of data that is stored in the file.

 

Example 1:

 

            In text files, each character is stored as a single byte.  Therefore, a text file with 25 characters takes up 25 bytes.

 

Example 2:

 

            A newer BMP image file that is 10 pixels by 10 pixels (100 total pixels) stores the colour for each pixel in 3 bytes.  The file size will be about 300 bytes.

 

            Note: BMP images have a 54 byte file header. There is also some extra bytes placed in some situations also having a small effect on file size.

 

            Note: It is 24-bit BMP images have store colours in 3 bytes of data.

 

GREEK PREFIXES

 

Usually, the prefix kilo means 1000.  However, in computers, its value is 1024.  Therefore, a kilobyte is 1024 bytes.

 

Consider this table:

 

Prefix

Power

Computer Value

Usual Value

Kilo-

210

1024

1000 (one thousand)

Mega-

220

1 048 576

1 000 000 (one million)

Giga-

230

1 073 741 824

1 000 000 000 (one billion)

Tera-

240

1 099 511 627 776

1 000 000 000 000 (one trillion)

 

Note that it is common to assume the math value during casual conversations. 

 

Examples

 

a) Convert 234 kilobytes into bytes.

 

            234 kilobytes x 1024 bytes / kilobytes = 239616 bytes

 

b) Convert 2 349 203 bytes into megabytes.

 

            2 349 203 bytes / 1048576 bytes / megabytes = 2.24 megabytes

 

UNIT SYMBOLS

 

Unit

Symbol

Bit(s)

b

Byte(s)

B

Kilobits

Kb

Kilobytes

KB

Megabits

Mb

Megabytes

MB

Gigabits

Gb

Gigabytes

GB