Professional Documents
Culture Documents
Three categories:
Internal processor memory Main memory Secondary memory Cache memory The choice of a memory device to built a
Memory-device characteristics
Cost, c = C/S dollars/bit Access time, tA Access modes
Random-access memory (RAM). Serial access Semirandom or direct access Time spent to transfer a data to the output after receiving a readrequest.
Alterability
Read-only, ROM PROM, EPROM Read-write, RAM
Permanence of storage
Destructive read-out Non-destructive read-out Dynamic storage, refreshing Volatility.
Physical characteristics
Physical size Storage density Energy consumption Reliability: mean time to failure (MTTF)
Semiconductor RAMs
Static RAM Data remains as long as power is
supplied Read: add line active, data line connected to sense amp Write: Add line active, data line connected to data (low or high), Vb is connected to V1/2
Data line Va R R
V1/2=V
b
Add line
Bipolar static RAM cell
add
data GND
Dynamic MOS cell
RAM organization
Access circuitry has a very significant effect on total cost of any memory unit. To reduce the cost the organization has two essential features:
The storage cells are physically arranged in rectangular arrays of cells. This is to facilitate layout of the connections between the cells and the access circuitry. The memory address is partitioned into d components so that address Ai of cell Ci becomes a d-dimensional vector (Ai,1,Ai,2, . . . , Ai,d) = Ai. Each of the d parts of an address word goes to a different address decoder and a different set of address drivers. A particular cell is selected by simultaneously activating all d of its address lines.
A0 A1
Va Vb
Decoder
CE WE X 0
X1
Z0
Z1
RAM Design
2mxn bit RAM IC. m represent no of address lines. n represent word size.
m
Address A
2mxn RAM
n
Data D
CS WE OE A RAM IC
2mxw RAM
CS OE WE
1 to 4 decoder
2mxw RAM
CS OE WE
m+2
2mxw RAM
CS OE WE
Flash memory
Reading is random but writing is in blocks
Both require fast p-to-s and s-to-p ckts at the memory processor interface. Normally S words produced or consumed by the processor have consecutive address. Their placement in the physical memory uses Interleaving technique.
Address Interleaving
Let Xh, Xh+1, be words that expected to be accessed in sequence. They normally be placed in consecutive memory locations Ai,Ai+1, in the RAM.
Assign Ai to bank Mj if j=i (modulo S). If S = p2, then least significant p bits of a memory add immediately identify the memory bank where it belongs to.
Magnetic tape
Data is stored in longitudinal tracks. Older tapes had 9 parallel tracks. Now about 80 tracks are used. A single head can read/write all tracks simultaneously. Along the tracks data are stored in blokcs. Large gaps are inserted between adjucent blocks so that tape can be started and stopped between blocks.
Optical memories
CD-ROMs Bits are stored in 0.1 m wide pits and lands. Access time is about 100ms, data transfer rate is 3.6 MB/s (for 24x; x = 150KB/s)
Memory hierarchy M M
1
I CPU D Cache M1
Cache
Write-through Write-back
CPU
Main memory
M2 I
M3
Secondary
D L1 L2 Main memory M2 I
Cache M1
M3
Secondary
CPU
Main memory I
Secondary
Normally holds
Virtual memory
Memory hierarchy comprising of different memory devices appears to the user program as a single, large, directly addressable memory.
Automatic memory allocation, and efficient sharing Makes program independent of main memory space Achieve relatively low cost/bit and low access time.
A memory location is addressed by virtual address V, and it is necessary to map this address to the actual physical address R, f:VR
Locality of references
Over short term, the address generated by a program tend to be localized and are therefore predictable. Page mode: info is transferred between Mi and Mi+1 as a block of consecutive words. Spatial locality. Temporal locality: loop instru has high frequency of references.
Address translation
Address assignment and translation is carried out at diffent stage in life of a pgro
By the programmer while writing the prog By the compiler during compilation By the loader at initial prog-load time By run-time memory management HW and/or software
Effective add, Base add, Displacement D A B W 0 B Aeff= B+D or Aeff = B.D W 1 B+1 . Memory address table. W i B+I Limit address, Li m-1 B+m-1 W Bi<=Ai<=Li
eff 0 1
m-1
B1 Blk K1 B2 Blk K2 L2 L1
B1 B2 B3
Blk K1
Blk K2 Blk K3
L1 L2 L3
BV
AR
BR
To memory system
Advantages of segmentation
Segment boundaries corresponds to natural program and data boundaries. Because of their logical independence, a program segment can be changed or recompiled at any time without affecting other segments. Implementation of access rights and scopes of program variables have been easy. Implementation of Stack and queues have been easy as the segment can be of variable length.
pages
Fixed length block page table
Page add, displacement
Page fault. External fragmentation Internal fragmentation Segments can be assigned over a noncontiguous area in the memory by the use of paging.
SS 2 SS SP u 2 S S S S P 2 S S (1 S P )
OPT SP 2SS
1 1 2 / SS
Memory Allocation
Placement of info blocks in memory system is called memory allocation. Demand swapping Anticipatory swapping Thrashing For to level memory system, memory map contains
Occupied memory list for M1 Available space list for M1 Directory for M2.
Non-preemptive allocation
Does not overwrite or move existing blocks to make room for incoming blocks. Algorithm for paged segment. Algorithms for unpaged segment
First fit Best fit
Preemptive allocation
Rellocation is done in 2 ways:
Relocate a block to a different postion within M1 Deallocate a block from M1 memory using a replacement policy
Dirty blocks, clean blocks
Optimal replacement policy find the block for replacement that has minimum chance to be referenced next time. Address trace Two policies
FIFO LRU