Chapter - 01 - Computer Abstractions
Chapter - 01 - Computer Abstractions
Computer Abstractions
And
Technology
Andy D. Pimentel
Adapted from Computer Organization and Design, 5th Edition, Patterson & Hennessy, © 2014, MK
and Toto van Inge / Prof. Mary Jane Irwin
1
Computer Science Field at a glance
3
"Top - Down“ vs "Bottom - Up approach“
Abstraction levels and Hierarchy
Lectures Hands-on
Five Classic Components top
Should
know
SIM-PL
Complex blocks
Logic gates
Nice to
know
Physics
bottom
4
What You Will Learn
H1 How programs are translated into the
machine language
◦ And how the hardware executes them
The hardware/software interface
What determines program performance
◦ And how it can be improved
How hardware designers improve
performance
H6 What is parallel processing
5
The Computer Revolution
Progress in computer technology
◦ Underpinned by Moore’s Law
Makes novel applications feasible
◦ Computers in automobiles
◦ Cell phones
◦ Human genome project
◦ World Wide Web
◦ Search Engines
Computers are pervasive or ubiquitous
Cloud computing
The AI revolution
6
Evolution
7
A few trends
8
The Post PC Era (Embedded)
9
Eight Great Ideas
Design for Moore’s Law
Hierarchy of memories
* The performance improvement to be gained from using some faster mode of execution
is limited by the fraction of the time the faster mode can be used
11
Below Your Program
Application software
◦ Written in high-level language
System software
◦ Compiler: translates HLL code to
machine code
◦ Operating System: service code
Handling input/output
Managing memory and storage
Scheduling tasks & sharing resources
Hardware
◦ Processor, memory, I/O controllers
12
Advantages of Higher-Level Languages ?
Higher-level languages
! Allow the programmer to think in a more natural language and for
their intended use (C, C++, Python for scientific computation, Java, C#
for business programming, Erlang, Haskell for symbol manipulation, Java
for web programming, …)
! Improve programmer productivity – more understandable code that is
easier to debug and validate
! Improve program maintainability
! Allow programs to be independent of the computer on which they are
developed (compilers and assemblers can translate high-level language
programs to the binary instructions of any machine)
! Emergence of optimizing compilers that produce very efficient assembly
code optimized for the target machine
◦ No guarantees regarding
How operations are implemented
Which operations are fast and which are slow and when
Which operations take more power and which take less
16
Abstractions
The BIG Picture
17
Abstraction layers in computing
Further reading:
The Universal Hierarchy of Abstraction
Making Sense of the Abstraction Hierarchy
Abstraction, levels of detail, and hierarchies in map series
Source: acm.org
18
Looking at the processor (CPU)
19
Opening the Box
20
Inside the Processor
Internals of Apple's
dual-core A5 SoC
Source: Chipworks
21
BREAK
22
Understanding Performance
Algorithm
◦ Determines number of operations to be executed
also in hands-on part of the course with SIM-PL
Programming language, compiler, architecture
◦ Determines number of machine instructions executed per
operation
also in hands-on part of the course with SIM-PL
Processor and memory system
◦ Determine how rapid instructions are executed
also in hands-on part of the course with SIM-PL
23
Throughput versus Response Time
Response time (execution time) – the time
between the start and the completion of a task
◦ Important to individual users
Throughput (bandwidth) – the total amount of
work done in a given time
◦ Important to data center managers
Will need a performance metrics as well as a set of applications to
benchmark embedded and desktop computers, which are more
focused on response time, versus servers, which are more focused
on throughput.
Response and Throughput, together, define the speed and capacity of a structure
24
Measuring Execution Time
Elapsed time (Wall-clock time)
◦ Total response time, including all aspects
Processing, I/O, OS overhead, idle time
◦ Determines system performance
CPU time
◦ Time spent processing a given job
Discounts I/O time, other jobs’ shares
◦ Comprises user CPU time and system CPU time
◦ Different programs are affected differently by
CPU and system performance
25
CPU Clocking
Operation of digital hardware governed
by a constant-rate clock
Clock period
Clock (cycles)
Data transfer
and computation
Update state
26
Algorithm Execution Process
Program Counter
Clock
27
CPU Time
CPU Time = CPU Clock Cycles ´ Clock Cycle Time
CPU Clock Cycles
=
Clock Rate (frequency)
Performance improved by
◦ Reducing number of clock cycles
◦ Increasing clock rate (frequency)
◦ Hardware designer must often trade off clock
rate against cycle count
28
CPU Time Example
Computer A: 2 GHz clock, 10 s CPU time
Designing Computer B
◦ Aim for 6 s CPU time
◦ Can do faster clock, but causes 1.2 × clock cycles
The Computer B clock must be?
Clock CyclesB 1.2 ´ Clock CyclesA
Clock RateB = =
CPU TimeB 6s
Clock CyclesA = CPU Time A ´ Clock Rate A
= 10s ´ 2GHz = 20 ´ 10 9
1.2 ´ 20 ´ 10 9 24 ´ 10 9
Clock RateB = = = 4GHz
6s 6s
29
Instruction Count and CPI
Clock Cycles = Instruction Count ´ Cycles per Instruction
CPU Time = Instruction Count ´ CPI ´ Clock Cycle Time
Instruction Count ´ CPI
=
Clock Rate
Instruction Count for a program
◦ Determined by program, ISA and Compiler
Average cycles per instruction
◦ Determined by CPU hardware
◦ If different instructions have different CPI
Average CPI affected by instruction mix
30
CPI Example
Computer A: Cycle Time = 250ps, CPI = 2.0
Computer B: Cycle Time = 500ps, CPI = 1.2
Same ISA
Which is faster, and by how much?
CPU Time = Instruction Count ´ CPI ´ Cycle Time
A A A
= I ´ 2.0 ´ 250ps = I ´ 500ps A is faster…
Sequence 1: IC = 5 Sequence 2: IC = 6
◦ Clock Cycles ◦ Clock Cycles
= 2×1 + 1×2 + 2×3 = 4×1 + 1×2 + 1×3
= 10 =9
◦ Avg. CPI = 10/5 = 2.0 ◦ Avg. CPI = 9/6 = 1.5
33
Pitfall: MIPS as a Performance Metric
MIPS: Millions of Instructions Per Second
◦ Doesn’t account for
Differences in ISAs between computers
Differences in complexity between instructions
Instructio n count
MIPS =
Execution time ´ 10 6
Instructio n count Clock rate
= =
Instructio n count ´ CPI CPI ´ 10 6
´ 10 6
Clock rate
CPI varies between programs on a given CPU
34
Performance Summary
The BIG Picture
35
Pitfall: Amdahl’s Law
Improving an aspect of a computer and
expecting a proportional improvement in
overall performance
)!""#$%#&
𝑇!"#$%&'( = !"#$%&'"'*+ ,-.+%$ + 𝑇/*-,,'.+'(
36
Understanding Program Performance
See page 39
38
Summary: Evaluating ISAs
Design-time metrics:
◦ Can it be implemented, in how long, at what cost?
◦ Can it be programmed? Ease of compilation?
Static Metrics:
◦ How many bytes does the program occupy in memory?
Dynamic Metrics:
◦ How many instructions are executed?
◦ How many bytes does the processor fetch to execute the program?
◦ How many clocks are required per instruction?
◦ How "lean" a clock is practical?
39