Sei sulla pagina 1di 30

Computer Architecture

Basic Structure of Computers Machine instructions and their execution System software that enables the preparation and execution of programs Performance issues in the computer.

Functional Units

A computer consists of five functionally independent main parts:

Input Memory Arithmetic and Logic Output Control unit

Two types of information are handled by a computer: instructions and data.

Instructions are commands that:

Govern the transfer of information within a computer as well as between the computer and its I/O devices Specify the arithmetic and logic operations to be performed.

Data are numbers and encoded characters that are used as operands by the instructions.

Input

Output

I/O

Memory

Basic functional units of a computer

Arithmetic and logic

Control

Processor

n bits First Word Second Word . . . i-th Word . . Last Word
n bits
First Word
Second Word
.
.
.
i-th Word
.
.
Last Word

Memory Words

32 bits

32 bits

32 bits

b31

b30

.

.

.

b1

b0

32 bits b31 b30 . . . b1 b0 Sign bit : b31=0 for positive numbers

Sign bit : b31=0 for positive numbers b31=1 for negative numbers (a) A signed integer

8 bits

8 bits

8 bits

8 bits

ASCII ASCII ASCII ASCII
ASCII
ASCII
ASCII
ASCII

character

character

character

character

(b) Four Characters

Examples of encoded information in a 32-bit word

Basic Operational Concepts

The activity in a computer is governed by instructions. To perform a given task, a program consisting of a list of instructions is stored in the memory. Individual instructions are brought from the memory into the processor, which executes the specified operations. Data to be used as operands are also stored in the memory. A typical instruction may be

Add

LOCA, R0

This instruction adds the operand at memory location LOCA to the operand

in a register in the processor, R0 and places the sum into register R0.

The instruction register (IR) holds the instruction that is currently being executed.

The program counter (PC) keeps track of the execution of the program.

The MAR holds the address of the location to be accessed. The MDR contains the data to be written into or read out of the addressed location.

Memory

Memory MAR PC IR MDR R 0 R 1 R 2 ` . . . R

MAR

PC

IR

MDR

R

0

R

1

R

2

`

.

.

.

R n-1

n general purpose registers

Control

ALU

Processor

. R n-1 n general purpose registers Control ALU Processor Connection between the processor and the

Connection between the processor and the memory

Bus Structures

To form an operational system, these parts must be connected in some organized way. The simplest way to interconnect functional units is to use a single bus. All units are connected to this bus. Only two units can actively use the bus at any given time. Bus controls lines are used to to arbitrate multiple requests for use of the bus.

The devices connected to a bus vary widely in their speed of operation. Memory and processor units operate at faster speeds. Because all these devices must communicate with each other over a bus, an efficient transfer mechanism is necessary.

Input Output Memory Processor
Input
Output
Memory
Processor

Single-bus structure

Software

In order for a user to enter and run an application program, the computer must contain some system software. System software is a collection of programs that are executed as needed to perform functions such as:

Receiving and interpreting user commands Entering and editing application programs and storing them as files in secondary storage devices. Managing the storage and retrieval of files in secondary storage devices. Running standard application programs such as word processors, spreadsheets, or games. Controlling I/O units to receive input information and produce output results. Translating programs from source into object form Linking and running user-written application programs with existing standard library routines.

System software is thus responsible for the coordination of all activities in a computing system.

Printer Disk OS routine Program t 0 t 1 t 2 t 3 t 4
Printer
Disk
OS
routine
Program
t 0
t 1
t 2
t 3
t 4
t 5
User Program and OS routine sharing of the processor
Time

Performance

The most important measure of the performance of a computer is how quickly it can execute programs.

For best performance it is necessary to design the compiler, the machine instruction set, and the hardware in a coordinated way.

Just as the elapsed time for the execution of a program depends on all units in a computer system, the processor time depends on the hardware involved in the execution of individual machine instructions. This hardware comprises the processor and the memory, which are connected by a bus.

The processor and a relatively small cache memory can be fabricated on a single integrated circuit chip. With this logic basic steps of instruction processing is very high.

Main

Memory

Cache

memory

Processor

Bus
Bus

The processor cache

Performance Parameters

Processor Clock – The length P of one clock cycle affects the processor performance. The clock rate R = 1/P

Basic Performance Equation – The program execution time is given by T = (N * S)/R N = machine language instructions, S = number of basic steps to execute one machine instruction.

Pipelining and Superscaler operation – increases the rate of executing Instructions.

Clock rate – IC technology to increase value of R, reduce P.

Instruction Set - CISC and RISC based designs. Compiler - To make good use of instruction set, optimizing compiler.

Performance Measurement

The computer community adopted the idea of measuring computer performance using benchmark programs. To make comparisons possible, standardized programs must be used. The performance measure is the time it takes a computer to execute a given benchmark.

