Lecture 3: Units of Information / Memory |
Note: The idea to seperate the program form the data it is
working
on and to seperate the hardware from the software (or the "the machine"
and the "program") comes from Von Neumann. He designed the first
electronic
computer capable of running a flexible program (1940-1952). All modern
computers are Von Neumann computers. The on-line encyclopaedia Wikipedia has more about Von Neumann (or other subjects). |
Before writing programs, it is useful to take a closer look at the memory.
Memory is filled with information. This information can
either
be program code or data. Let's take a look at some types of
information.
electronic levels of AND gates |
0 V | +5 V |
binary | 0 | 1 |
logical | FALSE | TRUE |
bicolor | green | red |
These ideas can be mixed at our wish. For example, PASCAL uses the
ideas
'TRUE' and 'FALSE' for logical calculations, while C uses '1' and '0'.
|
|
example of an LED display |
Looking at the table we see that when the binary code is
abcd
the decimal code is
a*8 + b*4
+ c*2 + d
or, more general:
a*23 + b*22
+ c*2 + d
This, we will see, is always the relation between binary and decimal
numbers.
Note also that some of the possible combinations of bits are not
used
in BCD. A way to represent these four bits of information with all
possbile
combinations used is the hexadecimal system. The bit
combinations
from '1010' to '1111' are then represented by the letters A to F. In a
hexadecinal representation we get the following translation table:
|
|
00000000 = 0*27 + 0*26 + 0*25
+ 0*24
+ 0*23 + 0*22 + 0*21 + 0*20
= 0
11111111 = 1*27 + 1*26 + 1*25
+ 1*24
+ 1*23 + 1*22 + 1*21 + 1*20
= another example: |
Alternatively, a byte can represent all the letters of the alphabet,
in uppercase ('A' .. 'Z') and lowercase ('a' .. 'z'), plus all the
digits
'0' .. '9', some special letters like '{', '}', '(', ')',
space,
etc, and other things like control codes. The most often used way to do
this is ASCII (American Standard Code of Information
Interchange)
in which, for example 'A' is 65 (decimal), or 01000001 (binary), or 41
(hexadecimal). Other examples are:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
As we will se later, some 'people' (units) are very big and
occupy
two or even more adjacent houses. These 'people' are called 'integers',
'words', 'reals', etc. Still, addresses are in most computers 1 byte
and
thus 8 bits apart.
(Note [not needed to study]: especially in supercomputers the
distance
between two addresses can be much longer than a byte, for example 63
bits
instead of 8. We call this distance the 'word length' of a computer.)
Note that all three units described until now are also units of food in English. Bit, Nibble, Byte. Further units disband this idea.
Very often you read in the advertisement things like: Computer, with 1.7 GHz processor, 256 MB RAM, 40 GB harddisk, 1.4 MB floppy |
The 1.7 GHz specifies the speed of the CPU (the central processing
unit).
1.7 GHz thus means that it can do 1.7 million simple instructions per
second.
(Since most commands given to the processor take more than one
simple
instruction, the actual number of commands per second is lower. For
example
an addition of two floating point number might consist of 1) loading
the
first number from memory, 2) loading the second number from memory, 3)
adding the number (possibly in several steps), 4) saving the result to
memory. Nevertheless, the overall speed of a computer is largely
determined
by the speed of the processor and the speed with which it can load the
data from memory.)
The other numbers determine the size of the memory of the computer (RAM = Random-access memory), the harddisk and the floppy disk repectively, in number of bytes (B). To give an idea what these numbers mean, let's analyze them more carefully:
BYTE: The basic unit to describe memory is the byte (B). As said before, a byte is large enough to contain a single letter, or a number from 0 .. 255.
KILOBYTE: 1024 bytes is called a kilobyte (kB). In science,
'kilo'
means exactly 1000, a nice round number in the decimal system. For
computers
'kilo' means a little more, 1024. This is based on the fact that 1024
is
exactly 210, or in binary 10000000000, a nice round number.
To give an idea of how much a kilobyte is: A page of A4 with text is
approximately 4 kB.
MEGABYTE: 1024 kilobytes is a megabyte (MB). This is
then equal
to 1024 x 1024 bytes, or 1048476 bytes. To give an idea how much a megabyte is: 250 pages of text, or, let's say a book. Most floppies are 1.4 MB and this is thus enough to store a book of about 350 pages. (without images etc.) |
GIGABYTE: 1024 megabytes is a gigabyte (GB). This is enough to store a nice library of a thousand books. Most CD-ROMs have 650 MB (0.65 GB), enough to store a small library |
Modern harddisks have about 40 GB space. On this we can therefore store a large library, some 40.000 books. |
TERABYTE: 1024 gigabytes is a terabyte. Although disks of
this
size do not exist yet, some companies have computer systems with many
disks
totalling disk space in the order of terabytes. This is enough to store
all the books in the world.
To give an idea about the total amount of diskspace on the world: there exist about 500 million computer owners in the world. On the average, each has a hardisk of about 10 GB. That makes a total of approximately 5.000.000.000.000.000.000 bytes. It would take a person reading 10 books per day more than a billion years to complete reading all the information! |