Memory Hierarchy & I/O
Techniques
UNIT-5
Memory hierarchy
Memory Hierarchy is to obtain the highest possible access speed while minimizing the total cost of the memory system.
Memory hierarchy
Memory hierarchy goals
To provide CPU with necessary data (and instructions) as quickly
as possible
• To achieve this goal, a cache should keep frequently used data
• “Cache hit” when CPU finds a requested data in cache
To reduce traffic on memory bus
• Cache becomes a “filter”
• Reduces the bandwidth requirements from the main memory
L1 AND L2 CACHE
Their basic parameters are similar
• Associativity, block size, and cache size (the capacity of data array)
Address used to index
• L1: typically virtual address (to quickly index first)
Locality of reference principle
Locality of Reference
- The references to memory at any given time interval tend to be confined within a
localized areas
- This area contains a set of information and the membership changes gradually as
time goes by
-
Temporal Locality
The information which will be used in near future is likely to be in use
already( e.g. Reuse of information in loops)
-
Spatial Locality
CACHE
Cache
- The property of Locality of Reference makes the Cache memory
systems work
- Cache is a fast small capacity memory that should hold those
information which are most likely to be accessed
Main memory
Cache memory
CACHE
PERFORMANCE OF CACHE
All the memory accesses are directed first to Cache
If the word is in Cache; Access cache to provide it to CPU
If the word is not in Cache; Bring a block (or a line) including that word to replace a block now in Cache
Memory Access
Performance of Cache Memory System
Hit Ratio - % of memory accesses satisfied by Cache memory system Te: Effective memory access time in Cache memory system
Tc: Cache access time
Tm: Main memory access time Te = Tc + (1 - h) Tm
Example: Tc = 0.4 s, Tm = 1.2 s, h = 0.85%
CACHE
Mapping Function
CACHE- DIRECT MAPPING
Each block of main memory maps to only one cache line — i.e. if a block is in cache, it must be in one specific place • Address is in two parts
• Least Significant w bits identify unique word • Most Significant s bits specify one memory block
CACHE- ASSOCIATIVE MAPPING
• A main memory block can load into any line of cache • Memory address is interpreted as 2 fields: tag and word • Tag uniquely identifies block of memory
• Every line’s tag is examined simultaneously for a match
MAIN memory
RAM and ROM Chips
1) Typical RAM chip
2) Typical ROM chip
Chip select Read Write 7-bit address CS RD WR AD 7 RAM
8-bit data bus
Chip select 9-bit address CS AD 9 ROM
8-bit data bus
Working memory, also called core memory electricity alters the “state” of the memory RAM.
It Refers to physical memory that is internal to the computer.
A random-access memory device allows data items to be read and written in roughly the same amount of time regardless of the order in which data items are accessed.
In common usage, the term RAM is synonymous with main memory, the memory available to programs.
In contrast, ROM (read-only memory) refers to special memory used to store programs that boot the computer and perform diagnostics.
RAM AND ROM
ROM is used to stockpile the code for programs that are run under the processor.
RAM is used to clutch the temporary information that is produced and used by the processor. The name random access memory reflects that the user can instantaneously access any area of the memory without referring the entire memory space. The RAM memory is volatile in nature, i.e the memory stored in the RAM is temporary and it will be lost when the power gets switched off.
SECONDARY MEMORY
Auxiliary memory
, also known as
auxiliary storage
,
secondary storage
,
secondary memory
or
external memory
, is a non-volatile memory (does not lose
stored
data when the device is powered down) that is not directly accessible by the CPU,
because it is not accessed via the input/output channels (it is an external device).
In RAM devices (as flash memory) data can be directly deleted or changed.
It is used to store a large amount of data at lesser cost per byte than
primary
memory
;
SECONDARY MEMORY
1.
off-line memory
2.
also called auxiliary or mass memory
3.
tapes, floppy's, zip drives, CDs, optical drives, etc
4.
tens to thousands of times larger than main
PERFORMANCE
Access time:
For random access memory, this is the time required to perform a read or write operation. It is the total time from the instant that an address is presented to the memory to the instant that the data has either been stored (write) or made available for use (read). For non-random access memory, this parameter represents the total time taken to position the read-write mechanism at the desired location.
Memory cycle time:
This parameter only applies to random access memory. It is the access time plus any additional time that is required before a second access to the memory can begin.
Transfer rate:
This is the rate at which data can be transferred into or out of a memory unit. For random access memory it is equal to the reciprocal of the memory cycle time, i.e., 1/(cycle-time).
where: TN = average time to read or write N bits TA = average access time
N = number of bits transferred
R = transfer rate in bits/second (bps)
MAIN MEMORY- RAM
Logical Organization
Random Access Memory
- Each word has a unique address
- Access to a word requires the same time independent of the location of the word - Organization
words
(byte, or n bytes)
2k Words
(n bits/word) n data input lines
n data output lines k address lines
Read Write
MAIN MEMORY- ROM
Characteristics
- Perform read operation only, write operation is not possible
- Information stored in a ROM is made permanent during production, and cannot be changed
- Organization
m x n ROM (m=2k)
k address input lines
TYPES OF ROM
ROM - Store information (function) during production
- Unalterable
- Low cost for large quantity production
PROM (Programmable ROM) - Store info electrically using PROM programmer at the user’s site
- Unalterable
- Higher cost than ROM
The key difference from a standard ROM is that the data is written into a ROM during manufacture, while with a PROM the data is programmed into them after manufacture.
EPROM (Erasable PROM)- Store info electrically using PROM programmer at the user’s site
- Stored info is erasable (alterable) using UV light (electrically in some devices) and rewriteable
ORGANIZATION
Basic element of semiconductor memory is the cell
they have two stable (or semi-stable) states, representing 0 or 1
they are capable of being written (at least once), to set the state
they are capable of being read to sense the state
cell has three functional units
select - selects memory cell for a read or write
control - indications operation
RAM (Random Access Memory )
Types of Main memory
DRAM
: Dynamic random-access memory
SRAM
: Static random Access Memory
The word
static
indicates that the memory retains its
contents as long as power is being supplied. However,
data is lost when the power gets down due to volatile
nature.
It has long life
There is no need to refresh
Faster
Used as cache memory
Large size
Expensive
High power consumption
DRAM, unlike SRAM, must be continually
refreshed
in order
to maintain the data. This is done by placing the memory on
a refresh circuit that rewrites the data several hundred times
per second.
It has short data lifetime
Need to be refreshed continuously
Slower as compared to SRAM
Used as RAM
Less expensive
Less power consumption