0% found this document useful (0 votes)
157 views75 pages

Chapter 5 Memory Organization

Uploaded by

endris yimer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
157 views75 pages

Chapter 5 Memory Organization

Uploaded by

endris yimer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 75

Memory Organization

Outline
• Memory Hierarchy
• Cache
• External Memory
Memory Hierarchy
• The memory unit is an essential component in any
digital computer since it is needed for storing
programs and data
• Not all accumulated information is needed by the
CPU at the same time
• Therefore, it is more economical to use low-cost
storage devices to serve as a backup for storing the
information that is not currently used by CPU
Memory Hierarchy
• The memory unit that directly communicate with
CPU is called the main memory
• Devices that provide backup storage are called
auxiliary memory

• The memory hierarchy system consists of all storage


devices employed in a computer system from the
slow by high-capacity auxiliary memory to a
relatively faster main memory, to an even smaller
and faster cache memory
Memory Hierarchy
• The main memory occupies a central position by being able to
communicate directly with the CPU and with auxiliary memory devices
through an I/O processor
• A special very-high-speed memory called cache is used to increase the
speed of processing by making current programs and data available to the
CPU at a rapid rate
Memory Hierarchy
• CPU logic is usually faster than main memory access time,
with the result that processing speed is limited primarily by
the speed of main memory
• The cache is used for storing segments of programs currently
being executed in the CPU and temporary data frequently
needed in the present calculations
• The typical access time ratio between cache and main
memory is about 1 to 7~10
• Auxiliary memory access time is usually 1000 times that of
main memory
Main Memory
• Most of the main memory in a general purpose
computer is made up of RAM integrated circuits
chips, but a portion of the memory may be
constructed with ROM chips

• RAM– Random Access memory


– Integated RAM are available in two possible operating
modes, Static and Dynamic
• ROM– Read Only memory
Random-Access Memory (RAM)
• Static RAM (SRAM)
– Each cell stores bit with a six-transistor circuit.
– Retains value indefinitely, as long as it is kept powered.
– Relatively insensitive to disturbances such as electrical noise.
– Faster (8-16 times faster) and more expensive (8-16 times more expensice as
well) than DRAM.

• Dynamic RAM (DRAM)


– Each cell stores bit with a capacitor and transistor.
– Value must be refreshed every 10-100 ms.
– Sensitive to disturbances.
– Slower and cheaper than SRAM.
SRAM vs DRAM Summary

Tran. Access
per bit time Persist? Sensitive? Cost Applications

SRAM 6 1X Yes No 100x cache memories

DRAM 1 10X No Yes 1X Main memories,


frame buffers

• Virtually all desktop or server computers since


1975 used DRAMs for main memory and SRAMs
for cache
ROM
• ROM is used for storing programs that are
permanently resident in the computer and for
tables of constants that do not change in value once
the production of the computer is completed
• The ROM portion of main memory is needed for
storing an initial program called bootstrap loader,
witch is to start the computer software operating
when power is turned off
Main Memory
• A RAM chip is better suited for communication with
the CPU if it has one or more control inputs that
select the chip when needed

• The Block diagram of a RAM chip is shown next slide,


the capacity of the memory is 128 words of 8 bits
(one byte) per word
RAM
ROM
Memory Address Map
• Memory Address Map is a pictorial representation of assigned
address space for each chip in the system

• To demonstrate an example, assume that a computer system


needs 512 bytes of RAM and 512 bytes of ROM

• The RAM have 128 byte and need seven address lines, where
the ROM have 512 bytes and need 9 address lines
Memory Address Map
Memory Address Map
• The hexadecimal address assigns a range of
hexadecimal equivalent address for each chip

• Line 8 and 9 represent four distinct binary


combination to specify which RAM we chose

• When line 10 is 0, CPU selects a RAM. And when it’s


1, it selects the ROM
Cache memory
• If the active portions of the program and data are
placed in a fast small memory, the average memory
access time can be reduced,
• Thus reducing the total execution time of the
program
• Such a fast small memory is referred to as cache
memory
• The cache is the fastest component in the memory
hierarchy and approaches the speed of CPU
component
Cache memory
• When CPU needs to access memory, the cache is
examined

• If the word is found in the cache, it is read from the


fast memory

• If the word addressed by the CPU is not found in the


cache, the main memory is accessed to read the
word
Cache memory
• When the CPU refers to memory and finds the word
in cache, it is said to produce a hit
• Otherwise, it is a miss

• The performance of cache memory is frequently


measured in terms of a quantity called hit ratio
• Hit ratio = hit / (hit+miss)
Cache memory
• The basic characteristic of cache memory is its fast access
time,
• Therefore, very little or no time must be wasted when
searching the words in the cache

• The transformation of data from main memory to cache


memory is referred to as a mapping process, there are three
types of mapping:
– Associative mapping
– Direct mapping
– Set-associative mapping
Cache memory
• To help understand the mapping procedure,
we have the following example:
Associative mapping
• The fastest and most flexible cache organization uses an
associative memory
• The associative memory stores both the address and data of
the memory word
• This permits any location in cache to store ant word from
main memory

