Chap 1
Chap 1
2
Hardware
• Processor
– The processor (CPU) is the “brain” of the system.
– It fetches instructions from memory and executes them.
• Main memory
– Volatile storage for programs and data
• I/O modules
– Allow data to be moved to and from the computer and
I/O devices.
• System bus
– The pathway for data and instructions to move between
the processor, memory, and I/O modules.
3
Hardware Configuration
CPU
Input /
System I/O Modules
Output
Bus
Devices
Main
Memory
The system bus connects the CPU, I/O Modules, and Main Memory
4
5
Evolution of the Microprocessor
• The invention of the microprocessor enabled desktop and
handheld computing.
• A microprocessor is a processor contained on a single chip.
• Originally slower but now faster than multichip
processors.
• Modern microprocessors may have multiple processors on
a single chip, called processor ‘cores’.
• Each core might be able to support two logical processors
by sharing an execution unit.
• A modern microprocessor chip might contain 2 or 4 cores,
enabling a view of 4 to 8 logical processors.
6
Evolution of the Microprocessor
• GPU – Graphical Processing Unit.
– A GPU provides efficient computation on arrays of data using
SIMD (Single-Instruction Multiple Data) techniques.
– Originally for graphics, now used in general numeric processing,
including physics simulations, games, and large spreadsheets.
• Other supporting chips co-exist with the CPU to provide such things
as encoding/decoding video (codecs), or for encryption and security.
8
Processing
Main Memory
Execute
CPU
Fetch Instruction
9
Instruction Execution
11
Instruction and Data Formats
Example
Instruction:
0 3 4 15
Opcode Address
Data (integer):
0 1 15
Sign Magnitude
12
Instruction Format
• Notice that a machine will have a size for instructions like
16-bit or 32-bit based on its architecture.
• This limits the size of an instruction.
• If part of the instruction is an opcode and part an address,
then the portion set aside for the opcode determines how
many opcodes there can be, and the portion set aside for the
address determines how much memory is directly
addressable.
• For example, if 4 bit opcodes, then only 16 opcodes are
possible (which isn’t many).
13
Example Opcodes
• 0001 = Load AC from memory
• 0010 = Store AC to memory
• 0101 = Add to AC from memory
14
15
Interrupts
• Interrupts are a mechanism for interrupting the processor’s
execution in order to do something else.
• Common types of interrupts are:
– Program – instruction exceptions:
• arithmetic overflow
• division by zero
• execute illegal instruction
• reference outside user’s memory space
– Timer – system timer
– I/O – completion of I/O or I/O error.
– Hardware failure – power failure or memory parity
error. 16
17
Interrupts
• Interrupts improve processor utilization by notifying the
processor of an event versus making the processor wait.
• This frees the processor to do other processing.
• Without interrupts, the processor would have to keep
checking to see if an event has occurred.
• With interrupts, the processor is free to do something else
until the event occurs, at which time it will be notified.
18
Interrupts
• An example of using interrupts to improve processor
utilization is in processing I/O commands.
• Most I/O devices are much slower than the processor.
• Rather than have the processor wait for an I/O to finish,
the processor could continue processing and be interrupted
when an I/O finishes. This is much more efficient.
• The next slide illustrates this technique:
19
20
Time 1 1
4 4
Processor
Wait I/O Operation
Interrupt 2a I/O Operation
5 5 Interrupt handler
2b
2
4
4 Interrupt 3a I/O Operation
Processor
Wait I/O Operation 5 Interrupt handler
5 3b
22
Interrupt Cycle
• After instruction execution, the processor checks to see if
an interrupt has occurred.
• If so, it executes an “Interrupt Handler”, which is code that
processes the interrupt.
• The processor must save system state (the registers) on the
stack before executing the interrupt handler, or the
interrupt handler may be written to preserve system state.
• The processor may have to determine which interrupt
handler to run for this interrupt.
23
24
Interrupt Processing
Memory
Interrupt
handler
CPU
27
28
29
Memory Hierarchies
• Memory on a computer system is composed of a hierarchy
of differing kinds of memory.
• Generally these tradeoffs apply across the spectrum of
memory technologies:
– Faster access time, greater cost per bit
– Greater capacity, smaller cost per bit
– Greater capacity, slower access time.
30
Memory Hierarchies
• The computer system designer wants greater capacity for
larger programs and reduced cost per bit, but also wants
fast access times which requires lower capacity memories
having higher cost.
• Therefore, a single memory solution isn’t appropriate, that
is why a hierarchy of memory types is used.
31
Decr. cost per bit
Incr. capacity
Incr. access time
Decr. freq. of access
by the processor.
32
Why does a Memory Hierarchy work?
33
Cache Memory
• Today most processors can execute instructions faster than
they can be retrieved from main memory.
• Cache memory sits between the processor and main
memory and exploits the principle of “locality of
reference” by keeping a “working set” of instructions and
data in its small but high-speed memory.
34
35
Cache Principles
• When the processor fetches an instruction, a block is read
into the cache.
• When the next instruction is fetched, there is a high
probability it is contained in the same cache block, which
can be accessed quickly.
38
39
Cache Design
Considerations:
• Cache size – how big is the entire cache (a small cache still
offers a lot of improvement).
• Block size – how big is a block? Needs to be around the
size of a cluster.
• Mapping function – where to put a new block?
• Replacement algorithm – how to replace a block?
• Write policy – when to write a block back to main
memory?
40
I/O Communication Techniques
• Programmed I/O:
– Processor moves data between I/O module and memory.
– Processor must wait for I/O to complete.
• Interrupt-driven I/O:
– Processor issues I/O command and then goes on to other
processing.
– An interrupt lets the processor know when the I/O is
complete, at which time the processor moves the data.
• DMA (Direct Memory Access):
– Processor delegates the I/O transfer to the DMA module.
– When processor is notified of completion (by interrupt),
the data has already been moved.
41
Multiprocessor and Multicore
Organization
• Symmetric Multiprocessors (SMP)
– A single computer system having these characteristics:
– Two or more processors of comparable capability.
– These processors share the same memory and I/O
facilities and are interconnected by a bus such that
memory access is about the same for each.
– Processors share the I/O devices.
– Processors perform the same functions (symmetric).
– The system is controlled by an OS that manages the
interaction between programs and processors.
42
Multiprocessor and Multicore
Organization
• SMP Advantages:
– Performance: if work can be done in parallel across the
various processors, then there can be a performance
gain.
– Availability: since all processors have equal capability,
a failing processor does not halt the system, but only
reduces its performance.
– Incremental growth: performance can be enhanced by
adding additional processors.
– Scaling: vendors can offer a range of products with
different price and performance characteristics based
on the number of processors in the system.
43
44
Multiprocessor and Multicore
Organization
• Multicore computers
– Combines two or more processors on a single chip (a
piece of silicon called a die).
– Each core typically has all of the components of an
independent processor, such as registers, ALU, pipeline
hardware, control unit, and caches.
45
Multiprocessor and Multicore
Organization
• An example is the Intel Core i7-5960X, which has 6 x86
processors, each with an L2 cache and a shared L3 cache.
• The processor employs prefetching, in which the hardware
examines memory access patterns and attempts to fill the
caches speculatively with data that’s likely to be requested
soon.
46
GT/s = gigatransfers per second 47
End of Slides