COMPUTER ORGANIZATION 5th
Edition
AND DESIGN
The Hardware/Software Interface
Chapter 1
Computer Abstractions and
Technology
Chapter 1 — Computer Abstractions and Technology — 2
§1.1 Introduction
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
Chapter 1 — Computer Abstractions and Technology — 3
Classes of Computers
■Personal computers
■General purpose, variety of software
■Subject to cost/performance tradeoff
■Server computers
■Network based
■High capacity, performance, reliability
■Range from small servers to building sized
Chapter 1 — Computer Abstractions and Technology — 4
Classes of Computers
■Supercomputers
■High-end scientific and engineering
calculations
■Highest capability but represent a small
fraction of the overall computer market
■Embedded computers
■Hidden as components of systems
■Stringent power/performance/cost constraints
Chapter 1 — Computer Abstractions and Technology — 5
The PostPC Era
■Personal Mobile Device (PMD)
■Battery operated
■Connects to the Internet
■Costs Hundreds of dollars
■Smart phones, tablets, electronic glasses
■Cloud computing
■Warehouse Scale Computers (WSC)
■Software as a Service (SaaS)
■Portion of software run on a PMD and a
portion run in the Cloud
■Amazon and Google
Chapter 1 — Computer Abstractions and Technology — 6
By the time you complete this book you will be able
to answer the following questions:
■ high-level language 🡪 the language of the hardware,
■ how does the hardware execute the resulting program?
■ understanding the aspects of both the hardware and software that affect
program performance.
■ The interface between software & hardware, and how does software
instruct the hardware to perform needed functions?
■ What determines the performance of a program, and how can a
programmer improve the performance?
■ What techniques can be used by hardware designers to improve
performance?
■ What techniques can be used by hardware designers to improve energy
efficiency? What can the programmer do to help or hinder energy
efficiency?
■ What are the reasons for and the consequences of the recent switch
from sequential processing to parallel processing?
Chapter 1 — Computer Abstractions and Technology — 7
§1.2 Eight Great Ideas in Computer Architecture
Eight Great Ideas
■ Design for Moore’s Law
■ Use abstraction to simplify design
■ Make the common case fast
■ Performance via parallelism
■ Performance via pipelining
■ Performance via prediction
■ Hierarchy of memories
■ Dependability via redundancy
Chapter 1 — Computer Abstractions and Technology — 8
§1.3 Below Your Program
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
Chapter 1 — Computer Abstractions and Technology — 9
Levels of Program Code
■High-level language
■Level of abstraction closer
to problem domain
■Provides for productivity
and portability
■Assembly language
■Textual representation of
instructions
■Hardware representation
■Binary digits (bits)
■Encoded instructions and
data
Chapter 1 — Computer Abstractions and Technology — 10
§1.6 Performance
Defining Performance
■Which airplane has the best performance?
Chapter 1 — Computer Abstractions and Technology — 11
Understanding Performance
■Algorithm
■Determines number of operations executed
■Programming language, compiler, architecture
■Determine number of machine instructions executed
per operation
■Processor and memory system
■Determine how fast instructions are executed
■I/O system (including OS)
■Determines how fast I/O operations are executed
Chapter 1 — Computer Abstractions and Technology — 12
Response Time and Throughput
■Response time
■How long it takes to do a task
■Throughput
■Total work done per unit time
■e.g., tasks/transactions/… per hour
■How are response time and throughput affected
by
■Replacing the processor with a faster version?
■Adding more processors?
■We’ll focus on response time for now…
Chapter 1 — Computer Abstractions and Technology — 13
Relative Performance
■Define Performance = 1/Execution Time
■“X is n times faster than Y”
■Example: time taken to run a program
■10s on A, 15s on B
■Execution TimeB / Execution TimeA
= 15s / 10s = 1.5
■So A is 1.5 times faster than B
Chapter 1 — Computer Abstractions and Technology — 14
Measuring Execution Time
■Elapsed 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
Chapter 1 — Computer Abstractions and Technology — 15
CPU Clocking
■Operation of digital hardware governed by a
constant-rate clock
Clock
period
Clock
(cycles)
Data transfer
and computation
Update state
• Clock cycle time/period (T): ■ Clock period: duration of a clock
– time for a complete clock cycle
cycle
– time between ticks
– seconds per cycle ■ e.g., 250ps = 0.25ns = 250×10–12s
• Clock rate/frequency (R): ■ Clock frequency (rate): cycles per
second
– the inverse of the clock period, i.e.,
– cycles per second T ■ e.g., 4.0GHz = 4000MHz =
R=1
4.0×109Hz
Chapter 1 — Computer Abstractions and Technology — 17
CPU Time
■Performance improved by
■Reducing number of clock cycles
■Increasing clock rate
Chapter 1 — Computer Abstractions and Technology — 18
■ Our favorite program runs in 10 seconds on computer A,
which has a 2 GHz clock. We are trying to help a
computer designer build a computer, B, which will run
this program in 6 seconds. The designer has determined
that a substantial increase in the clock rate is possible,
but this increase will affect the rest of the CPU design,
causing computer B to require 1.2 times as many clock
cycles as computer A for this program. What clock rate
should we tell the designer to target?
■ To run the program in 6 seconds, B must have twice the
clock rate of A.
Chapter 1 — Computer Abstractions and Technology — 19
CPU Time Example
■ Computer A: 2GHz clock, 10s CPU time
■ Designing Computer B
■ Aim for 6s CPU time
■ Can do faster clock, but causes 1.2 × clock cycles
■ How fast must Computer B clock be?
Chapter 1 — Computer Abstractions and Technology — 20
Instruction Count and CPI
■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
Chapter 1 — Computer Abstractions and Technology — 21
Static and Dynamic Instruction Count
■ Static instruction count is the number of instructions the
program has
■ Dynamic instruction count is the actual number of
instructions executed by the CPU for a specific program
execution
■ We usually use dynamic instruction count as if, for
example, you have a loop in your program then some
instructions get executed more than once
■ Also, in the presence of branches, some instructions may
not be executed at all
Chapter 1 — Computer Abstractions and Technology — 22
■Suppose we have two implementations of
the same instruction set architecture.
■Computer A has a clock cycle time of 250
ps and a CPI of 2.0 for some program, and
computer B has a clock cycle time of 500
ps and a CPI of 1.2 for the same program.
■Which computer is faster for this program
and by how much?
Chapter 1 — Computer Abstractions and Technology — 23
CPI Example
■Computer A: Cycle Time = 250ps, CPI = 2.0
■Computer B: Cycle Time = 500ps, CPI = 1.2
■Which is faster, and by how much?
A is faster…
…by this much
Chapter 1 — Computer Abstractions and Technology — 24
CPI in More Detail
■ Different instructions take different amounts of time
depending on what they do:
■ Multiplication takes more time than addition
■ Floating-point operations take longer than integer ones
■ Accessing memory takes more time than accessing
registers
■ Instructions can be divided into classes of similar
instructions
■ Instructions in the same class have the same Clock cycles
Per Instruction (CPI) value
Chapter 1 — Computer Abstractions and Technology — 25
CPI in More Detail (cont.)
■ Total CPU clock cycles for a certain program can be
calculated by looking at various instruction classes and
their individual CPIs
■ If different instruction classes take different numbers of
cycles
■ – CPIi is the clock cycles per instruction for class i (integer
number),
■ – Ci is the count of instructions executed from class i, and
■ – n is the number of instruction classes
Chapter 1 — Computer Abstractions and Technology — 26
CPI in More Detail
• Average CPI (CPIaverage or just CPI) for a certain program is the
average number of clock cycles each instruction takes to execute
Relative frequency
• C is the number of instructions executed by the program (known as
the
instruction count, instruction path length, or dynamic program size)
• let the fraction of occurrence (relative frequency) of an
instruction class in a program be
• Thus, CPI depends on the instruction mix (the dynamic
frequency of instructions across the program)
Chapter 1 — Computer Abstractions and Technology — 27
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
Chapter 1 — Computer Abstractions and Technology — 28
Instructions Per Clock Cycle
■ CPI provides one way of comparing two different
implementations of the same ISA, since the number of
instructions executed for a program will be the same
■ Although we might expect that the minimum CPI is 1.0,
some processors fetch and execute multiple instructions
per clock cycle (e.g., multicore microprocessors as will
be shown later)
■ We could invert CPI to talk about IPC, or instructions
per clock cycle
Chapter 1 — Computer Abstractions and Technology — 29
The CPU Performance Equation
Chapter 1 — Computer Abstractions and Technology — 30
Performance Summary
The BIG
Picture
Chapter 1 — Computer Abstractions and Technology — 31
§1.9 Concluding Remarks
Concluding Remarks
■Cost/performance is improving
■Due to underlying technology development
■Hierarchical layers of abstraction
■In both hardware and software
■Instruction set architecture
■The hardware/software interface
■Execution time: the best performance
measure
Chapter 1 — Computer Abstractions and Technology — 32