• The address value of 15 bits is shown as a five-digit octal


number and its corresponding 12-bit word is shown as a four-
digit octal number
Associative mapping
Associative mapping
• A CPU address of 15 bits is places in the argument
register and the associative memory us searched for
a matching address
• If the address is found, the corresponding 12-bits
data is read and sent to the CPU
• If not, the main memory is accessed for the word
• If the cache is full, an address-data pair must be
displaced to make room for a pair that is needed and
not presently in the cache
Direct Mapping
• Associative memory is expensive compared to
RAM
• In general case, there are 2^k words in cache
memory and 2^n words in main memory (in
our case, k=9, n=15)
• The n bit memory address is divided into two
fields: k-bits for the index and n-k bits for the
tag field
Direct Mapping
Direct Mapping
Set-Associative Mapping
• The disadvantage of direct mapping is that two
words with the same index in their address but with
different tag values cannot reside in cache memory
at the same time

• Set-Associative Mapping is an improvement over the


direct-mapping in that each word of cache can store
two or more word of memory under the same index
address
Set-Associative Mapping
Types of External Memory
• Magnetic Disk
– RAID
– Removable
• Optical
– CD-ROM
– CD-Recordable (CD-R)
– CD-R/W
– DVD
• Magnetic Tape
Magnetic Disk
• Disk substrate coated with magnetizable material
(iron oxide…rust)
• Substrate used to be aluminium
• Now glass
– Improved surface uniformity
• Increases reliability
– Reduction in surface defects
• Reduced read/write errors
– Lower flight heights (See later)
– Better stiffness
– Better shock/damage resistance
Read and Write Mechanisms
• Recording and retrieval via conductive coil called a head
• May be single read/write head or separate ones
• During read/write, head is stationary, platter rotates
• Write
– Current through coil produces magnetic field
– Pulses sent to head
– Magnetic pattern recorded on surface below
• Read (traditional)
– Magnetic field moving relative to coil produces current
– Coil is the same for read and write
• Read (contemporary)
– Separate read head, close to write head
– Partially shielded magneto resistive (MR) sensor
– Electrical resistance depends on direction of magnetic field
– High frequency operation
• Higher storage density and speed
Inductive Write MR Read
Data Organization and Formatting
• Concentric rings or tracks
– Gaps between tracks
– Reduce gap to increase capacity
– Same number of bits per track (variable packing
density)
– Constant angular velocity
• Tracks divided into sectors
• Minimum block size is one sector
• May have more than one sector per block
Disk Data Layout
Disk Velocity
• Bit near centre of rotating disk passes fixed point
slower than bit on outside of disk
• Increase spacing between bits in different tracks
• Rotate disk at constant angular velocity (CAV)
– Gives pie shaped sectors and concentric tracks
– Individual tracks and sectors addressable
– Move head to given track and wait for given sector
– Waste of space on outer tracks
• Lower data density
• Can use zones to increase capacity
– Each zone has fixed bits per track
– More complex circuitry
Disk Layout Methods Diagram
Finding Sectors
• Must be able to identify start of track and
sector
• Format disk
– Additional information not available to user
– Marks tracks and sectors
ST506 format (old!)

Gap1 Id Gap2 Data Gap3 Gap1 Id Gap2 Data Gap3

Sync Sync
Byte Track Head Sector CRC Data CRC
Byte

