MODULE-1 (A) - Basic-Structure-of-Computers
MODULE-1 (A) - Basic-Structure-of-Computers
and
Architecture
Carl Hamacher, Zvonko Vranesic, Safwat
Zaky,
Computer Organization, 5th
Edition,
Tata McGraw Hill, 2002.
1
Module-1
Basic Structure of Computers
2
Computer Types
A digital computer, or simply, a computer is
a fast electronic calculating machine
that accepts digitized input
information, processes it according to a
list of internally stored instructions,
and produces the resulting output
information.
The list of instructions is called a
entertainment, interpersonal
Computer Types..
A number of classifications are used for personal
computers.
Desktop computers serve general needs and fit
within a typical personal workspace.
Workstation computers offer higher computational
capacity and more powerful graphical display
capabilities for engineering and scientific work.
Portable and Notebook computers provide the basic
features of a personal computer in a smaller
lightweight package.
They can operate on batteries to provide mobility.
6
7
Computer Types..
Servers and Enterprise systems are large
computers that are meant to be shared
by a potentially large number of users
who access them from some form of
personal computer over a public or
private network.
Such computers may host large
databases and provide information
processing for a government agency
or a commercial organization. 8
9
Computer Types..
Supercomputers and Grid computers
normally offer the highest
performance.
They are the most expensive and
physically the largest category of
computers.
are used for the highly
Supercomputers
work. 0
1
1
Computer Types..
Grid computers provide a more cost-
effective alternative.
They combine a large number of personal
computers and disk storage units in a
physically distributed high-speed network,
called a grid, which is managed as a
coordinated computing resource.
By evenly distributing the computational
workload across the grid, it is possible to
achieve high performance on large
applications ranging from numerical
computation to information searching.
12
13
Computer Types..
Embedded computers are integrated into
a larger device or system in order to
automatically monitor and control a
physical process or environment.
They are used for a specific purpose
18
Functional Units
Arithmetic
Input and
logic
Memory
Output Control
I/O Processor
on
Data
22
Information handled by a
computer..
Instructions,or machine instructions,
are explicit 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
23
Information handled by a
computer..
A program is a list of instructions
which performs a task.
Programs are stored in the memory.
The processor fetches the program
instructions from the memory, one after
another, and performs the desired
operations.
The computer is controlled by the stored
program, except for possible external
interruption by an operator or by I/O
devices connected to it. 24
Information handled by a
computer..
Dataare numbers and characters
that are used as operands by the
instructions.
Data are also stored in the memory.
25
Information handled by a
computer..
The information handled by a
computer must be encoded in a
suitable format.
Most present-day hardware employs
keyboard.
Whenever a key is pressed, the
corresponding letter or digit is automatically
translated into its corresponding binary code
and transmitted to the processor.
Other kinds of input devices – mouse,
joystick, trackball, touchpad,
microphone, camera. 27
Memory Unit
The function of the memory unit is to
store programs and data.
There are two classes of storage
Primary
Secondary
28
Memory Unit..
Primary memory, also called main memory, is a fast
memory that operates at electronic speeds.
Programs must be stored in this memory while they
are being executed.
It consists of a large number of semiconductor
storage
cells, each capable of storing one bit of
information.
They are handled in groups of fixed size called words.
One word can be stored or retrieved in one basic
operation.
The number of bits in each word is referred to as the
word length 29
of the computer, typically 16, 32, or 64 bits.
Memory Unit..
To provide easy access to any word in
the memory, a distinct address is
associated with each word location.
Addresses are consecutive numbers,
cache.
Tightly coupled with the processor
Contained on the same chip to
achieve high performance
Largest and slowest unit is referred 32
Memory Unit..
Although primary memory is
essential, it tends to be expensive
and does not retain information
when power is turned off.
33
Memory Unit..
Secondary storage is used when large
amounts of data and many programs
have to be stored.
Particularly for information that is
accessed in frequently.
Access times for secondary
storage are longer than for
primary memory.
Examples - magnetic disks, optical
disks 34
Arithmetic and Logic Unit
(ALU)
Most computer operations are
executed in ALU of the processor.
Any arithmetic or logic operation, such
as addition, subtraction,
multiplication, division, or comparison
of numbers, is initiated by bringing
the required operands into the
processor, where the operation is
performed by the ALU.
35
Arithmetic and Logic Unit
(ALU)..
For example, if two numbers located in the
memory are to be added, they are brought into
the processor, and the addition is carried out by
the ALU.
The sum may then be stored in the memory or retained
in the
processor for immediate use.
When operands are brought into the processor,
they are stored in high-speed storage elements
called registers.
Each register can store one word of data.
Access times to registers are even shorter than access
times to the cache unit on the processor chip. 36
Output Unit
It sends processed results to the outside world.
Example – printer
Most printers employ either photocopying techniques,
as in laser printers, or ink jet streams. Such printers
may generate output at speeds of 20 or more pages
per minute.
Some units, such as graphic displays, provide
both an output function, showing text and
graphics, and an input function, through
touchscreen capability.
The dual role of such units is the reason for using
the single name input/output (I/O) unit in many
cases. 37
Control Unit
The memory, arithmetic and logic,
and I/O units store and process
information and perform input and
output operations.
The control unit coordinates the
operation of different units in the
computer.
The control unit is effectively the nerve
4
0
Summary
The operation of a computer can be summarized as
follows:
The computer accepts information in the form of
control
uni 4
1
t.
Basic Operational
Concepts
42
Review
The activity in a computer is
governed by instructions.
To perform a given task, an appropriate
LOCA, R1 Add
R1, R0
The first instruction transfers the
MAR MDR
Control
PC R0
R1
Processor
IR
ALU
R
n- 1
n general purpose
registers
4
Figure 1.2. Connections between the processor and the memory. 7
Registers
Instruction register (IR)
Hold the instruction that is currently being executed
Program counter (PC)
Keeps track of the execution of a program
It contains the address of the next instruction to be
fetched and executed
General-purpose register (R0 – Rn-1)
Memory address register (MAR)
Holds the address of the memory location to be
accessed
Memory data register (MDR)
Contains the data to be written into or read out of the 48
addressed
Typical Operating Steps
Programs reside in the memory through
input devices
PC is set to point to the first instruction
The contents of PC are transferred to
MAR
A Read control signal is sent to the
memory
The first instruction is read out and
loaded into MDR
The contents of MDR are transferred
49
to IR
Typical Operating Steps..
Get operands for ALU
General-purpose register
Memory (address to MAR – Read – MDR to
ALU)
Perform operation in ALU
Store the result back
To general-purpose register
To memory (address to MAR, result to MDR –
Write)
Duringthe execution, PC is
incremented to the next
5
0
Typical Operating Steps..
In addition to transferring data
between the memory and the
processor, the computer accepts
data from input devices and sends
data to output devices.
Thus, some machine instructions
5
1
Interrupt
Normal execution of programs may be
preempted if
some device requires urgent servicing.
The device raises an interrupt signal.
An interrupt is a request from an I/O device for
service by the processor.
The processor provides the requested
service by executing an appropriate
Interrupt-service routine.
May alter the internal state of the processor
Its state must be saved before servicing the
interrupt
5
The contents
so that the programofmayPC, general-purpose
continue from where it was 2
Example
List the steps needed to execute the
machine instruction
Add LOCA,R0
in terms of transfers between the
components shown in Figure 1.2 and
some simple control commands.
Assume that the instruction itself is
stored in the memory at location
INSTR and that this address is initially
in register PC. 53
Example
Transfer the contents of register PC to
register MAR
Issue a Read command to memory, and
IR and decode it
Transfer the address LOCA from IR to
MAR
Issue a Read command and wait until
54
MDR is loaded
Example
Transfer contents of MDR to the ALU
Transfer contents of R0 to the ALU
55
Example
List the steps needed to execute the
machine instruction
Add R1,R2,R3
in terms of transfers between the
components shown in Figure 1.2 and
some simple control commands.
Assume that the instruction itself is
stored in the memory at location
INSTR and that this address is initially
in register PC. 56
Example
Transfer the contents of register PC to
register MAR
Issue a Read command to memory, and
IR and decode it
Transfer contents of R1 and R2 to the
ALU
Perform addition of two operands in 5
7
58
Bus Structures
There are many ways to connect
different parts inside a computer
together.
When a word of data is transferred
bus
6
0
Bus Structures..
The main virtue of the single-bus
structure is its low cost and its
flexibility for attaching peripheral
devices.
Systems that contain multiple buses
at an increased cost. 1
Speed Issue
Different devices have different transfer/operating
speed.
Some electromechanical devices, such as
keyboards and printers, are relatively slow
Magnetic or optical disks are considerably faster
Memory and processor units operate at electronic
speeds -
fastest
If the speed of bus is bounded by the slowest
device connected to it, the efficiency will be
very low.
How to solve this?
I/O
A common approach – use buffer registers 6
2
devices.
Hold the information during transfers
Software
System software is a collection of
programs that are executed as
needed to perform functions:
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
data standard
supplied by theapplication programs6
3
Software..
Controlling I/O units to receive input
information and produce output results
Translating programs from source form
prepared by the user into object form
consisting of machine instructions
Linking and running user-written
application programs with existing
standard library routines, such as
numerical computation packages
64
Software..
System software is responsible for the
coordination of all
activities in a computing system.
Application programs are usually written in a
high-level programming language, such as C,
C++, Java, or Fortran
Independent of the particular computer used to
execute the program.
A programmer using a high-level language
need not
know the details of machine program
instructions.
65
Compiler translates the high-level language
Software..
Text editor - used for entering and
editing application programs.
File - a sequence of alphanumeric
characters or binary data that is stored in
memory or in secondary storage.
Operating system - a large program, or
67
68
Performance
69
Performance
The most important measure of the
performance a computer is how quickly
it can execute programs.
Three factors affect performance:
Hardware design
Instruction set
Compiler
7
0
Performance..
71
Performance..
To
discuss the performance of the
processor, we should consider only the
periods during which the processor is
active.
These are the periods labelled Program
and OS routines in Figure 1.4.
Sum of these periods is referred as the
processor time needed to execute the
program.
72
Performance..
Processor time to execute a program depends on the
hardware
involved in the execution of individual machine
instructions.
Main Cache
memory memory Processor
Bus
75
Processor Clock
Processor circuits are controlled by a
timing signal called a clock.
The clock defines regular time
as P
Hertz – cycles per second 76
Processor Clock..
77
Basic Performance Equation
T – processor time required to execute a program that
has been
prepared in high-level language
N – number of actual machine language instructions
needed to complete the execution
S – average number of basic steps needed to execute
one
machine instruction. Each step completes in one clock
cycle
R – clock rate
Note: these are not independent to each other
NS
T
R 78
Basic Performance Equation
Lesser the value of T, higher the
performance.
Reducing T means reducing N and S,
and increasing R
The value of N is reduced if the source
program is compiled into fewer machine
instructions.
The value of S is reduced if instructions
have a smaller number of basic steps to
perform or if the execution of
instructions is overlapped.
Using a higher-frequency clock increases
the value or R, which means that the 79