CH 2 ComputerSystem-1
CH 2 ComputerSystem-1
Computer system
1
A Top-Level View of Computer
• At a top level, a computer consists of CPU (central processing
unit), memory, and I/O components, with one or more modules of
each type.
• These components are interconnected in some fashion to achieve
the basic function of the computer, which is to execute programs.
• Thus, at a top level, we can characterize a computer system by
describing
• (1) the external behavior of each component, that is, the data and
control signals that it exchanges with other components and
• (2) the interconnection structure and the controls required to
manage the use of the interconnection structure.
• This top-level view of structure and function is important because
of its explanatory power in understanding the nature of a
computer.
• Equally important is its use to understand the increasingly complex issues of
performance evaluation. 2
A Top-Level View of Computer
• A grasp of the top-level structure and function offers insight
into system bottlenecks, alternate pathways, the magnitude
of system failures if a component fails, and the ease of
adding performance enhancements.
3
Computer Components
• All contemporary computer designs are based on concepts
developed by John von Neumann at the Institute for
Advanced Studies (IAS), Princeton referred to as the von
Neumann architecture
• and is based on three key concepts:
– Data and instructions are stored in a single read-write
memory
– The contents of this memory are addressable by location,
without regard to the type of data contained there
– Execution occurs in a sequential fashion (unless explicitly
modified) from one instruction to the next
4
Hardwired program
• A set of basic logic components can be combined to store
binary data and perform arithmetic and logical operations.
• A specific configuration of these components can be
constructed for a specific computation (e.g. a configuration of
logic components can be designed to do specific
calculation).
• The process of connecting the various components in the
desired configuration is a form of programming.
• The resulting “program” is in the form of hardware and is
termed a hardwired program.
Sequence of
Data arithmetic and Results
logic functions
Programming in hardwired
5
Software Program
• A general-purpose configuration of arithmetic and logic
functions can be constructed, allowing the system to
perform various functions on data based on control signals
applied to the hardware.
• This eliminates the need for rewiring hardware for each
new program, as the programmer only needs to supply
new control signals.
• The program is a sequence of steps, each requiring a new
set of control signals.
• A unique code is provided for each possible set of signals,
and a segment is added to the general-purpose hardware
to accept and generate these signals.
6
Software Program
• Software: Instead of
rewiring the hardware for Instruction Instruction
codes Interpreter
each new program, all
we need to do is
– provide a new sequence Control
of codes. signals
7
Software and CPU Components
• Software:
– A sequence of codes or instructions
– Part of the hardware interprets each instruction and
generates control signals
– Provide a new sequence of codes for each new program
instead of rewiring the hardware
• Major components of the system:
• CPU constituted by:
– Instruction interpreter
– Module of general-purpose arithmetic and logic functions
• I/O Components
8
Software and CPU Components
• I/O Components:
– Data and instructions must be put into the system.
– For this we need some sort of input module.
– This module contains basic components for accepting
data and instructions in some form and converting
them into an internal form of signals usable by the
system.
– A means of reporting results is needed which is in the
form of an output module.
• Taken together, these are referred to as I/O
components.
• Memory module (main memory) is a place
where to store temporarily both data and
instructions
9
Computer Component: Top Level View
• CPU exchanges data CPU Main Memory
with memory using System
0
1
consists of locations
addressable by
numbers. PC = Program counter
14
Fetch cycle
◼ At the beginning of each instruction cycle the processor
fetches an instruction from memory
0002 0FA0
Address Bus
0003 010D
0004 00C1
0005 0010
17
Fetching an Instruction
Instruction Pointer Memory location contents
0002 0FA0
Address Bus
0003 010D
Contents of the
Program 0004 00C1
Counter are
passed across
the Address Bus 0005 0010
18
Fetching an Instruction
Instruction Pointer Memory location contents
0003 010D
0001
0004 00C1
19
Fetching an Instruction
Memory location contents
0001 0FFF
0003 010D
0001
0004 00C1
20
Fetching an Instruction
Memory location contents
The contents of
memory at the 0002 0FA0
given location are
moved across the
data bus 0003 010D
0004 00C1
0005 0010
21
Fetching an Instruction
Memory location contents
0002 0FA0
Into the instruction
register (IR) 0003 010D
0FFF
0004 00C1
Instruction Register
0005 0010
22
Fetching an Instruction
0FFF
Instruction Register
23
Execute Cycle
Fetch Next
Instruction
Decode
Instruction
Execute
Instruction
29
Instruction Cycle state diagram…
• Instruction address calculation (iac): determines the address of
the next instruction to be executed
• Instruction fetch (if): fetch (read) instruction from memory
location into the processor
• Instruction operation decoding (iod): decode (analyze)
instruction to determine type of operation to be performed and
operand/s to be used
• Operand address calculation (oac):determine the address of the
operand (in memory or I/O) if the instruction has a reference to an
operand.
• Operand fetch (of): fetch the operand from memory or read it in
from I/O
• Data operation (do): perform the operation indicated in the
instruction
• Operand store (os): Write the result into memory or out to I/O
30
Instruction Cycle state diagram…
• Notice that: The upper part of the diagram involve data exchanging
between the CPU and either the memory or an I/O module.
32
Interrupts
• From the point of view of the user program, an interrupt is
just that: an interruption of the normal sequence of execution.
• When the interrupt processing is completed, execution
resumes.
• Interrupt is a mechanism by which other modules (e.g. I/O,
memory) may interrupt the normal processing of the
processor.
• Its main goal is to improve processing efficiency since the
external devices (e.g. I/O modules) are very slow.
• CPU may waste time waiting for these slow devices to
perform their tasks.
• With interrupts, the processor can be engaged in executing
other instructions while an I/O operation is in progress.
33
Classes of interrupts
• Program: Generated by some condition that occurs as
a result of an instruction execution, such as arithmetic
overflow, division by zero, attempt to execute an illegal
machine instruction, or reference outside a user’s
allowed memory space.
• Timer: Generated by a timer within the processor.
• This allows the operating system to perform certain
functions on a regular basis.
• I/O: Generated by an I/O controller, to signal normal
completion of an operation, request service from the
processor, or to signal a variety of error conditions.
• Hardware Failure: Generated by a failure such as
power failure or memory parity error. 34
Interrupts example
• Assume that the processor is transferring data to a printer using
the instruction cycle scheme.
• After each write operation, the processor must pause and remain
idle until the printer catches up.
• The length of this pause may be on the order of many hundreds
or even thousands of instruction cycles that do not involve
memory. Clearly, this is a very wasteful use of the processor.
• Figure 3.7a illustrates this state of affairs.
• The user program performs a series of WRITE calls interleaved
with processing.
• Code segments 1, 2, and 3 refer to sequences of instructions that
do not involve I/O.
• The WRITE calls are to an I/O program that is a system utility
and that will perform the actual I/O operation.
35
Interrupts example
• The I/O program consists of three sections:
1. A sequence of instructions, labeled 4 in the figure, to prepare
for the actual I/O operation.
This may include copying the data to be output into a special
buffer and preparing the parameters for a device command.
2. The actual I/O command. Without the use of interrupts, once
this command is issued, the program must wait for the
I/O device to perform the requested function (or
periodically poll the device).
The program might wait by simply repeatedly performing
a test operation to determine if the I/O operation is done.
3. A sequence of instructions, labeled 5 in the figure, to
complete the operation.
36
Figure 3.7 Program Flow of Control without and with Interrupts
40
The revised instruction cycle state diagram
that includes interrupt cycle processing
41
Multiple interrupts
• Multiple interrupts refer to situations where more than one
interrupt occurs while the processor is already handling
another interrupt.
• This can happen when multiple devices or processes need
the CPU’s attention simultaneously.
• Example: a program may be receiving data from a
communications line and printing results.
• The printer will generate an interrupt every time it completes
a print operation.
• The communication line controller will generate an interrupt
every time a unit of data arrives.
• The unit could either be a single character or a block,
depending on the nature of the communications discipline.
• In any case, it is possible for a communications interrupt to
occur while a printer interrupt is being processed.
42
Multiple interrupt approaches
• Two approaches can be taken to dealing with multiple
interrupts: disable interrupts and define priorities
• First approach: a disabled interrupt means that the processor
can and will ignore that interrupt request signal.
• If an interrupt occurs during this time:
– it remains pending and will be checked by the processor
after the processor has enabled interrupts.
• i.e., when a user program is executing and an interrupt occurs,
interrupts are disabled immediately.
• After the interrupt handler routine completes, interrupts are
enabled before resuming the user program, and the processor
checks to see if additional interrupts have occurred.
• This approach is nice and simple, as interrupts are handled in
strict sequential order. 43
Multiple interrupt approaches
• The drawback to this approach is that it does not take into
account relative priority or time-critical needs.
• For example, when input arrives from the
communications line, it may need to be absorbed rapidly
to make room for more input.
• If the first batch of input has not been processed before
the second batch arrives, data may be lost.
• Second approach: is to define priorities for interrupts
and to allow an interrupt of higher priority to cause a
lower-priority interrupt handler to be itself interrupted.
44
Multiple interrupt approaches
• Define priorities example: consider a system with three
I/O devices: a printer, a disk, and a communications line, with
increasing priorities of 2, 4, and 5, respectively. See Figure 3.14
• A user program begins at t = 0. At t = 10, a printer interrupt occurs;
user information is placed on the system stack and execution
continues at the printer interrupt service routine (ISR).
• While this routine is still executing, at t = 15, a communications
interrupt occurs. Because the communications line has higher priority
than the printer, the interrupt is honored.
• The printer ISR is interrupted, its state is pushed onto the stack,
and execution continues at the communications ISR.
• While this routine is executing, a disk interrupt occurs (t = 20).
• Because this interrupt is of lower priority, it is simply held, and the
communications ISR runs to completion.
• When the communications ISR is complete (t = 25), the previous processor state
is restored, which is the execution of the printer ISR. 45
Time Sequence of Multiple Interrupts
46
Interrupts: nested interrupts
processing
47
I/O function
• I/O module can exchange data directly with the processor
• Processor can read data from or write data to an I/O module
– Processor identifies a specific device that is controlled by a
particular I/O module
– an instruction sequence similar could occur I/O instructions
rather than memory referencing instructions
• In some cases, it is desirable to allow I/O exchanges to occur
directly with memory
– The processor grants to an I/O module the authority to read
from or write to memory so that the I/O memory transfer can
occur without tying up the processor
– The I/O module issues read or write commands to memory
relieving the processor of responsibility for the exchange
– This operation is known as direct memory access (DMA)
48
Interconnection Structures
• A computer consists of a set of components or modules of
three basic types (processor, memory, I/O) that communicate
with each other and all units must be connected.
• Interconnection structure: is the collection of paths
connecting the various modules.
• The design of this structure will depend on the
exchanges that must be made among modules.
– Memory: will consist of N words of equal length.
– Input/output: is functionally similar to memory.
Has two operations (read and write).
Further, may control more than one external device.
– CPU: reads in instructions and data, writes out data after
processing, uses control signals to control the overall operation
of the system, and receives interrupt signals.
49
Computer Modules
• NB: The wide
arrows represent
multiple signal
lines carrying
multiple bits of
information in
parallel.
• Each
narrow arrow
represents a
single signal
line.
50
Data Transfer
• The interconnection structure must support the following types of
transfers:
– Memory to processor: The processor reads an instruction or a
unit of data from memory.
– Processor to memory: The processor writes a unit of data to
memory.
– I/O to processor: The processor reads data from an I/O device
via an I/O module.
– Processor to I/O: The processor sends data to the I/O device.
– I/O to or from memory: For these two cases, an I/O module
is allowed to exchange data directly with memory, without
going through the processor, using direct memory access
(DMA).
51
Bus Interconnection
• A bus is a communication pathway connecting two or more
devices.
• A key characteristic of a bus is that it is a shared transmission
medium.
• Multiple devices connect to the bus, and a signal transmitted by
any one device is available for reception by all other devices
attached to the bus.
• If two devices transmit during the same time period, their signals
will overlap and become garbled.
• Thus, only one device at a time can successfully transmit.
• Typically, a bus consists of multiple pathways or lines.
• Each line is capable of transmitting signal representing binary
digits ( binary 1 and binary 0) 52
Bus Interconnection
• A sequence of bits can be transmit across a single
line.
• Taken together, several lines can be used to
transmit bits simultaneously (in parallel).
• For example, an 8-bit unit of data can be transmitted over
eight bus lines.
• Computer systems contain a number of different buses that
provide pathways between components at various levels of
the computer system hierarchy.
• A bus that connects major components (CPU,
Memory, I/O) is called System Bus.
• The most common computer interconnection
structures are based on the use of one or more
53
system buses.
Bus Structure
• A system bus consists of 50-100 separate lines.
• Each line is assigned a particular meaning or function.
• Although there are many different bus designs, on any bus
the lines can be classified into 3 groups
– Data lines
– Address lines
– Control lines
57
The Control Lines
Typical Control Lines include:
▪ Memory write: causes data on the bus to be written into the
addressed location.
▪ Memory read: causes data from the addressed location to be
placed on the bus.
▪ I/O write: causes data on the bus to be output to the addressed
I/O port.
▪ I/O read: causes data from the addressed I/O port to be placed
on the bus.
▪ Transfer ACK: indicates that data have been accepted from or
placed on the bus.
▪ Bus Request: indicates that a module needs to gain control of
the bus.
▪ Bus Grant: indicates that the requesting module has been
granted control of the bus.
▪ Interrupt Request: indicates that an interrupt is pending.
▪ Interrupt ACK: acknowledges that the pending interrupt has been
recognized.
▪ Clock: is used to synchronize operations
▪ Reset: initializes all modules 58
Bus operation
• The operation of the bus is as follows.
• If one module wishes to send data to another, it must do
two things:
– (1) obtain the use of the bus, and
– (2) transfer data via the bus.
• If one module wishes to request data from another
module, it must
– (1) obtain the use of the bus, and
– (2) transfer a request to the other module over the
appropriate control and address lines.
• It must then wait for that second module to send the
data.
59
Single Bus Problems
• Lots of devices on one bus (will cause performance to
suffer) leads to:
– Propagation delays
• Long data paths mean that co-ordination of bus use
can adversely affect performance
• The bus may become a bottleneck as the aggregate
data transfer demand approaches the capacity of
the bus (in available transfer cycles/second)
61
Multiple-Bus Hierarchies
• Traditional Hierarchical Bus Architecture
– Use of a cache structure insulates CPU from
frequent accesses to main memory
– Main memory can be moved off local bus to a
system bus
– Expansion bus interface
• buffers data transfers between system bus
and I/O controllers on expansion bus
• insulates memory-to-processor traffic from I/O
traffic
Traditional Hierarchical Bus Architecture Example
• Local bus
– CPU - Cache/bridge
• System bus
– Cache/bridge - memory
• Expansion bus
– Low-speed I/O modules - Expansion interface
Multiple-Bus Hierarchies
• High-performance Hierarchical Bus Architecture
– Traditional hierarchical bus breaks down as higher and
higher performance is seen in the I/O devices
– Incorporates a high-speed bus
• specifically designed to support high-capacity I/O
devices
• brings high-demand devices into closer integration
with the processor and at the same time is
independent of the processor
• Changes in processor architecture do not affect the
high-speed bus, and vice versa
– Sometimes known as a mezzanine architecture
High-performance Hierarchical Bus Architecture Example
•
66
Bus Types
• Dedicated
– Separate data & address lines
• Multiplexed
– Shared lines
– Address valid or data valid control line
– Advantage - fewer lines
– Disadvantages
• More complex control
• Ultimate performance
Bus Width
• Address:- the wider of address bus has an impact on
range of locations that can be referenced
• Data:- the wider of data bus has an impact on the
number of bits transferred at one time
Timing: Refers to the way in which events are coordinated
on the bus.
– Buses use either synchronous timing or asynchronous timing.
• Synchronous :- Occurrence of events on the bus is
determined by a clock (Clock Cycle or Bus Cycle)
which includes line upon.
• Asynchronous:- occurrence of one event follows
and depends on the previous event.
68
Bus Arbitration
• is a process used in computer systems to manage access to a
shared communication pathway, known as a bus, when multiple
devices need to use it simultaneously.
• This ensures that data transfers occur smoothly without conflicts
or data corruption.
• More than one module may control the bus
– e.g. CPU and DMA controller
• Only one module may control bus at one time
– Centralized arbitration
• Single hardware device controlling bus access
– Single bus arbiter: A central controller (bus arbiter) manages access to the bus.
70
Industry Standard Architecture
• ISA is a standard bus (computer interconnection)
architecture that is associated with the IBM AT
motherboard.
• It allows 16 bits at a time to flow between the
motherboard circuitry and an expansion slot
card and its associated device(s).
71
Extended Industry Standard Architecture
• EISA is a standard bus architecture that extends the
ISA standard to a 32-bit interface.
• It was developed in part as an open alternative to
the proprietary Micro Channel Architecture (MCA)
that IBM introduced in its PS/2 computers.
• EISA data transfer can reach a peak of 33
megabytes per second
72
VESA Local Bus
• VESA VL bus is a standard interface between your
computer and its expansion slot that provides faster data
flow between the devices controlled by the expansion cards
and your computer's microprocessor.
• A "local bus" is a physical path on which data flows at
almost the speed of the microprocessor, increasing total
system performance.
• VESA Local Bus is particularly effective in systems with
advanced video cards and supports 32-bit data flow at 50
MHz
• A VESA Local Bus is implemented by adding a
supplemental slot and card that aligns with and augments
an ISA expansion card. (ISA is the most common expansion
slot in today's computers.)
73
Peripheral Component Interconnect (PCI)
• PCI (Designed by Intel) is a popular high-bandwidth, processor-
independent bus that can function as a mezzanine or
peripheral bus.
• PCI is an interconnection system between a microprocessor
and attached devices in which expansion slot are spaced
closely for high speed operation.
• PCI deliver better system performance for high-speed
I/O subsystems :
– e.g. graphic display adapters, network interface
controllers, disk controllers
• PCI is designed to be synchronized with the clock speed of
the microprocessor, in the range of 33 to 66 MHz.
74
Peripheral Component Interconnect (cont.)
• PCI is now installed on most new desktop computers.
• Current Standard:
– up to 64 data lines at 33 to 66 Mhz
– requires few chips to implement
– supports other buses attached to PCI bus
– public domain, initially developed by Intel to support
Pentium-based systems
– supports a variety of microprocessor-based
configurations, including multiple processors
– uses synchronous timing and centralized arbitration
• However, the bus-based PCI scheme has not been able to
keep pace/speed with the data rate demands of attached
devices.
75
PCI Express (PCIe)
• PCIe is a new version has been developed.
• PCIe is a point-to-point interconnect scheme intended to
replace bus-based schemes such as PCI.
• A key requirement for PCIe is high capacity to support
the needs of higher data rate I/O devices, such as
Gigabit Ethernet.
• Another requirement deals with the need to support
time-dependent data streams.
• Applications such as video-on-demand and audio
redistribution are putting real-time constraints on servers
too.
• Many communications applications and embedded PC
control systems also process data in real-time.
76
PCI Express (PCIe) configuration
•
77
PCI Express (PCIe) con …
• A root complex device, also referred to as a chipset or a host
bridge, connects the processor and memory subsystem to the PCI
Express switch fabric comprising one or more PCIe and PCIe
switch devices.
• PCIe links from the chipset may attach to kinds of devices:
• Switch: manages multiple PCIe streams.
• PCIe endpoint: An I/O device or controller that implements PCIe,
such as a Gigabit ethernet switch, a graphics or video controller,
disk interface, or a communications controller.
• Legacy endpoint: is intended for existing designs that have been
migrated to PCI Express, and it allows legacy behaviors such
as use of I/O space and locked transactions.
– PCI Express endpoints are not permitted to require the use of
I/O space at runtime and must not use locked transactions.
78
PCI Express (PCIe) con …
• PCIe/PCI bridge: allows older PCI devices to be connected to
PCIe-based systems.
79