Title: Hardware
1Hardwareand the stupidity of a computer
2Hardware and software
- In order to make a computer do something useful,
we need both hardware and software - Hardware The physical parts of the computer
(monitor, keyboard, mouse and whatever is inside
the box) - Software The computer programs (Word, Messenger,
Counterstrike, Internet Explorer,) we use for
solving various tasks using the computer
3The computer way
- In order to understand hardware, you need to know
a little about how a computer thinks - A computer does not think, it calculates!
- How can you make pieces of metal calculate
anything useful?
4On or Off
- A computer calculates using metal and current
- A computer can only sense if a current is On
or Off - How can we employ this for doing calculations?
- A transistor is used for this exact purpose
5Transistor
- A transistor is a very simple electronic device
- Two wires lead into the transistor, one wire
leads out - The smart part The transistor can perform a
(sort of) calculation, based on whether or not
there is a current in the two input wires - A so-called logical function
6A smart (?) transistor
- So, what calculation is that?
- Not so impressive, actually
A B Y
Off Off On
Off On On
On Off On
On On Off
Output
Input
7Logical, right?
- The calculation performed by the transistor is an
example of a logical function - A logical funtion takes one or more input values,
and pro-duces a single output value - BUT these values can only be either true or false
- Also know as Boolean logic
8Logical functions - example
Output
Two input values
A B Y
false false
false true
true false
true true
Four possible combinations
9Logical functions - example
A B C Y
false false false
false true false
true false false
true true false
false false true
false true true
true false true
true true true
Three input values
Eight possible combinations
10Logical functions - transistor
If we put Off false On true
A B Y
false false true
false true true
true false true
true true false
11Zeroes and Ones
- If we now exchange true with 1 (one), and false
with 0 (zero), the previous table becomes
A B Y
0 0 1
0 1 1
1 0 1
1 1 0
- This is how we usually denote On and Off
- A numeral system using only 0 and 1 is also known
as a binary numeral system
12The binary numeral system
- Computers use the binary numeral system (aka
base-2), humans (mostly) use the decimal numeral
system (aka base-10) - In the context of a base-10 system, 110 means
1x100 1x10 0x1 110 - In the context of a base-2 system, 110 means 1x4
1x2 0x1 6 - Alternatively
- 11010 1x102 1x101 0x100 110
- 1102 1x22 1x21 0x20 6
13The binary numeral system
- Even if binary numbers appear a bit strange, the
rules for calculation are the same as for base-10 - In base-10 5 7 12
- In base-2 101 111 1100
- Using a carry works just as before
- 0 0 0
- 0 1 1
- 1 0 1
- 1 1 0, and 1 to carry
14Transistors revisited
- The transistor we saw before was not able to do
correct binary addition - However, if you are clever enough, you can
combine transistors to implement other logical
functions - Proper binary addition is just a special logical
function
11 ?
15Transistors revisited
- The original transistor worked like this
A B Y
0 0 1
0 1 1
1 0 1
1 1 0
16Transistors revisited
- If you combine two transistors, you can implement
a different logical function
A B Y
0 0 1
0 1 0
1 0 1
1 1 1
A
B
Y
17Transistors revisited
- The combination before was not very useful, but
we can of course just build more complex
combinations, involving more transistors - Our goals is to be able to do binary addition
- Binary addition is just a special logical
function, taking three input values and producing
two output values - Can be considered to be two separate logical
functions
18Binary addition
A B Carry in Y Carry out
0 0 0 0 0
0 1 0 1 0
1 0 0 1 0
1 1 0 0 1
0 0 1 1 0
0 1 1 0 1
1 0 1 0 1
1 1 1 1 1
19This should do the trick
- Some clever person found out that the below
combination implements proper binary addition
20The first building block
- We have now found a way to do proper addition,
using metal and current - Implementing the other arithmetic operations is
then not particularly complicated - This actually forms the foundation for the first
electronic computers
21ENIAC
- Built around 1945
- Weighs about 30 tons
- Based on vacuum tubes
- Ca. 18.000 transistors
- Used for calculating projectile trajectories
- Was only operational about half of the time
2260 years later
- Today we do not use individual transistors. A
chip contains a (large) number of transistors - Most advanced chips contain a few billion
transistors within an area of perhaps 1 cm2 - What if car technology had progressed at the same
rate - Price 1
- Gas consumption 10.000 km/l
- Max speed 100.000 km/h
23Moores law
- Within two years, the number of transistors on a
chip will double
24From 0 and 1 to Counterstrike
- Even if we can now make metal and current do
calcu-lations, there is still a very long way
from 0s and 1s to Counterstrike - A computer can handle vast amounts of data, at
vast speeds - How fast?
- How much data?
25Bits and bytes
- For a computer, the basic unit for data is an
entity which is either 0 or 1 - This entity is called a bit
- A computer performs operations on bits.
- A more practical unit is a sequence of 8 bits
this is known as a byte. - Why 8 bits? Why not 7 or 9? Tradition
- We can for instance define a character set using
8 bits
26Bits and bytes
- How many distinct bytes are there?
- One byte is 8 bits, each bit is either 0 or 1
- Combinations 2x2x2x2x2x2x2x2 256 (28)
- Each combination can now be interpreted as a
specific symbol (letter, number, etc), for
instance the letter H - With 256 combinations, we have enough
combinations for capital letters, small letters,
numbers, etc.. - Example ASCII codes
27ACSII codes
28Amounts of data
- Amounts of data are usually measured in bytes
(each byte being 8 bits) - For a computer, all kinds of data are just
sequences of bits - It requires a program written by humans to
interpret a bit sequence as e.g. music, video, a
Word docu-ment, and so on - How many bytes does each type of data require?
29Size of some data types
Plain text (no pictures) Music (mp3 format) Video (DVD quality)
Kilo-byte Half a page --- --
Mega-byte 500-page novel One minute One second
Giga-byte Large book-shelf 16 hours 20 minutes
Tera-byte Large library Two years Two weeks
30Speed of calculation
- When a computer calculates, it processes many
sequences of bits simultaneously - All calculation units must be syn-cronized for
this to work properly - A conductor manages when the calculation units
should calculate - The speed of the conductor defines the speed of
the computer
31Speed of calculation
- How many beats per second (hertz) can the
conductor manage? - Old computer (ENIAC) about 10.000 beats per
second (10 kiloHertz) - Modern PC about 3.000.000.000 beats per second
(3 GigaHertz) - Also known as clock rate
323.000.000.000 Hertz
- Three billion beats per second is quite fast
- For every beat, light only travels 10 centimeters
- The physical size of the chip begins to matter
- Unfortunately, energy consump-tion rises with the
clock rate, at a quadratic rate
33CPU
- Where are calculations actually performed?
- Calculations are done in a unit called the CPU
(Central Processing Unit) - This unit is basically just one large chip, which
looks fairly uninteresting
34The CPU and Primary Storage
- The job of the CPU is to perform calculations on
streams of bits, but who provides these bits? - Somebody has to feed bits to the CPU, and
consume the results produced by the CPU - For this task, the computer uses the Primary
Storage
35Primary Storage
- A calculation involves the below steps
- Input data is moved from primary storage to the
CPU - The CPU performs the calculation
- The result is moved from the CPU to primary
storage - The primary storage is thus just a container
for a certain amount of data - The primary storage is passive no kind of data
processing is performed here - Primary storage is usually of the type RAM
(Random Access Memory)
36Primary Storage
- What is primary storage physically?
- Just some chips, which contains a certain amount
of data - A modern PC will typically have 2-8 Gigabytes of
primary storage - What could the data represent? For instance data
from an mp3-file, for which the CPU must perform
some calculation to transform it into music
37Primary vs. Secondary
- Primary storage (RAM) has a large advantage
transfer of data between the CPU and RAM is quite
fast (several Gigabytes pr. second) - Fast but compared to what?
- There are however also several drawbacks
- RAM is expensive (compared to what?)
- When power is cut, all data in the primary
storage will be lost - We thus also need secondary storage
38Secondary storage
- Who provides data to the primary storage? That
data is provided by secondary storage - What is secondary storage? In principle the same
as primary storage a passive container for data
- but - Is much cheaper than RAM (per byte)
- Data is preserved when power is turned off
- Presently, the most common form of secondary
storage in a PC is a hard drive
39Quite hard(old school)
- A (traditional) hard drive con-tains a number of
magnetic platters, on which individual bits are
stored by magnetising a specific area of the
platter - A modern hard drive contains 500-2,000 Giga-bytes
of data
40Quite hard(new school)
- A SSD (Solid-State Drive) hard drive contains a
number of memory chips, on which individual bits
are stored in transistors (but retained when
power is turned off) - A modern SSD contains 60-500 Giga-bytes of data
41Hard drive vs. RAM
Hard drive (Traditional) Hard drive (SSD) RAM
Typical amount in PC 500-2000 GB 60-500 GB 2-8 GB
Price pr. Gigabyte 0,5 kr. 10 kr. 100 kr.
Data transfer speed 0,1-0,3 GB/sek 0,5-1 GB/sek 4-8 GB/sek
Preserves data without power Yes Yes No
Technology Mechanical Electronic Electronic
42Harddisk vs. RAM
- In other words
- RAM
- Very fast and stable, BUT
- Expensive, does not preserve data without power
- Hard drive
- Cheap, large capacity and preser-ves data without
power, BUT - Rather slow, mechanical technology (except SSD)
43Other types of secondary storage
USB-key CD, DVD and Blu-ray Floppy disks Online
Capacity (Gigabytes) 2-256 0,7-30 0,0015 (!) ??
Price (kr pr. GB) Ca. 10 Ca. 1 gt100 ??
Speed (MB pr. sek) 10-100 25 lt 1 Depends on connection
Technology Electronic Optical / Mechanical Magnetic / Mechanical Internet
Note Same tech as SSD Stagnant Almost extinct On the rise
44Motherboard
- A PC contains a board, on which the central
components of the PC are mounted this board is
usually denoted the motherboard - The motherboard will (at least) contain
- CPU
- RAM (primary storage)
- Auxiliary components
- Sockets/slots for adding other components
45Other components
- Examples of other components are
- Graphics card
- Sound card
- Network card
- TV card
- In some PCs, these components are found directly
on the motherboard, on others they are found as
extra components, inserted into slots on the
motherboard - Why?
46Other components
- Even though a modern CPU is very fast, it may
benefit from being relieved from certain tasks - Graphics card
- Specially designed for effective graphics
calculations - Takes computational load off CPU
- May increase graphical performance by a factor
100 - Typical application GAMES!
47(No Transcript)
48(No Transcript)
49Data exchange by bus
- All these units and components need to exchange
data in order to do their job - How do they do that?
- Data exchange is done using so-called data buses
- A data bus transports data between two units
50Data exchange by bus
- A data bus sends data
- A number of times pr. second
- A certain amount of data each time
- Example a 32-bit bus running at 100 Mhz
- Carries 32 bit (4 bytes) each time
- Sends 100 million times pr. second
- A PC contains a number of buses running at
different speeds
51Countryside bus
- A bus is also used for exchanging data with
additional components, like a graphics card - Types of buses for extra components
- PCI (Peripheral Component Interconnect) those
slots in which additional components (such as a
graphics card) can be inserted - USB (Universal Serial Bus) used by many
external devices such as printers, USB memory
keys, etc.. - Fortunately, buses follow a standard
52External devices
- Devices which enable communication between humans
and computers - Typical external devices
- Keyboard and mouse
- Monitor
- Speakers / headset
- Printer
- But also
- Digital camera, phone, USB-key,