Co Unit Iv

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

UNIT IV

Memory organization: Memory hierarchy, main memory, auxiliary memory, associate memory,
cache memory.

Memory (storage device) where data can be stored. The memory unit stores the binary information
in the form of bits. Generally, memory/storage is classified into 2 categories:
• Volatile Memory: This loses its data, when power is switched off.
• Non-Volatile Memory: This is a permanent storage and does not lose any data when power
is switched off.

Memory Hierarchy:

The total memory capacity of a computer can be visualized by hierarchy of components. The memory
hierarchy system consists of all storage devices contained in a computer system from the slow
Auxiliary Memory to fast Main Memory and to smaller Cache memory.
Auxiliary memory (removable memory) or secondary memory, the most common auxiliary
memory devices used in computer systems are magnetic disks and tapes. Access time is
generally 1000 times that of the main memory, hence it is at the bottom of the hierarchy.
The main memory (RAM) is the central storage unit in a computer system. It is a relatively large
and fast memory used to store programs and data during the computer operation. It occupies the
central position because it is equipped to communicate directly with the CPU and with auxiliary
memory devices through Input/output processor (I/O).
When the program not residing in main memory is needed by the CPU, they are brought in from
auxiliary memory. Programs not currently needed in main memory are transferred into auxiliary
memory to provide space in main memory for other programs that are currently in use.
The cache memory is used to store program data which is currently being executed in the CPU. It is
a fastest small memory. It is placed between the CPU and main memory as illustrated in below Figure.
The cache memory access time is less than the access time of main memory by a factor of 5 to 10.
The basic operation of the cache is as follows. When the CPU needs to access memory, the cache is
examined. If the word is found (cache HIT) in the cache, it is read from the fast memory. If the word
addressed by the CPU is not found (cache MISS) in the cache, the main memory is accessed to read
the word. A block of words containing the one just accessed is then transferred from main memory
to cache memory.
The performance of cache memory is frequently measured in terms of a quantity called hit ratio.
CACHE MISS
CACHE HIT
Hit ratio=no of hits/total no of bus cycle *100
Block transfer
Cache performance: The measures that characterize the performance of a cache are the hit ratio.

Input-Output Interface:
The method that is used to transfer information between internal storage and external I/O devices is
known as I/O interface.
Input/output Interface provides a method for transferring information between processor and external
input/output devices i.e., peripherals. These Input/output interface in computer system are exists in
the form of special hardware component between the system bus and peripherals. This component is
called “interface unit” (These communication links are used to resolve the differences between CPU
and peripheral.).
A typical input-output interface between the processor and several peripherals is shown in figure
below:

Here we see that each peripheral device has an interface unit associated with it.
Now, the question arises- why Input/output Interface is required for transferring information between
processor and peripherals?
The Input/output Interface is required because there are exists many differences between the central
computer and each peripheral while transferring information. Some major differences are:
• Peripherals are electromechanical and electromagnetic devices and their manner of operation
is different from the operation of CPU and memory which is electronic device. Therefore, a
conversion of signal values may be required.
• The data transfer rate of peripherals is usually slower than the transfer rate of CPU, and
consequently a synchronisation mechanism is needed.
• Data codes and formats in peripherals differ from the word format in the CPU and Memory.
• The operating modes of peripherals are differ from each other and each must be controlled so
as not to disturb the operation of other peripherals connected to CPU.

These differences are resolved through input-output interface. As input-output interface (Interface
Unit) contain various components, each of which performs one or more vital function for smooth
transforming of information between CPU and Peripherals.
I/O BUS and Interface Module:
It defines the typical link between the processor and several peripherals.
The I/O Bus consists of data lines, address lines and control lines.
The I/O bus from the processor is attached to all peripherals interface. To communicate with a
particular device, the processor places a device address on address lines. Each Interface decodes the
address and control received from the I/O bus, interprets them for peripherals and provides signals
for the peripheral controller. It is also synchronizes the data flow and supervises the transfer between
peripheral and processor. Each peripheral has its own controller. For example, the printer controller
controls the paper motion, the print timing. The control lines are referred as I/O command. The
commands are as following:
Control command- A control command is issued to activate the peripheral and to inform it what to do.