A non-profit organization called System Performance Evaluation Corporation (SPEC) selects and publishes the benchmark programs.

Running time on the reference computer SPEC rating = -------------------------------------------------------- Running time on the computer under test

The SPEC rating is a measure of the combined effect of all factors affecting performance, including the compiler, the operating system, the processor and the memory of the computer.

Multiprocessors and Multicomputers

Large computer systems may contain a number of processors units, called multiprocessor systems.

It is possible to use an interconnected group of complete computers. Executing tasks communicate by passing messages through interconnection network.

The Memory System

Basic memory circuits Organization of main memory Cache memory concept, which shortens the effective memory access time Virtual memory mechanism, which increases the apparent size of the main memory. Magnetic disks, optical disks, and magnetic tapes used for secondary storage.

Processor

MAR

MDR

Memory

Up to 2 k addressable locations

Word length = n bits

k-bit address bus

n-bit data bus
n-bit
data bus

Control lines

(R/W, MFC, etc.)

Connection of the memory to the processor.

Static RAM (SRAM)

Memories that consist of circuits capable of retaining their state as long as power is applied are known as static memories.

Static RAMs are fast, but they are costly.

Dynamic RAM (DRAM)

Dynamic memory cell retains the information for only few milliseconds. So the contents must be periodically refreshed by restoring the charge.

Synchronous DRAM

DRAMs whose operation is directly synchronized with a clock signal, are called synchronous DRAMs (SDRAMs).

Double Data Rate SDRAM

The data transfer is done at both edges of the clock, the bandwidth is doubled for long burst transfers.

Read-Only Memories

Both SRAM and DRAM chips are volatile, which means that they lose the stored information if power is turned off. Nonvolatile memory that holds the instructions which is used in loading the boot program from the disk., a memory of this type is called read-only memory (ROM).

ROM PROM EPROM EEPROM FLASH Memory

Speed, Size, Cost

A huge amount of cost-effective storage can be provided by magnetic Disks. A large, yet affordable main memory can be built with dynamic RAM technology. The SRAMs can be used in smaller units, such as cache memories.

All of these different types of memory units are employed effectively in a computer.

Increasing

size

Increasing size Memory hierarchy Processor Processor Registers Primary Cache L1 Secondary Cache L2 Main memory

Memory hierarchy

ProcessorProcessor

Registers

Primary

Cache

L1

Secondary

Cache

L2

Main

memory

Magnetic disk Secondary memory

Increasing

speed

Cache L1 Secondary Cache L2 Main memory Magnetic disk Secondary memory Increasing speed Increasing cost per

Increasing cost per bit

Cache L1 Secondary Cache L2 Main memory Magnetic disk Secondary memory Increasing speed Increasing cost per

Cache Memories

The speed of the main memory is very low in comparison with the speed of processors. For good performance, the processor cannot spend much of its time waiting to access instructions and data in main memory. An efficient solution is to use a fast cache memory which essentially makes the main memory appear to the processor to be faster than really is.

Processor Cache
Processor Cache

Processor

Processor Cache
Processor Cache
Processor Cache
Processor Cache
Processor Cache
Processor Cache
Processor Cache

Cache

Processor Cache

Main

memory

Processor Cache Main memory Use of a cache memory

Use of a cache memory

Virtual Memories

Techniques that automatically move program and data blocks into the physical main memory when they are required for execution are called virtual memory technique. The binary addresses that processor issues for either instructions or data are called virtual or logical addresses. These logical addresses are translated physical addresses by a combination of hardware and software components.

Processor

Data

Processor Data Virtual address MMU Physical address Cache D a t a Physical address Main memory

Virtual addressProcessor Data MMU Physical address Cache D a t a Physical address Main memory DMA transfer

MMU

Physical addressProcessor Data Virtual address MMU Cache D a t a Physical address Main memory DMA transfer

Cache

Data

Physical address

Main memory

DMA transfer

Dist storage

Virtual memory organization

Address Translation

A

simple method for translating virtual addresses into physical addresses

is

to assume that all programs and data are composed of fixed length units

called pages. Each virtual address generated by the processor, is interpreted as a virtual page number followed by an offset that specifies the location of a particular word with in a page. Information about the main memory location of each page is kept in a page table. An area in the main memory that can hold one page is called a page frame. The starting address of the page table is kept in a page table base register.

Page table base register Virtual address from processor Page table address Virtual page number Offset
Page table base
register
Virtual address from processor
Page table address
Virtual page number
Offset
+
PAGE TABLE
.
.
.
.
.
Page frame
Offset
.
Control
bits
Page frame
In memory
Physical address in main
memory

Virtual-memory address translation

Secondary Storage

Large storage requirements of most computer systems are economically realized in the form of magnetic disks, optical disks, and magnetic tapes which are usually referred as secondary storage devices.

The virtual memory mechanism makes interaction between the disk and the main memory transparent to the user.