Chapter 1

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 38

Chapter

one
Introduction Computer Basics and computer
performance

Contents
Computer Architecture
Computer organization
Structure Vs Function
CPU Structure
 Computer evolution
Computer Performance
Introduction
The term computer is derived from the word
compute. The word compute means to calculate.
A computer is an electronic machine that accepts
data from the user, processes the data by
performing calculations and operations on it, and
generates the desired output results.
Computer performs both simple and complex
operations, with speed and accuracy.
Architecture vs Organization
Computer Architecture
Computer Architecture refers to those attributes of
a system that have a direct impact on the logical
execution of a program.
 is a functional description of requirements and
design implementation for the various parts of a
computer.
It deals with the functional behavior of computer
systems. It comes before the computer organization
while designing a computer.
Architecture describes what the
computer does.
The architecture of a CPU is actually its
The instruction set
Architecture vs Organization
Computer Organization
Computer Organization refers to the operational
units and their interconnections that realize the
architectural specifications.
Comes after the decision of Computer Architecture.
It is how operational attributes are linked together
and contribute to realizing the architectural
specification and deals with a structural relationship.
Organization describes how Computer
does.
Examples:
 Control signals
 Interfaces between computer and peripherals
 The memory technology being used
Example
 Take two different models from a same vendor like
Intel are brought to analyze.
 Both the models(lap top and desk top) have same
processor like core 3 .
 That means both models understand the same
instruction set as you know each processor
understands a fixed no of instructions. Hence their
architecture is same.
Due to the placement of various hardware components,
one model (laptop) is slim and other is bulky. Hence
their organization is different
 A core, or CPU core, is the "brain" of a CPU. It receives instructions, and
performs calculations, or operations, to satisfy those instructions. A CPU can
have multiple cores.
 A processor with two cores is called a dual-core processor; with four cores, a
quad-core; six cores, hexa-core; eight cores, octa-core. As of 2019, most
consumer CPUs feature between two and twelve cores. Workstation and server
CPUs may feature as many as 48 cores.
 Each CPU core can perform operations separately from the others. Multiple
cores may also work together to perform parallel operations on a shared set of
data in the CPU's memory cache.
Structure vs Function
Modern computers contain millions of electronic
components
The key to describing such systems is to recognize their
hierarchical nature
 They are a set of layers or levels of interrelated
subsystems
 Each level consists of a set of components and their
inter-relationships
The behavior of each level depends only on a simplified,
abstracted characterization of the system at the next
lower level
At each level, the designer is concerned with:
 Structure: The way in which the components are
interrelated
 Function: The operation of each individual component
as part of the structure.
Structure vs Function
Function
A functional view of the computer
Basic functions that a computer can perform:
Data processing: Computer must be able to process
data which may take a wide variety of forms and the
range of processing.
• Data storage: Computer stores data either
temporarily or permanently.
• Data movement: Computer must be able to move
data between itself and the outside world.
• Control: There must be a control of the above three
functions by instructions provided by the user of the
computer (i.e. their programs)
• Input/output - when data are received from or
delivered to a peripheral, a device connected directly
Structure vs Function
Structure
Simplest possible view of a computer:
 Storage
 Processing
 Peripherals
 Communication Lines
Structure vs Function
Functional view of a computer
Storage Operation
Data movement operation

Processing from / to storage Processing from storage to i/o


Structure vs Function
Internal Structure of the Computer Itself:
 Central Processing Unit (CPU)
 Main Memory
 I/O

 System Interconnection: Some mechanism that


provides for communication among CPU, main memory,
and I/O.
CPU structural components:
• Control unit
• Arithmetic and logic unit (ALU)
• Registers
• CPU interconnections
Top level computer structure
Computer

Peripherals

Main Memory
Input/Output

Computer System Bus

Communication Lines Central Processing Unit


(CPU)
CPU structure
Main Structural components of the CPU
Control Unit: Controls the operation of the CPU and a computer does not do any

actual processing of data with out CU. CU organizes the processing of data and

instructions.

It acts as a supervisor, controls and coordinates the activity of the other units of

computer.

CU tells when to fetch the data and instructions, what to do, where to store the

results, the sequencing of events during processing

It directs the computer to carry out stored program instructions by communicating

with the ALU and the registers.

Arithmetic and Logic Unit (ALU): Performs the computer's data processing

functions. ALU consists of two units arithmetic unit and logic unit.

 The arithmetic unit performs arithmetic operations on the data that is made

available to it. Some of the arithmetic operations supported by the arithmetic

unit are addition, subtraction, multiplication and division.


Cont.….
 The logic unit of ALU is responsible for performing
logic operations. Logic unit performs comparisons of
numbers, letters and special characters.
 Logic operations include testing for greater than, less
than or equal to condition.
 Registers: store data, instructions, addresses and
intermediate results of processing. Registers are often
referred to as the CPU’s working memory.
 Values to be processed
 Address of value to be fetched from memory
 Can be 8-, 16-, 32-, or 64-bit
 CPU Interconnection: a mechanism that provides for