Status command- A status command is used to test various status conditions in the interface and the
peripheral.

Data Output command- A data output command causes the interface to respond by transferring data
from the bus into one of its registers.

Data Input command- The data input command is the opposite of the data output. In this case the interface
receives on item of data from the peripheral and places it in its buffer register. I/O Versus Memory Bus

I/O versus Memory Bus:


In addition to communicating with I/O, the processor must communicate with the memory unit. Like
the I/O bus, the memory bus contains data, address, and read/write control lines. There are three ways
that computer buses can be used to communicate with memory and I/O:
1. Use two separate buses, one for memory and the other for I/O.
The computer has independent sets of data, address, and control buses, one for accessing
memory and the other for I/O. The memory communicates with both the CPU and the IOP
through a memory bus. The IOP communicates also with the input and output devices through
a separate I/O bus with its own address, data and control lines. The purpose of the IOP is to
provide an independent pathway for the transfer of information between external devices and
internal memory.
2. Use one common bus for both memory and I/O but have separate control lines for each.
Many computers use one common bus to transfer information between memory or I/O and
the CPU. The distinction between a memory transfer and I/O transfer is made through separate
read and write lines. The CPU specifies whether the address on the address lines is for a
memory word or for an interface register by enabling one of two possible read or write lines.
The I/O read and I/O write control lines are enabled during an I/O transfer.
3. Use one common bus for memory and I/O with common control lines.

Example of I/O Interface:


An example of an I/O interface unit is shown in below block diagram.
It consists of
• Two Data Registers called ports,
• A control Register,
• A status Register,
• Bus Buffers,
• Timing and control circuits.
• The interface communicates with the CPU through the data bus.
• The chip select and register select inputs determine the address assigned to the interface.
The I/O read and write are two control lines that specify an input or output, respectively. The four
registers communicate directly with the I/O device attached to the interface. The I/O data to and
from the device can be transferred into either port A or port B. The interface may operate with an
output device or with an input device, or with a device that requires both input and output. If the
interface is connected to a printer, it will only output data, and if it services a character reader, it
will only input data. A magnetic disk unit transfers data in both directions but not at the same
time, so the interface can use bidirectional lines. A command is passed to the l/0 device by sending
a word to the appropriate interface register. In a system like this, the function code in the l/0 bus
is not needed because control is sent to the control register, status information is received from
the status register, and data are transferred to and from ports A and B registers. Thus the transfer
of data, control, and status information is always via the common data bus. The distinction
between data, control, or status information is determined from the particular interface register
with which the CPU communicates. The control register receives control information from the
CPU. By loading appropriate bits into the control register, the interface and the l/0 device attached
to it can be placed in a variety of operating modes.

The chip select (CS) input when the interface is selected by the address bus. The two register select
inputs RS1 and RS0 are usually are connected to the two least significant lines of the address bus.
These two inputs select one of the four registers in the interface as specified in the table accompanying
the diagram. The content of the selected register is transfer into the CPU via the data bus when the
I/O read signal is enabled. The CPU transfers binary information into the selected register via the data
bus when the I/O write input is enabled.

MODES OF TRANSFER:
Data transfer between the central computer and I/O devices may be handled in a variety of modes.
Some modes use the CPU as an intermediate path; others transfer the data directly to and from the
memory unit. Data transfer to and from peripherals may be handled in one of three possible modes:
1. Programmed I/O
2. Interrupt-initiated I/O
3. Direct memory access (DMA)

Binary information received from an external device is usually stored in memory for later processing.
Information transferred from the central computer into an external device originates in the memory
unit. The CPU merely executes the 110 instructions and may accept the data temporarily, but the
ultimate source or destination is the memory unit.

1. Example of Programmed I/O


A flowchart of the program that must be written for the CPU is shown in Fig. 11-11. It is assumed
that the device is sending a sequence of bytes that must be stored in memory. The transfer of each
byte requires three instructions:
1. Read the status register.
2. Check the status of the flag bit and branch to step 1 if not set or to step 3 if set.
3. Read the data register.
Each byte is read into a CPU register and then transferred to memory with a store instruction. A
common I/O programming task is to transfer a block of words from an I/O device and store them in
a memory buffer. A program that

You might also like