• Foreground reading
– Find others
Characteristics
• Fixed (rare) or movable head
• Removable or fixed
• Single or double (usually) sided
• Single or multiple platter
• Head mechanism
– Contact (Floppy)
– Fixed gap
– Flying (Winchester)
Fixed/Movable Head Disk
• Fixed head
– One read write head per track
– Heads mounted on fixed ridged arm
• Movable head
– One read write head per side
– Mounted on a movable arm
Removable or Not
• Removable disk
– Can be removed from drive and replaced with
another disk
– Provides unlimited storage capacity
– Easy data transfer between systems
• Nonremovable disk
– Permanently mounted in the drive
Multiple Platter
• One head per side
• Heads are joined and aligned
• Aligned tracks on each platter form cylinders
• Data is striped by cylinder
– reduces head movement
– Increases speed (transfer rate)
Multiple Platters
Cylinders
Floppy Disk
• 8”, 5.25”, 3.5”
• Small capacity
– Up to 1.44Mbyte (2.88M never popular)
• Slow
• Universal
• Cheap
• Obsolete?
Winchester Hard Disk (1)
• Developed by IBM in Winchester (USA)
• Sealed unit
• One or more platters (disks)
• Heads fly on boundary layer of air as disk spins
• Very small head to disk gap
• Getting more robust
Winchester Hard Disk (2)
• Universal
• Cheap
• Fastest external storage
• Getting larger all the time
– Multiple Gigabyte now usual
Removable Hard Disk
• ZIP
– Cheap
– Very common
– Only 100M
• JAZ
– Not cheap
– 1G
• L-120 (a: drive)
– Also reads 3.5” floppy
– Becoming more popular?
• All obsoleted by CD-R and CD-R/W?
Speed
• Seek time
– Moving head to correct track
• (Rotational) latency
– Waiting for data to rotate under head
• Access time = Seek + Latency
• Transfer rate
• See timing comparison on p.173
– Sequential organization = .064 seconds to read 1.28
MB
– Random organization = 4.008 seconds to 1.28 MB
– Why periodic defragmentation is important!
Timing of Disk I/O Transfer
RAID
• Redundant Array of Independent Disks
• Redundant Array of Inexpensive Disks
• 6 levels in common use
• Not a hierarchy—but different design
architectures with 3 common characteristics:
– Set of physical disks viewed as single logical drive by
O/S
– Data distributed across physical drives of an array
– Can use redundant capacity to store parity
information, which guarantees data recoverability in
case of a disk failure (except RAID 0)
RAID 0
• No redundancy
• Data striped across all disks
• Round Robin striping
• Increase speed
– Multiple data requests probably not on same disk
– Disks seek in parallel
– A set of data is likely to be striped across multiple
disks
• disk striping: The procedure of combining a set of same-size disk partitions that reside on separate
disks (from 2 to 32 disks) into a single volume, forming a virtual "stripe" across the disks that the
operating system recognizes as a single drive. Disk striping enables multiple I/O operations in the
same volume to proceed concurrently, thus offering enhanced performance. Microsoft Press«
Computer and Internet Dictionary, 4th Edition, ©2000 Microsoft Corporation. All rights reserved.
RAID 0 Striping
RAID 0 Logical Disk
RAID 1
• Mirrored Disks
• Data is striped across disks
• 2 copies of each stripe on separate disks
• Read from either to speed up reads
• Write to both at the same time in parallel
• Recovery is simple
– Swap faulty disk & re-mirror
– No down time
• Expensive—two complete sets of drives
RAID 2
• Disks are synchronized
• Very small stripes
– Often single byte/word
• Error correction calculated across corresponding
bits on disks
• Multiple parity disks store Hamming code error
correction in corresponding positions
• Lots of redundancy
– Expensive
– Not commercially available
RAID 3
• Similar to RAID 2
• Only one redundant parity disk, no matter
how large the array
• Simple parity bit for each set of corresponding
bits
• Data on failed drive can be reconstructed
from surviving data and parity info
• Very high transfer rates
RAID 4
• Each disk operates independently
• Good for high I/O request rate
• Large stripes
• Bit by bit parity calculated across stripes on
each disk
• Parity stored on parity disk
• Not commercially available
RAID 5
• Like RAID 4
• Parity striped across all disks
• Round robin allocation for parity stripe
• Avoids RAID 4 bottleneck at parity disk
• Commonly used in network servers

• N.B. DOES NOT MEAN 5 DISKS!!!!!


RAID 6
• Two parity calculations
• Stored in separate blocks on different disks
• User requirement of N disks needs N+2
• High data availability
– Three disks need to fail for data loss
– Significant write penalty
RAID 0, 1, 2
RAID 3 & 4
RAID 5 & 6
RAID Levels
Optical Storage CD-ROM
• Originally for audio
• 650Mbytes giving over 70 minutes audio
• Polycarbonate coated with highly reflective
coat, usually aluminium
• Data stored as pits
• Read by reflecting laser
• Constant packing density
• Constant linear velocity
CD-ROM Drive Speeds
• Audio is single speed
– Constant linier velocity
– 1.2 ms-1
– Track (spiral) is 5.27km long
– Gives 4391 seconds = 73.2 minutes
• Other speeds are quoted as multiples
• e.g. 24x
• Quoted figure is maximum drive can achieve
Random Access on
CD-ROM
• Difficult
• Move head to rough position
• Set correct speed
• Read address
• Adjust to required location
• (Yawn!)
CD-ROM for & against
• Large capacity (?)
• Easy to mass produce
• Removable
• Robust

• Expensive for small runs


• Slow
• Read only
Other Optical Storage
• CD-Recordable (CD-R)
– WORM
– Now affordable
– Compatible with CD-ROM drives
• CD-RW
– Erasable
– Getting cheaper
– Mostly CD-ROM drive compatible
– Phase change
• Material has two different reflectivities in different phase
states
DVD - what’s in a name?
• Digital Video Disk
– Used to indicate a player for movies
• Only plays video disks
• Digital Versatile Disk
– Used to indicate a computer drive
• Will read computer disks and play video disks
• Dogs Veritable Dinner
• Officially - nothing!!!
DVD - technology
• Multi-layer
• Very high capacity (4.7G per layer)
• Full length movie on single disk
– Using MPEG compression
• Finally standardized (honest!)
• Movies carry regional coding
• Players only play correct region films
• Can be “fixed”
DVD – Writable
• Loads of trouble with standards
• First generation DVD drives may not read first
generation DVD-W disks
• First generation DVD drives may not read CD-
RW disks
• Wait for it to settle down before buying!
Magnetic Tape
• Serial access
• Slow
• Very cheap
• Backup and archive

You might also like