0% found this document useful (0 votes)
14 views

Chapter - 01 - Computer Abstractions

Uploaded by

oxagys
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Chapter - 01 - Computer Abstractions

Uploaded by

oxagys
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 37

Chapter 1

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

Source: Raphael Poss

So, why study computer architecture? The answer is, to


understand the:
— Hardware performance
— Software Hardware interface
— Temporal & Spatial behavior of software and data
2
Perspectives
The book is written from two perspectives:
• Software focus
• Hardware focus

Hence the subtitle of the book!


The Software / Hardware interface

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

About drawing standards

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

— Use abstraction to simplify design

— Make the common case fast; Amdahl’s law*

— Performance via parallelism

— Performance via pipelining

— Performance via prediction

— Hierarchy of memories

— Dependability via redundancy

* 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

— As a result, very little programming is done today at


the assembler level
13
Levels of Program Code
— High-level language
◦ Level of abstraction closer
to problem domain one-to-many
◦ Provides for productivity
and portability
— Assembly language
◦ Textual representation of
instructions
— Hardware representation one-to-one

◦ Binary digits (bits)


◦ Encoded instructions and
data
See also hands-on: SIM-PL
14
Components of a Computer
The BIG Picture
— Same components for
all kinds of computers
◦ Desktop, server, embedded
— Input/output includes
◦ User-interface devices
– Display, keyboard, mouse
◦ Storage devices
– Hard disk, CD/DVD, flash
◦ Network adapters
– For communicating with other computers

⇒ Abstraction and building blocks!


15
What is an ISA?
— ISA (instruction set architecture)
◦ A well-defined hardware/software interface
◦ The ‘contract’ between software and hardware
– Functional definition of operations, modes, and storage
locations supported by the hardware
– Precise description of how to invoke, and access them

◦ 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

— Abstraction helps us deal with complexity


◦ Hide lower-level detail
— Instruction set architecture (ISA)
◦ The hardware/software interface
— Application binary interface
◦ The ISA plus system software interface
— Implementation
◦ The details underlying an interface

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

— I/O system (including OS)


◦ Determines how fast I/O operations are executed

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

— Clock period: duration of a clock cycle


◦ e.g., 250ps = 0.25ns = 250×10–12 s
— Clock frequency (rate): cycles per second
◦ e.g., 4.0GHz = 4000MHz = 4.0×109 Hz

26
Algorithm Execution Process

Source: Manoj Franklin 2007

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…

CPU Time = Instruction Count ´ CPI ´ Cycle Time


B B B
= I ´ 1.2 ´ 500ps = I ´ 600ps
CPU Time
B = I ´ 600ps = 1.2
…by this much
CPU Time I ´ 500ps
A
31
CPI in More Detail
— Computing the overall effective CPI is done by looking
at the different instruction classes and their individual
cycle counts and averaging
n
Clock Cycles = å (CPIi ´ Instruction Count i )
i=1

— Where ICi is the count (percentage) of the number of instructions


of class i executed
— CPIi is the (average) number of clock cycles per instruction for that
instruction class
— n is the number of instruction classes
Relative frequency
Weighted average CPI
Clock Cycles n
æ CPIi ´ Instruction Count i ö
CPI = = åç ÷
Instruction Count i=1 è Instruction Count ø
32
CPI Example
— Alternative compiled code sequences
using instructions in classes A, B, C
Class A B C
CPI for class 1 2 3
IC in sequence 1 2 1 2
IC in sequence 2 4 1 1

— 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

Instructions Clock cycles Seconds


CPU Time = ´ ´
Program Instruction Clock cycle
— Performance depends on
◦ Algorithm affects:
– IC, possibly CPI
◦ Programming language affects:
– IC, CPI
◦ Compiler affects:
– IC, CPI
◦ Instruction set architecture affects:
– IC, CPI, Tc

35
Pitfall: Amdahl’s Law
— Improving an aspect of a computer and
expecting a proportional improvement in
overall performance
)!""#$%#&
𝑇!"#$%&'( = !"#$%&'"'*+ ,-.+%$ + 𝑇/*-,,'.+'(

— Example: multiply accounts for 80 s per100 s


◦ How much improvement in multiply performance to
get 5× overall?
100 80
= + 20 — Can’t be done!
5 𝑛
— Corollary: make the common case fast

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?

— Best Metric: Time to execute the program!


CPI
— Depends on:
◦ the instructions set
◦ the processor organization
IC Cycle Time
◦ compilation techniques

39

You might also like