Professional Documents
Culture Documents
Module 5
Main memory
Auxillary memory
Cache memory
RAM
ROM
Bootst rap Loader
Primary Memory
Primary memory is internal memory of the computer.
Memory unit that directly communicate with CPU.
It is also known as main memory or Temporary memory.
Primary Memory holds the data and instruction on which computer
is currently working.
Primary Memory is volatile in nature.
It means when power is switched off it lost all data.
Secondary Memory
Secondary Memory is external memory of the computer.
It is also known as Auxiliary memory and permanent memory.
It is used to store the different programs and the information permanently.
Secondary Memory is non volatile in nature.
Main Memory
The principal technology used for the main memory is based on semiconductor
integrated circuits.
Dynamic RAM
Dynamic RAM also known as DRAM.
The dynamic RAM stores the binary information in the form of electric charges that are applied
to capacitors.
The capacitors are provided inside the chip by MOS transistors.
Dram requires an external memory refresh circuit which periodically rewrites the data in
the capacitors.
Retain data for a few seconds if the power is lost.
ROM (Read Only Memory)
ROM is a Permanent Type memory.
ROM is used for storing programs that are permanently resident in the computer.
Its content are not lost when power supply is switched off.
Among other things, the ROM portion of main memory is needed for storing an
initial program called a bootstrap loader.
The bootstrap loader is a program whose function is to start the computer
software operating when power is turned on.
The contents of ROM remain unchanged after power is turned off and on again.
When power is turned on, the hardware of the computer sets the program
counter to the first address of the bootstrap loader.
The bootstrap program loads a portion of the operating system from disk to
main memory and control is then transferred to the operating system, which
prepares the computer for general use
RAM Chip
RAM Chip
A RAM chip is better suited for communication with the CPU if it has one or
more control inputs that select the chip only when needed.
Another common feature is a bidirectional data bus that allows the transfer
of data either from memory to CPU during a read operation, or from CPU to
memory during a write operation.
A bidirectional bus can be constructed with three-state buffers.
A three-state buffer output can be placed in one of three possible states
a signal equivalent to logic 1
a signal equivalent to logic 0
a highimpedance state.
For the same-size chip, it is possible to have more bits of ROM than of RAM
because the internal binary cells in ROM occupy less space than in RAM.
For this reason, the diagram specifies a 512-byte ROM, while the RAM has only
128 bytes.
The nine address lines in the ROM chip specify any one of the 512 bytes stored
in it.
The two chip select inputs must be CS1 = 1 and CS2 = 0 for the unit to operate.
Otherwise, the data bus is in a high-impedance state.
Memory Connection to CPU
RAM and ROM chips are connected to a CPU through the data and address
buses.
The low-order lines in the address bus select the byte within the chips and
other lines in the address bus select a particular chip through its chip select
inputs.
Each RAM receives the seven low-order bits of the address bus to select one of
128 possible bytes.
The particular RAM chip selected is determined from lines 8 and 9 in the
address bus. This is done through a 2 x 4 decoder whose outputs go to the CS1
inputs in each RAM chip.
Thus, when address lines 8 and 9 are equal to 00, the first RAM chip is
selected. When 01, the second RAM chip is selected, and so on.
The RD and WR outputs from the microprocessor are applied to the inputs of
each RAM chip.
The selection between RAM and ROM is achieved through bus line 10. The
RAMs are selected when the bit in this line is 0, and the ROM when the bit is 1.
The other chip select input in the ROM is connected to the RD control line for
the ROM chip to be enabled only during a read operation.
Address bus lines 1 to 9 are applied to the input address of ROM without going
through the decoder.
This assigns addresses 0 to 511 to RAM and 512 to 1023 to ROM.
The data bus of the ROM has only an output capability, whereas the data bus
connected to the RAMs can transfer information in both directions
Auxillary Storage Device
Magnetic disc – FDD, HDD
Magnetic tape –Backup/ Program
Optical Disk –CDR, ODD, DVD
A device that stores computer data on magnetic tape is known as a tape drive
Stored data can be identified for access by the content of the data itself rather
than by an address.
A memory unit accessed by content is called an associative memory or content
addressable memory (CAM).
One cell of Associative Memory
Tag bit
If unwanted words have to be deleted and new words inserted one at a time,
there is a need for a special register (tag register) to distinguish between
active and inactive words.
A tag register would have as many bits as there are words in the memory.
For every active word stored in memory, the corresponding bit in the tag
register is set to 1.
A word is deleted from memory by clearing its tag bit to 0.
Words are stored in memory by scanning the tag register until the first 0 bit is
encountered. This gives the first available inactive word and a position for
writing a new word.
Cache Memory
Locality of Reference
The references to memory tend to be confined within a few localized
areas in memory.
A fast small memory
keeping the most frequently accessed instructions and data in the
fast cache memory
Hit Ratio
hit : the CPU finds the word in the cache
miss : the word is not found in cache
Hit ratio = percentage of memory accesses satisfied by the cache.
Writing to Cache
Cache Replacement Algorithm
When the CPU generates a memory request, the index value of the address is used
to access the cache. The tag field of the CPU address is compared with both tags in
the cache to determine if a match occurs.
Cache initialization
Cache is initialized.
1) when power is applied to the computer
2) when main memory is loaded with a complete set of programs from
auxiliary memory
valid bit
indicate whether or not the word contains valid data
After initialization the cache is considered to be empty, but in effect it contains some nonvalid data.
With each word in cache a valid bit is there to indicate whether or not the word contains valid data.
The cache is initialized by clearing all the valid bits to 0.
The valid bit of a particular cache word is set to 1 the first time this word is loaded from main
memory and stays set unless the cache has to be initialized again.
Virtual Memory
Virtual memory is a concept used in some large computer systems that permit
the user to construct programs as though a large memory space were
available, equal to the totality of auxiliary memory.
An address used by a programmer will be called a virtual address.
The set of such addresses gives an address space.
An address in main memory is called a location or physical address.
The set of such locations is called the memory space.
Address Mapping Using Pages
Page(Block) Replacement
Page Fault : the page referenced by the CPU is not in main memory
a new page should be transferred from auxiliary memory to main memory
Replacement algorithm :
Random Replacement
First In First Out (FIFO)
Last In First Out (LIFO)
Least Recently Used (LRU)
Most Frequently Used (MFU)
Optimal Page Replacement
Block Word
Physical address
(a) Logical to physical address mapping
Argument register
A Translation look aside buffer can be defined as a memory cache which can
be used to reduce the time taken to access the page table again and again.
It is a memory cache which is closer to the CPU and the time taken by CPU to
access TLB is lesser then that taken to access main memory.
TLB follows the concept of locality of reference which means that it contains
only the entries of those many pages that are frequently accessed by the CPU
Memory Protection
Base address Length Protection
Input-Output Interface
Data codes and formats in peripherals differ from the word format in
the CPU and Memory .
The operating modes of peripherals are different from each other
Each peripherals must be controlled so as not to disturb the operation of other peripherals
connected to theCPU
I/O Bus and Interface Modules
Data Transfer
• Strobe control: A strobe pulse is supplied by one unit to indicate to the other unit
when the transfer has to occur.
• Handshaking: This method is commonly used to accompany each data item being
transferred with a control signal that indicates data in the bus. The unit receiving the
data item responds with another signal to acknowledge receipt of the data.
The Strobe Control
The Strobe Control method of asynchronous data transfer employs a single
control line to time each transfer.
This control line is also known as a strobe, and it may be achieved either by
source or destination, depending on which initiate the transfer.
2 Types:
Source initiated Strobe
Destination initiated Strobe
Source initiated strobe
Source initiated Strobe - Strobe is initiated first by source
The source unit first places the data on the data bus.
After a brief delay to ensure that the data resolve to a stable value, the source activates
a strobe pulse.
The information on the data bus and strobe control signal remains in the active state for
a sufficient time to allow the destination unit to receive the data.
The destination unit uses a falling edge of strobe control to transfer the contents of a
data bus to one of its internal registers.
The source removes the data from the data bus after it disables its strobe pulse. Thus,
new valid data will be available only after the strobe is enabled again.
In this case, the strobe may be a memory-write control signal from the CPU to a
memory unit. The CPU places the word on the data bus and informs the memory unit,
which is the destination.
Destination initiated strobe
The strobe initiated by destination
The destination unit first activates the strobe pulse, informing the source to provide the
data.
The source unit responds by placing the requested binary information on the data bus.
The data must be valid and remain on the bus long enough for the destination unit to
accept it.
The falling edge of the strobe pulse can use again to trigger a destination register. The
destination unit then disables the strobe.
Finally, and source removes the data from the data bus after a determined time interval.
In this case, the strobe may be a memory read control from the CPU to a memory unit.
The CPU initiates the read operation to inform the memory, which is a source unit, to
place the selected word into the data bus.
Handshaking Method
Disadvantages :
The source unit that initiates the transfer has no way of knowing whether the destination
has received the data that was placed in the bus. Similarly, a destination unit that initiates
the transfer has no way of knowing whether the source unit has placed data on the bus.
Modes of Transfer-Data transfer to and
from peripherals
We store the binary information received through an external device in the memory
unit. The information transferred from the CPU to external devices originates from the
memory unit. Although the CPU processes the data, the target and source are always
the memory unit. We can transfer this information using three different modes of
transfer.
1. Programmed I/O
2. Interrupt- initiated I/O
3. Direct memory access( DMA)
Programmed I/O
Programmed I/O uses the I/O instructions written in the computer program. The
instructions in the program initiate every data item transfer. Usually, the data transfer is
from a memory and CPU register. This case requires constant monitoring by the peripheral
device's CPU.
Advantages:
• Programmed I/O is simple to implement.
• It requires very little hardware support.
• CPU checks status bits periodically.
Disadvantages:
• The processor has to wait for a long time for the I/O module to be ready for either
transmission or reception of data.
• The performance of the entire system is severely degraded.
Interrupt- initiated I/O
The interrupt facilities and special commands inform the interface for issuing an
interrupt request signal as soon as the data is available from any device. In the
meantime, the CPU can execute other programs, and the interface will keep
monitoring the i/O device. Whenever it determines that the device is ready for
transferring data interface initiates an interrupt request signal to the CPU. As soon as
the CPU detects an external interrupt signal, it stops the program it was already
executing, branches to the service program to process the I/O transfer, and returns to
the program it was initially running.
Direct Memory Access