communication among the control unit, ALU, and
registers.
Common Bus system
The CPU is connected to memory and I/O through
strips of wire called a bus and it Carries information
from place to place.

is a communication system that transfers data


between components inside a computer, or between
computers
System Bus
An address bus: this determines the location in
memory that the processor will read data from or
write data to.
For a device (memory or I/O) to be recognized by the CPU, it must be
assigned an address
The address assigned to a given device must be unique
The CPU puts the address on the address bus and the decoding circuitry finds the
device

A data bus: Provides read or write signals to the device to indicate if the
CPU is asking for information or sending it information.
this contains the contents that have been read from the memory location or are to be
Cont.…
A control bus: this manages the information flow between components
indicating whether the operation is a read or a write and ensuring that the
operation happens at the right time
Example: A CPU has registers A, B, C, and D and it has an 8-bit data
bus and a 16-bit address bus. The CPU can access memory from
addresses 0000 to FFFFH
Assume that the code for the CPU to move a value to register A is B0H
and the code for adding a value to register A is 04H. The action to be
performed by the CPU is to put 21H into register A, and then add to
register A values 42H and 12H

Action Code Data


Move value 21H into reg. A B0H 21H
Add value 42H to reg. A 04H 42H
Add value 12H to reg. A 04H 12H
Cont… Action Code Data
Mem. addr. Contents of memory address
1400 (B0) code for moving a value to register
A 1401 (21) value to be moved
1402 (04) code for adding a value to register
A
1403 (42) value to be added
1404 (04) code for adding a value to register
A
1405 (12) value to be added
1406 (F4) code for halt
The actions performed by CPU are as follows:
The program counter is set to the value 1400H, indicating the address of
the first instruction code to be executed
The CPU puts 1400H on address bus and sends it out. The memory circuitry
finds the location. The CPU activates the READ signal, indicating to
memory that it wants the byte at location 1400H
This causes the contents of memory location 1400H, which is B0, to be put
on the data bus and brought into the CPU
Cont…
The CPU decodes the instruction BO.
The CPU commands its controller circuitry to bring into register A of the
CPU the byte in the next memory location. The value 21H goes into register.
A The program counter points to the address of the next instruction to be
executed, which is 1402H. Address 1402 is sent out on the address bus to
fetch the next instruction

From memory location 1402H it fetches code 04H.


After decoding, the CPU knows that it must add to the contents of register. A
the byte sitting at the next address (1403)

After the CPU brings the value (42H), it provides the contents of register A
along with this value to the ALU to perform the addition.
It then takes the result of the addition from the ALU’s output and puts it in
register A
ƒThe program counter becomes 1404, the address of the next instruction
Address 1404H is put on the address bus and the code is fetched into the CPU, decoded, and
executed. This code is again adding a value to register A. The program counter is updated to
1406H

The contents of address 1406 are fetched in and executed. This HALT instruction tells the CPU
to stop incrementing the program counter and asking for the next instruction
CPU and GPU
GPU companies CPU companies

•AMD
•AMD
•ARM Holdings
•Apple
•Imagination Technol
•ARM Holdings
ogies
•Microchip Technolog •ASRock
y •Centaur Technology
•NVIDIA •Gumstix
•SAPPHIRE •Intel
•Vivante •VIA
•ZiiLABS
Computer Evolution
Generations of computer
The evolution of computers to their present state is divided into five
generations of computers, based on the hardware and software they use,
their physical appearance and their computing characteristics.
o First generation (1940 to 1956): Using vacuum tubes

o Second generation (1956 to 1963): Using transistors

o Third generation (1964 to 1971): Using integrated circuits

o Fourth generation (1971 to present): Using microprocessors

O Fifth generation (present and next): Using artificial intelligence


Computer classifications
The digital computers that are available nowadays vary in their sizes and
types. The computers are broadly classified into four categories based on
their size and type
(1) Microcomputers : are small, low-cost and single-user digital computer. They consist of CPU,
input unit, output unit, storage unit and the software
(2) Minicomputers : They have high processing speed and high storage capacity than the
microcomputers. Minicomputers can support 4–200 users simultaneously.
(3) Mainframe computers : they operate at a very high speed, have very large storage capacity
and can handle the workload of many users.
(4) Supercomputer : They have high processing speed compared to other computers. The speed
of a supercomputer is generally measured in FLOPS (Floating point Operations Per Second).
Computer performance
Performance is one of the most important criteria

in judging systems.
There are two main measurements of performance.

Execution time: Time to complete a particular task


and Important for users

Throughput: Amount of work completed in unit time


and is important for servers and operating systems.
Our main performance equation explains how

performance depends on several factors related to


