Coa Notes Part 4 Memory System
Coa Notes Part 4 Memory System
Coa Notes Part 4 Memory System
ARCHITECTURE
PART 4
MEMORY SYSTEM
➢ Basic concepts
➢ Semiconductor RAM
➢ ROM
➢ Cache memories
➢ Virtual memory
➢ Associative memories
If MAR is k bits
long and MDR is n bits long, then the memory may contain upto 2K addressable
locations and the n-bits of data are transferred between the memory and processor.
This transfer takes place over the processor bus.
The processor bus has,
➢ Address Line
➢ Data Line
➢ Control Line (R/W, MFC – Memory Function Completed)
Memory Access Time → It is the time that elapses between the intiation of an
Operation and the completion of that operation.
Memory Cycle Time → It is the minimum time delay that required between the initiation of
the two successive memory operations.
Cache Memory:
It is a small, fast memory that is inserted between the larger slower main memory and
the processor.
It holds the currently active segments of a pgm and their data.
Virtual memory:
The address generated by the processor does not directly specify the physical locations
in the memory.
The address generated by the processor is referred to as a virtual / logical address.
The virtual address space is mapped onto the physical memory where data are actually
stored.
The mapping function is implemented by a special memory control circuit is often called
the memory management unit.
Only the active portion of the address space is mapped into locations in the physical
memory.
The remaining virtual addresses are mapped onto the bulk storage devices used, which
are usually magnetic disk.
As the active portion of the virtual address space changes during program execution, the
memory management unit changes the mapping function and transfers the data between
disk and memory.
Thus, during every memory cycle, an address processing mechanism determines
whether the addressed in function is in the physical memory unit.
If it is, then the proper word is accessed and execution proceeds.
If it is not, a page of words containing the desired word is transferred from disk
to memory. This page displaces some page in the memory that is currently inactive.
CS Chip Select input selects a given chip in the multi-chip memory system
Requirement of external
Bit Organization connection for address, data and
control lines
128 (16x8) 14
(1024) 128x8(1k) 19
Static Memories:
Memories that consists of circuits capable of retaining their state as long as power is applied are
known as static memory.
Read Operation:
In order to read the state of the SRAM cell, the word line is activated to close
switches T1 and T2.
If the cell is in state 1, the signal on bit line b is high and the signal on the bit line b is
low.Thus b and b are complement of each other.
Sense / write circuit at the end of the bit line monitors the state of b and b‟ and set the
output accordingly.
Write Operation:
The state of the cell is set by placing the appropriate value on bit line b and its
complement on b and then activating the word line. This forces the cell into the
corresponding state.
The required signal on the bit lines are generated by Sense / Write circuit. Fig:CMOS
cell (Complementary Metal oxide Semi Conductor):
Transistor pairs (T3, T5) and (T4, T6) form the inverters in the latch.
In state 1, the voltage at point X is high by having T5, T6 on and T4, T5 are OFF.
Thus T1, and T2 returned ON (Closed), bit line b and b will have high and low signals
respectively.
The CMOS requires 5V (in older version) or 3.3.V (in new version) of power supply
voltage.
The continuous power is needed for the cell to retain its state Merit :
It has low power consumption because the current flows in the cell only when the cell
is being activated accessed.
Static RAM‟s can be accessed quickly. It access time is few nanoseconds.
Demerit:
SRAM‟s are said to be volatile memories because their contents are lost when the
power is interrupted.
Asynchronous DRAMS:-
Less expensive RAM‟s can be implemented if simplex calls are used such cells
cannot retain their state indefinitely. Hence they are called Dynamic RAM’s
(DRAM).
The information stored in a dynamic memory cell in the form of a charge on a
capacitor and this charge can be maintained only for tens of Milliseconds. The
contents must be periodically refreshed by restoring by restoring this capacitor charge
to its full value.
DESCRIPTION:
The 4 bit cells in each row are divided into 512 groups of 8.
21 bit address is needed to access a byte in the memory(12 bit To select a row,9 bit Specify
the group of 8 bits in the selected row).
During Read/ Write operation ,the row address is applied first. It is loaded into the
row address latch in response to a signal pulse on Row Address Strobe(RAS)
input of the chip.
When a Read operation is initiated, all cells on the selected row are read and
refreshed.
Shortly after the row address is loaded,the column address is applied to the address
pins & loaded into Column Address Strobe(CAS).
The information in this latch is decoded and the appropriate group of 8 Sense/Write
circuits are selected.
R/W =1(read operation) The output values of the selected circuits are transferred
to the data lines D0 - D7.
R/W =0(write operation) The information on D0 - D7 are transferred to the
selected circuits.
RAS and CAS are active low so that they cause the latching of address when they
change from high to low. This is because they are indicated by RAS & CAS. To
ensure that the contents of a DRAM „s are maintained, each row of cells must be
accessed periodically.
Refresh operation usually perform this function automatically.
A specialized memory controller circuit provides the necessary control signals
RAS & CAS, that govern the timing.
The processor must take into account the delay in the response of the memory.
Such memories are referred to as Asynchronous DRAM’s.
It refers to the amount of time it takes to transfer a word of data to or from the
memory.
For a transfer of single word,the latency provides the complete indication of
memory performance.
For a block transfer,the latency denote the time it takes to transfer the first word
of data.
Bandwidth:
It is defined as the number of bits or bytes that can be transferred in one second.
Bandwidth mainly depends upon the speed of access to the stored data & on the
number of bits that can be accessed in parallel.
The standard SDRAM performs all actions on the rising edge of the clock signal.
The double data rate SDRAM transfer data on both the edges(loading edge,
trailing edge).
The Bandwidth of DDR-SDRAM is doubled for long burst transfer.
To make it possible to access the data at high rate , the cell array is organized into
two banks.
Each bank can be accessed separately.
Consecutive words of a given block are stored in different banks.
Such interleaving of words allows simultaneous access to two words that are
transferred on successive edge of the clock.
Larger Memories:
SIMM & DIMM consists of several memory chips on a separate small board that
plugs vertically into single socket on the motherboard.
To reduce the number of pins, the dynamic memory chips use multiplexed
address inputs.
The address is divided into two parts.They are,
➢ High Order Address Bit(Select a row in cell array & it is provided first
and latched into memory chips under the control of RAS signal).
➢ Low Order Address Bit(Selects a column and they are provided on same
address pins and latched using CAS signals).
The Controller
accepts a complete address & R/W signal from the processor, under the control of
a Request signal which indicates that a memory access operation is needed.
The Controller then forwards the row & column portions of the address to the
memory and generates RAS &CAS signals.
It also sends R/W &CS signals to the memory.
The CS signal is usually active low, hence it is shown as CS.
Refresh Overhead:
Clock cycle=4
Clock Rate=133MHZ
No of cycles to refresh all rows =8192*4
=32,768 Time
needed to refresh all rows=32768/133*106
=246*10-6 sec
=0.246sec
Refresh Overhead =0.246/64
Refresh Overhead =0.0038
Rambus Memory:
A two channel rambus has 18 data lines which has no separate address lines.It is
also called as Direct RDRAM’s.
Communication between processor or some other device that can serves as a
master and RDRAM modules are serves as slaves ,is carried out by means of
packets transmitted on the data lines. There are 3 types of packets.They are,
➢ Request
➢ Acknowledge
➢ Data
Fig:ROM cell
At Logic value ‘0’ Transistor(T) is connected to the ground point(P).
Transistor switch is closed & voltage on bitline nearly drops to zero.
At Logic value ‘1’ Transistor switch is open.
The bitline remains at high voltage.
Types of ROM:
➢ PROM
➢ EPROM
➢ EEPROM
➢ Flash Memory
PROM:-Programmable ROM:
Merit:
It provides flexibility.
It is faster.
It is less expensive because they can be programmed directly by the user.
Demerits:
The chip must be physically removed from the circuit for reprogramming and its
entire contents are erased by UV light.
Merits:
It can be both programmed and erased electrically.
It allows the erasing of all cell contents selectively.
Demerits:
It requires different voltage for erasing ,writing and reading the stored data.
Flash Memory:
In EEPROM, it is possible to read & write the contents of a single cell. In Flash
device, it is possible to read the contents of a single cell but it is only possible to
write the entire contents of a block.
Prior to writing,the previous contents of the block are erased.
Eg.In MP3 player,the flash memory stores the data that represents sound.
Single flash chips cannot provide sufficient storage capacity for embedded
system application.
There are 2 methods for implementing larger memory modules consisting of
number of chips.They are,
➢ Flash Cards
➢ Flash Drives.
Merits:
Flash drives have greater density which leads to higher capacity & low cost per
bit.
It requires single power supply voltage & consumes less power in their operation.
Flash Cards:
One way of constructing larger module is to mount flash chips on a small card.
Such flash card have standard interface.
The card is simply plugged into a conveniently accessible slot.
Its memory size are of 8,32,64MB.
Eg:A minute of music can be stored in 1MB of memory. Hence 64MB flash
cards can store an hour of music.
Flash Drives:
Larger flash memory module can be developed by replacing the hard disk drive.
The flash drives are designed to fully emulate the hard disk.
The flash drives are solid state electronic devices that have no movable parts.
Merits:
They have shorter seek and access time which results in faster response.
They have low power consumption which makes them attractive for battery
driven application.
They are insensitive to vibration.
Demerit:
The capacity of flash drive (<1GB) is less than hard disk(>1GB).
It leads to higher cost perbit.
Flash memory will deteriorate after it has been written a number of
times(typically atleast 1 million times.)
SPEED,SIZE COST:
Magnetic Disk:
A huge amount of cost effective storage can be provided by magnetic disk;The
main memory can be built with DRAM which leaves SRAM‟s to be used in
smaller units where speed is of essence.
Memory Speed Size Cost
Registers Very high Lower Very Lower
Primary cache High Lower Low
Secondary cache Low Low Low
Main memory Lower than High High
Seconadry cache
Secondary Very low Very High Very High
Memory
Fig:Memory Hierarchy
CACHE MEMORIES
The effectiveness of cache mechanism is based on the property of „Locality of
reference’.
Locality of Reference:
Many instructions in the localized areas of the program are executed repeatedly
during some time period and remainder of the program is accessed relatively
infrequently.
It manifests itself in 2 ways.They are,
➢ Temporal(The recently executed instruction are likely to be executed again
very soon.)
➢ Spatial(The instructions in close proximity to recently executed instruction
are also likely to be executed soon.)
If the active segment of the program is placed in cache memory, then the total
execution time can be reduced significantly.
The term Block refers to the set of contiguous address locations of some size. The
cache line is used to refer to the cache block.
Fig:Use of Cache Memory
➢ Write-through protocol
➢ Write-back protocol Write-through protocol:
Here the cache location and the main memory locations are updated
simultaneously.
Write-back protocol:
This technique is to update only the cache location and to mark it as with
associated flag bit called dirty/modified bit.
The word in the main memory will be updated later,when the block containing
this marked word is to be removed from the cache to make room for a new block.
If the requested word currently not exists in the cache during read
operation,then read miss will occur.
To overcome the read miss Load –through / Early restart protocol is used.
Read Miss:
The block of words that contains the requested word is copied from the main memory
into cache.
Load –through:
After the entire block is loaded into cache,the particular word requested is
forwarded to the processor.
If the requested word not exists in the cache during write operation,then Write
Miss will occur.
If Write through protocol is used,the information is written directly into main
memory.
If Write back protocol is used then block containing the addressed word is first
brought intothe cache and then the desired word in the cache is over-written with
the new information.
Mapping Function:
Direct Mapping:
It is the simplest technique in which block j of the main memory maps onto block
„j‟ modulo 128 of the cache.
Thus whenever one of the main memory blocks 0,128,256 is loaded in the
cache,it is stored in block 0.
Block 1,129,257 are stored in cache block 1 and so on.
The contention may arise when,
➢ When the cache is full
➢ When more than one memory block is mapped onto a given cache block
position.
The contention is resolved by allowing the new blocks to overwrite the currently
resident block.
Placement of block in the cache is determined from memory address.
Fig: Direct Mapped Cache
The memory address is divided into 3 fields.They are,
Associative Mapping:
In this method, the main memory block can be placed into any cache block position.
12 tag bits will identify a memory block when it is resolved in the cache.
The tag bits of an address received from the processor are compared to the tag bits of
each block of the cache to see if the desired block is persent.This is called associative
mapping.
It gives complete freedom in choosing the cache location.
A new block that has to be brought into the cache has to replace(eject)an existing
block if the cache is full.
In this method,the memory has to determine whether a given block is in the
cache. A search of this kind is called an associative Search.
Merit:
It is more flexible than direct mapping technique.
Demerit:
Its cost is high.
Set-Associative Mapping:
It is the combination of direct and associative mapping.
The blocks of the cache are grouped into sets and the mapping allows a block
of the main memory to reside in any block of the specified set. In this case,the
cache has two blocks per set,so the memory blocks
0,64,128……..4032 maps into cache set „0‟ and they can occupy either of the two
block position within the set.
6 bit set field Determines which set of cache contains the desired block .
6 bit tag field The tag field of the address is compared to the tags of the two blocks of
the set to clock if the desired block is present.
2 6
3 5
8 4
128 no set field
The cache which contains 1 block per set is called direct Mapping.
A cache that has „k‟ blocks per set is called as „k-way set associative cache‟.
Each block contains a control bit called a valid bit.
The Valid bit indicates that whether the block contains valid data.
The dirty bit indicates that whether the block has been modified during its cache
residency.
Valid bit=0 When power is initially applied to system
Valid bit =1 When the block is loaded from main memory at first time.
If the main memory block is updated by a source & if the block in the source is
already exists in the cache,then the valid bit will be cleared to „0‟.
If Processor & DMA uses the same copies of data then it is called as the Cache
Coherence Problem.
Merit:
The Contention problem of direct mapping is solved by having few choices for
block placement.
The hardware cost is decreased by reducing the size of associative search.
Replacement Algorithm:
In direct mapping, the position of each block is pre-determined and there is no
need of replacement strategy.
In associative & set associative method,the block position is not
predetermined;ie..when the cache is full and if new blocks are brought into the
cache, then the cache controller must decide which of the old blocks has to be
replaced. Therefore,when a block is to be over-written,it is sensible to over-
write the one that has gone the longest time without being referenced.This block
is called Least recently Used(LRU) block & the technique is called LRU
algorithm.
The cache controller track the references to all blocks with the help of block
counter.
Eg:
PERFORMANCE CONSIDERATION:
Two Key factors in the commercial success are the performance & cost ie the best
possible performance at low cost.
A common measure of success is called the Pricel Performance ratio.
Performance depends on how fast the machine instruction are brought to the
processor and how fast they are executed.
To achieve parallelism(ie. Both the slow and fast units are accessed in the same
manner),interleaving is used.
Interleaving:
Fig:Consecutive words in a Module
VIRTUAL MEMORY:
Techniques that automatically move program and data blocks into the physical
main memory when they are required for execution is called the Virtual
Memory.
The binary address that the processor issues either for instruction or data are
called the virtual / Logical address.
The virtual address is translated into physical address by a combination of
hardware and software components.This kind of address translation is done by
MMU(Memory Management Unit).
When the desired data are in the main memory ,these data are fetched /accessed
immediately.
If the data are not in the main memory,the MMU causes the Operating system to
bring the data into memory from the disk.
Transfer of data between disk and main memory is performed using DMA
scheme.
Fig:Virtual Memory Organisation
Address Translation:
In address translation,all programs and data are composed of fixed length units
called Pages.
The Page consists of a block of words that occupy contiguous locations in the
main memory.
The pages are commonly range from 2K to 16K bytes in length.
The cache bridge speed up the gap between main memory and secondary storage
and it is implemented in software techniques.
Each virtual address generated by the processor contains virtual Page
number(Low order bit) and offset(High order bit)
Virtual Page number+ Offset Specifies the location of a particular byte (or word) within
a page.
Page Table:
It contains the information about the main memory address where the page is
stored & the current status of the page.
Page Frame:
An area in the main memory that holds one page is called the page frame.
Page Table Base Register:
The Control bits specifies the status of the page while it is in main memory.
Function:
The control bit indicates the validity of the page ie)it checks whether the page is
actually loaded in the main memory.
It also indicates that whether the page has been modified during its residency in
the memory;this information is needed to determine whether the page should be
written back to the disk before it is removed from the main memory to make room
for another page.
When the
operating system changes the contents of page table ,the control bit in TLB will
invalidate the corresponding entry in the TLB.
Given a virtual address,the MMU looks in TLB for the referenced page.
If the page table entry for this page is found in TLB,the physical address is
obtained immediately.
If there is a miss in TLB,then the required entry is obtained from the page table in
the main memory & TLB is updated.
When a program generates an access request to a page that is not in the main
memory ,then Page Fault will occur.
The whole page must be broght from disk into memry before an access can
proceed.
When it detects a page fault,the MMU asks the operating system to generate an
interrupt.
The operating System suspend the execution of the task that caused the page fault
and begin execution of another task whose pages are in main memory because the
long delay occurs while page transfer takes place.
When the task resumes,either the interrupted instruction must continue from the
point of interruption or the instruction must be restarted.
If a new page is brought from the disk when the main memory is full,it must
replace one of the resident pages.In that case,it uses LRU algorithm which
removes the least referenced Page.
/
A modified page has to be written back to the disk before it is removed from the
main memory. In that case,write –through protocol is used.
SECONDARY STORAGE:
The Semi-conductor memories donot provide all the storage capability.
The Secondary storage devices provide larger storage requirements.
Some of the Secondary Storage devices are,
➢ Magnetic Disk Optical Disk Magnetic Tapes.
Magnetic Disk:
Magnetic Disk system consists o one or more disk mounted on a common
spindle.
A thin magnetic film is deposited on each disk, usually on both sides.
The disk are placed in a rotary drive so that the magnetized surfaces move in
close proximity to read /write heads.
Each head consists of magnetic yoke & magnetizing coil.
Digital information can be stored on the magnetic film by applying the current
pulse of suitable polarity to the magnetizing coil.
Only changes in the magnetic field under the head can be sensed during the Read
operation.
Therefore if the binary states 0 & 1 are represented by two opposite states of
magnetization, a voltage is induced in the head only at 0-1 and at 1-0 transition in
the bit stream.
A consecutive (long string) of 0‟s & 1‟s are determined by using the clock which
is mainly used for synchronization.
Phase Encoding or Manchester Encoding is the technique to combine the clocking
information with data.
The Manchester Encoding describes that how the self-clocking scheme is
implemented.
Fig:Mechanical Structure
/
The Read/Write heads must be maintained at a very small distance from the
moving disk surfaces in order to achieve high bit densities.
When the disk are moving at their steady state, the air pressure develops between
the disk surfaces & the head & it forces the head away from the surface.
The flexible spring connection between head and its arm mounting permits the
head to fly at the desired distance away from the surface.
Wanchester Technology:
Read/Write heads are placed in a sealed, air –filtered enclosure called the
Wanchester Technology.
In such units, the read/write heads can operate closure to magnetic track surfaces
because the dust particles which are a problem in unsealed assemblies are absent.
Merits:
One inch disk- weight=1 ounce, size -> comparable to match book
Capacity -> 1GB
Inch disk has the following parameter
Recording surface=20
Tracks=15000 tracks/surface
Sectors=400.
Each sector stores 512 bytes of data
Capacity of formatted disk=20x15000x400x512=60x109 =60GB
Seek time=3ms
Platter rotation=10000 rev/min
Latency=3ms
Internet transfer rate=34MB/s
Data Buffer / cache
A disk drive that incorporates the required SCSI circuit is referred as SCSI
drive.
The SCSI can transfer data at higher rate than the disk tracks.
An efficient method to deal with the possible difference in transfer rate between disk
and SCSI bus is accomplished by including a data buffer.
This buffer is a semiconductor memory.
The data buffer can also provide cache mechanism for the disk (ie) when a read
request arrives at the disk, then controller first check if the data is available in the
cache(buffer).
If the data is available in the cache, it can be accessed and placed on SCSI bus . If
it is not available then the data will be retrieved from the disk.
Disk Controller
The disk controller acts as interface between disk drive and system bus.
The disk controller uses DMA scheme to transfer data between disk and main
memory.
When the OS initiates the transfer by issuing Read/Write request, the controllers
register will load the following information. They are,
Main memory address(address of first main memory location of the block of
words involved in the transfer)
Disk address(The location of the sector containing the beginning of the desired
block of words)
(number of words in the block to be transferred).
MODULE 4
MEMORY SYSTEM
PART-A
PART – B