both hardware and software.
Computer performance
The algorithm determines both the number of source-level
statements and the number of I/O operations executed.
The programming language, compiler and architecture
determines the number of machine instructions executed per
each source-level statement
The processor and memory system determines how fast
instructions are executed.
The I/O system (hardware and operating system) determines
how fast I/O operations are executed
Measuring Performance
In order to compare how fast computers can process data, we
have to measure their performance.
These are a number of measurements of performance.
 Clock speed
 MIPS
 FLOPS
 Amdahl’s Law (reading assignment)
Computer performance
Clock Speed
Our CPU processes many instructions from different programs
every second. Some of these instructions involve simple
arithmetic, while others are more complicated.
The clock speed measures the number of cycles our CPU
executes per second, measured in GHz (gigahertz).
A cycle is the basic unit that measures a CPU’s speed. During
each cycle, billions of transistors within the processor open and
close . This is how the CPU executes the calculations contained
in the instructions it receives.
A CPU with a clock speed of 3.2 GHz executes 3.2 billion
cycles per second.
Computer performance
The system clock operations performed by a processor,
such as
 Fetching an instruction,
 Decoding the instruction
 Performing an arithmetic operation, and so on, are
governed by a system clock
The rate of pulses is known as the clock rate, or clock
speed.
One single pulse , of the clock is referred to as a clock
cycle.
The time between pulses is the cycle time.
The clock signal is carried by one of the lines on the
control bus.
Measured in Megahertz (MHz) & Gigahertz (GHz).
1 MHz = 1 million pulses per second.
Computer performance
Instruction execution rate: A processor is driven
by a clock with a constant frequency f or,
equivalently, a constant cycle time t, where t=1/f .
 Instruction count, Ic for a program as the number
of machine instructions executed for that program
until it runs to completion or for some defined
time interval.
 This is the number of instruction executions, not
the number of instructions in the object code of
the program.
Three Components of CPU
Performance
 Instructions executed
 Cycles Per Instruction
 Clock cycle time
Instructions executed:
Instead of knowing the static instruction
count, or how many lines of code are in a
program.
we care about the dynamic instruction
count, or how many instructions are
Computer performance
Clock cycle time
One cycle is the minimum time it takes the CPU
to do any work.
 The clock cycle time or clock period is just
the length of a cycle.
 The clock rate, or frequency, is the
reciprocal of the cycle time.
Some examples illustrate some typical
frequencies.
 A 500MHz processor has a cycle time of 2ns.
 A 2GHz (2000MHz) CPU has a cycle time of
Computer Performance
CPI(Cycle Per instruction)
An important parameter is the average
cycles per instruction (CPI) for a program.
The average number of CPI, is a function of
the machine and program.
The CPI depends on the actual instructions
appearing in the program. It also depends
on the CPU implementation.
Computer Performance
It is common to each instruction took
one cycle, making CPI = 1.
The CPI can be >1 due to memory
stalls and slow instructions.
The CPI can be <1 on machines that
execute more than 1 instruction per
cycle.
Computer performance
If all instructions required the same
number of clock
cycles, then CPI would be a constant value
for a processor. However, on any given
processor, the number of clock cycles
required varies for different types of
instructions, such as
Load
 Store
 Branch and so on.
Computer performance
Let CPIi be the number of cycles required for

instruction type i. and Ii be the number of executed


instructions of type i

for a given program. Then we can calculate an


overall CPI as follows:

CPU time=ICxCPIxCT= ICxCPI/f


Computer performance
MIPS
Refers to the millions of instructions
per second executed by a computer's
processor.
A common measure of performance for
a processor is the rate at which
instructions are executed, expressed as
MIPS. or MIPS rate.
We can express the MIPS rate in terms
of the clock rate and CPI as follows:
Computer performance

Where
T=the processor time
f=clock rate/ frequency
FLOPS
Stands for ‘Floating Point Operations Per
Second.
These are common in many scientific and
game applications.
It can be defined as follows:
Example 1
Find the performance of each processors in terms of instruction per
second for the given table
Processors Clock rate CPI
(GHz)
P1 3 1.5
P2 2.4 1
P3
Given 4 2.2
Clock rate=cycle/second find: instruction/second
CPI=cycle/instruction I/S=C/S*1/CPI
P1= 3 x =2x
P2=2.4xx1 =2.4x
P3= 4xx ½.2 =1.82x
Find #cycles and # instructions if each processors executed a
program in 10 seconds and I/S is calculated as above
Exercise
We want to compare the computers R1 and R2, which differ that R1 has the machine instructions
for the floating point operations, while R2 has not (FP operations are implemented in the
software using several non-FP instructions). Both computers have a clock frequency of 400 MHz.
In both we perform the same program, which has the following mixture of commands:
Instruction duration (Number of
Dynamic Share of
clock periods CPIi)
Instruction Type instructions in
program (pi)
R1 R2
FP addition 16% 6 20
FP
10% 8 32
multiplication
FP division 8% 10 66
Non - FP
66% 3 3
instructions

a) Calculate the MIPS for the computers R1 and R2.


b) Calculate the CPU program execution time on the computers R1 and R2, if there are 12000
instructions in the program?

You might also like