0% found this document useful (0 votes)
166 views45 pages

Chapter 7 Memory Organization

Uploaded by

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

Chapter 7 Memory Organization

Uploaded by

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

Chapter 7

Memory Organization
Characteristic of Memory

• Memory is unit used for storage, and retrieval of data and instructions.
• A typical computer system is equipped with a hierarchy of memory subsystems, some
internal to the system and some external.
• Internal memory systems are accessible by the CPU directly and external memory
systems are accessible by the CPU through an I/O module.
• Memory systems are classified according to their key characteristics, as stated below:
1. Location:
• Registers: The CPU requires its own local memory in the form of registers and
also control unit requires local memories which are fast accessible.
• Internal (main): is often equated with the main memory (RAM).
• External (secondary): consists of peripheral storage devices like Hard disks,
magnetic tapes, etc. 2
… Cont’d

2. Capacity
• It is measured in bytes.
• Since the capacity of memory in a typical memory is very large, the prefixes kilo
(K), mega (M), and giga(G).
• A kilobyte is 210 = 1024 bytes, a megabyte is 220 bytes, and a giga byte is 230 bytes.
3. Unit of Transfer: is equal to the number of data lines into and out of memory module.
• Word: For internal memory, unit of transfer is equal to the number of data lines into
and out of the memory module.
• Block: For external memory, data are often transferred in much larger units than a
word, and these are referred to as blocks.
4. Access Method
• Sequential: Tape units have sequential access. 3
… Cont’d

• Data are generally stored in units called "records".


• Data is accessed sequentially; the records may be passed (or rejected) until the
record that is searched is found.
• Random: Each addressable location in memory has a unique addressing
mechanism.
• The time to access a given location is independent of the sequence of prior
accesses and constant.
• Any location can be selected at random and directly addressed and accessed.
• Main memory and cache systems are random access.
5. Performance
• Access time: For random-access memory, this is the time it takes to perform a read
4
or write operation: that is, the time from the instant that an address is presented to the
… Cont’d

• For nonrandom-access memory, access time is the time it takes to position the read-write
mechanism at the desired location.
• Transfer rate: This is the rate at which data can be transferred into or out of a memory unit.
6. Physical Type
• Semiconductor: Main memory, cache. RAM, ROM.
• Magnetic: Magnetic disks (hard disks), magnetic tape units.
• Optical: CD, DVD.
7. Physical Characteristics
• Volatile/nonvolatile: In a volatile memory, information decays naturally or is lost when
electrical power is switched off. RAM is erasable.
• Erasable/nonerasable: Nonerasable memory cannot be altered (except by destroying the
storage unit). ROM’s are nonerasable.

5
Memory Hierarchy

• A computer system is equipped with a hierarchy of memory subsystems.


• There are several memory types with very different physical properties.
• The important characteristics of memory devices are:
 cost per bit,
 access time,
 data transfer rate,
 alterability and compatibility with processor technologies.
• Figure 7.1 below shows the hierarchy of memory in a typical memory with a trend in
access time, amount of storage, and cost per byte.

6
Figure 7.1: Memory Hierarchy

 Design constraints: How much? How fast? How expensive?


• Faster access time, greater cost per bit
• Greater capacity, smaller cost per bit
• Greater capacity, slower access time
03/17/2025 7
Main Memory

• The main memory (RAM) stores data and instructions.


• RAMs are built from semiconductor materials.
• Semiconductor memories fall into two categories:
1. SRAMs (static RAMs)
2. DRAMs (dynamic RAMs).
1. STATIC RAM (SRAM): In a SRAM, binary values are stored using traditional flip-
flop logic-gate.
• A static RAM will hold its data as long as power is supplied to it.
2. DYNAMIC RAM (DRAM) is made with cells that store data as charge on capacitors.
• The presence or absence of charge in a capacitor is interpreted as a binary 1 or 0.
8
… Cont’d

Dynamic Vs Static RAM


• Dynamic RAM: for example: Charge in capacitor.
 It requires periodic refreshing.
• Static RAM: for example: Flip-flop logic-gate.
 Applying power is enough (no need for refreshing).
• Dynamic RAM is simpler and hence smaller than the static RAM.
 Therefore, it is denser and less expensive.
 But it requires supporting refresh circuitry.
• Static RAMs are faster than dynamic RAMs.
2. ROM: The data is actually wired in the factory.
• The data can never be altered. 9
… Cont’d

3. PROM: Programmable ROM.


• It can only be programmed once after its fabrication.
• It requires special device to program.
4. EPROM: Erasable Programmable ROM.
• It can be programmed multiple times.
• Whole capacity need to be erased by ultraviolet radiation before a new
programming activity.
• It cannot be partially programmed.
5. EEPROM: Electrically Erasable Programmable ROM.
• Erased and programmed electrically.
• It can be partially programmed.
10
• Write operation takes considerably longer time compared to read operation.
… Cont’d

Connection of RAM and CPU


• Data transfer between the main memory and the CPU register takes place
through two registers namely MAR (memory address register) and MDR
(memory data register).
 If MAR is k bits long and MDR is n bits long, the main memory unit can
contain up to 2k addressable locations.
 During a “memory cycle” n bits of data are transferred between main
memory and CPU.
 This transfer takes place over the processor bus, which has k address lines
and n data lines.
11
… Cont’d

Figure 7.2: Connection of RAM and CPU

• The CPU initiates a memory operation by loading the appropriate data into registers
MDR and MAR, and setting either Read or Write memory control line to 1.
• When the required operation is completed the memory control circuitry sends Memory
Function Completed (MFC) signal to CPU. 12
… Cont’d

• The time that elapses between the initiation of an operation and completion of
that operation is called memory access time.
• The minimum time delay between two successive memory operations is
called memory cycle time.
• The cycle time is usually slightly lower than the access time.

13
Cache Memory

• Cache memory is a small, high-speed RAM buffer located between the CPU and main
memory.
• Cache memory holds a copy of the instructions (instruction cache) or data (operand or
data cache) currently being used by the CPU.
• The main purpose of a cache is to accelerate your computer while keeping the price of
the computer low.

Figure 7.3: Placement of Cache memory in the computer 14


… Cont’d

Hit Ratio
• The ratio of the total number of hits divided by the total CPU accesses to memory (i.e. hits
plus misses) is called Hit Ratio.
• Hit Ratio = Total Number of Hits / (Total Number of Hits + Total Number of
Miss)
• Example: A system with 512 x 12 cache and 32 K x 12 of main memory.

Figure 7.4: Hit Ratio 15


Replacement Algorithms of Cache Memory

• Replacement algorithms are used when there is no available space in a cache in which
to place a data.
• Four cache replacement algorithms are:
1. Least Recently Used (LRU): selects for replacement the item that has been least
recently used by the CPU.
2. First-In-First-Out (FIFO): selects for replacement the item that has been in the cache
from the longest time.
3. Least Frequently Used (LFU): selects for replacement the item that has been least
frequently used by the CPU.
4. Random: selects for replacement the item randomly.
22
… Cont’d

Writing into Cache


• When memory write operations are performed, CPU first writes into the cache memory.
• These modifications made by CPU during a write operation, on the data saved in cache,
need to be written back to main memory or to auxiliary memory.
• These two popular cache write policies are:
1. Write-Through
2. Write-Back
1. Write-Through: In a write through cache, the main memory is updated each time the
CPU writes into cache.
• the main memory always contains the same data as the cache contains.
• This characteristic is desirable in a system which uses direct memory access scheme
of data transfer. 23
… Cont’d

• The I/O devices communicating through DMA receive the most recent data.
2. Write-Back: only the cache memory is updated during a write operation.
• The updated locations in the cache memory are marked by a flag so that later
on, when the word is removed from the cache, it is copied into the main
memory.
• The words are removed from the cache time to time to make room for a new
block of words.

24
Virtual Memory

• Virtual Memory refers to something which appears to be present but actually it is not.
• The virtual memory technique allows users to use more memory for a program than the
real memory of a computer.
• So, virtual memory is the concept that gives the illusion to the user that they will have
main memory equal to the capacity of secondary storage media.
• The program is stored in the secondary memory.
• The memory management unit (MMU) transfers the currently needed part of the
program from the secondary memory to the main memory for execution.
• This to and from movement of instructions and data between the main memory and the
secondary memory is called Swapping.
25
Address Space and Memory Space

• Virtual address is the address used by the programmer and the set of such addresses is called
the address space or virtual memory.
• An address in main memory is called a location or physical address.
• The set of such locations in main memory is called the memory space or physical memory.
• CPU generated logical address consisting of a logical page number plus the location within
that page (x).
• It must be mapped onto an actual (physical) main memory address by the operating system
using mapper.
• If the page is present in the main memory, CPU gets the required data from the main memory.
• If the mapper detects that the requested page is not present in main memory, a page fault
occurs and the page must be read from secondary storage (4, 5) into a page frame in main
26
memory.
… Cont’d

Figure 4.8: Address Space And Memory Space


27
… Cont’d

Address Mapping Using Memory Mapping Page Table


• When the requested page is not available in the main memory, we
can say that a page fault has been occurred in the main memory.
• Then the virtual address generated by the CPU is used to take out
the requested page from the secondary storage media to the main
memory to remove this page fault.
• If empty page frame is not available, then a page must be
removed from page frame in main memory.

28
Page Replacement Algorithms

• In a computer operating system that uses paging for virtual memory


management, page replacement algorithms decide which memory
pages to page out (swap out, write to disk) when a page of memory
needs to be allocated.
• Paging happens when a page fault occurs and a free page cannot be
used to satisfy the allocation, either because there are none, or
because the number of free pages is lower than some threshold.

29
… Cont’d

1. FIFO Algorithm
• Consider a paging system having capacity of 3 pages.
• The execution of a program requires references to five distinct pages P1, P2, P3,
P4 and P5.
• The pages are executed in the following sequence:
P2 P3 P2 P1 P5 P2 P4 P5 P3 P2 P5 P2

Figure 4.9: FIFO Algorithm 30


… Cont’d

• Page hit = 3
• Page fault = 9
• Total number of reference page (Page hit + Page fault ) = 12
• Hit ratio = (Page hit / Page hit + Page fault ) *100
= (3/12) * 100
= 25%
• Page Fault ratio = (Page fault / Page hit + Page fault ) *100
= (9/12) * 100
= 75%

31
… Cont’d

2. Least Recently Used (LRU)


• keeps track of page usage over a short period of time.
• implemented by associating a counter with every page that is in main
memory.
• When a page is referenced, its associated counter is set to 0.
• At fixed intervals of time, the counters associated with all pages
presently in memory are incremented by 1.
• The least recently used page is the page with the highest count.
• The counters are often called aging registers, as their count indicates
their age, that is, how long their associated pages have been referenced.
32
… Cont’d

• Consider a paging system having capacity of 3 pages.


• The execution of a program requires references to five distinct pages P1, P2, P3,
P4 and P5.
• The pages are executed in the following sequence:
P2 P3 P2 P1 P5 P2 P4 P5 P3 P2 P5 P2

Figure 4.10: Least Recently Used (LRU)


33
… Cont’d

• Page hit = 5
• Page fault = 7
• Total number of reference page (Page hit + Page fault ) = 12
• Hit ratio = (Page hit / Page hit + Page fault ) *100
= (5/12) * 100
= 41.67%
• Page Fault ratio = (Page fault / Page hit + Page fault ) *100
= (7/12) * 100
= 58.33%

34
… Cont’d

2. Optimal (OPT)
• The optimal policy selects that page for replacement for which the time to the next
reference is longest.
• results in fewest number of page faults.
• But, this algorithm is impossible to implement.
• At the time of page fault, the operating system has no way of knowing when each
of the pages will be referenced next.
• However, it does serve as a standard against which to judge other algorithms.
• Consider a paging system having capacity of 3 pages.
• The execution of a program requires references to five distinct pages P1, P2, P3,
P4 and P5.
35
… Cont’d

• The pages are executed in the following sequence:


P2 P3 P2 P1 P5 P2 P4 P5 P3 P2 P5 P2

Figure 4.11: Optimal (OPT)

36
… Cont’d

• Page hit = 6
• Page fault = 6
• Total number of reference page (Page hit + Page fault ) = 12
• Hit ratio = (Page hit / Page hit + Page fault ) *100
= (6/12) * 100
= 50%
• Page Fault ratio = (Page fault / Page hit + Page fault ) *100
= (6/12) * 100
= 50%

37
External Memory

• External Memory is also called Secondary memory.


 it is also called auxiliary memory.
 It stores information that is not necessarily in current use.
 It is slower and having higher capacity than primary memory.
 This kind of memory is large, slow and inexpensive.
 It is non-volatile storage media i.e. the contents are not erased when the power is
switched off.
• Magnetic tape
• Floppy disk
• Hard disk and
• Optical disk are the examples of secondary storage. 38
Magnetic Disks

• Commonly used direct-access secondary storage device.


• It is a thin, circular plate made of metal & plastic, which is coated with iron-oxide.
• We can randomly access the data.
• Can also be erased & reused indefinitely.
• They must be stored in dust free environment.
• It stores large amount of data.
• Come in different sizes.
• Due to large storage capacity of magnetic disks and lesser failures the use of these
devices increasing day by day.
• There are two types of magnetic disks: Floppy Disk and Hard Disk
39
… Cont’d

• More suitable than magnetic tapes for a wider range of applications because they
support direct access of data.
• Due to their low cost and high data recording densities, the cost per it of storage is low
for magnetic disks.
Benefit of magnetic disks
• Can be erased and reused many times.
• Suitable for both on-line and off-line storage of data.
• Floppy disks are compact and light in weight.
• Hence they are easy to handle and store.
• Very large amount of data can be stored in a small storage space.
• Data transfer rate for a magnetic disk system is normally higher than a tape
system. 40
… Cont’d

1. Floppy Disk
• Also known as floppies or diskettes.
• It was introduced by IBM in 1972.
• It is a portable, inexpensive, storage medium that consists of thin,
circular, flexible plastic Mylar film.
• Standard floppy disk has storage capacity up to 1.44MB.
• Floppy disks are compact, lightweight and easily portable from one place
to another.
• Most popular and inexpensive secondary storage medium used in small
computers. 41
… Cont’d

2. Hard Disk
• Round, flat piece of rigid metal (frequently aluminum) disks coated with magnetic
oxide.
• It is a storage device that contains one or more inflexible, circular patterns that
store data, instructions & information.
• We can store documents, presentation, database, e-mails, messages, music, video,
software etc.
• Come in many sizes, ranging from 1 to 14-inch diameter.
• Hard disk of capacities 10GB, 20GB, 40GB, 500GB, 1TB and even more are
easily available.
42
RAID(Redundant Array of Independent Disks) Technology

• RAID is a set of physical disk drives viewed by the operating system as a single logical
drive.
• Data are distributed across the physical drives of an array.
• Redundant disk capacity is used to store parity information which guarantees data
recoverability in case of a disk failure.

43
Optical Disks

• Consists of a circular disk, which is coated with a thin metal or some other material that is
highly reflective.
• Laser beam technology for recording and reading of data on the disk.
• Also known as laser disk / optical laser disk, due to the use of laser beam technology.
• Proved to be a promising random access medium for high capacity secondary storage because
it can store extremely large amounts of data in a limited space.
• Access times are typically in the range of 100 to 300 milliseconds and that of hard disks are in
the range of 10 to 30 milliseconds.
• The most popular optical disk uses a disk of 5.25-inch diameter with storage capacity of
around 650 Megabytes.
• The optical disk became the preferred medium for music, movies and software programs
44
because of its many advantages.
… Cont’d

• Compact, lightweight, durable and digital, the optical disk also provides a
minimum of 650 MB of data storage.
Types of Optical Disks
1. CD: Compact Disk.
• A non-erasable disk that stores digitized audio information.
• The standard system uses 12-cm disks and can record more than 60
minutes of uninterrupted playing time.
i. CD-ROM: Compact Disk-Read Only Memory
• A non-erasable disk used for storing computer data.
• The standard system uses 12-cm disks and can hold more than 650
45
Megabytes.
… Cont’d

ii. CD-R: CD Recordable


• The user can write to the disk only once.
iii. CD-RW: CD Rewriteable
• The user can erase and rewrite to the disk multiple times.
2. DVD: Digital Versatile Disk
• A technology for producing digitized, compressed representation of video
information, as well as large volumes of other digital data.
• Both 8 and 12 cm diameters are used, with a double-sided capacity of up to 17
GB.
• The basic DVD is read-only (DVD-ROM).
i. DVD-R: DVD Recordable
• The user can write to the disk only once.
• Only one-sided disks can be used. 46
… Cont’d

ii. DVD-RW: DVD Rewritable


• Only one-sided disks can be used.
• The user can erase and rewrite to the disk multiple times.
• Only one-sided disks can be used.
iii. Blu-Ray Disk
• Is a technology platform that can store sound and video while maintaining
high quality and also access the stored content in an easy-to-use way.
Advantage of Blu-ray Disc's
 large capacity and high-speed data transfer rate.
 Large recording capacity up to 27 GB.
 High-speed data transfer rate 36 Mbps.
 Easy to use disc cartridge. 47
… Cont’d

Advantage of Optical Disks


 The cost-per-bit of storage for optical disks is very low because of their
low cost and enormous storage density.
 Optical disk drives do not have any mechanical read/write heads to rub
against or crash into the disk surface.
• This makes optical disks a more reliable storage medium than
magnetic tapes or magnetic disks.
 Optical disks have a data storage life in excess of 30 years.
• This makes them a better storage medium for data archiving as
compared to magnetic tapes or magnetic disks.
48
… Cont’d

 Due to their compact size and light weight, optical disks are easy to
handle, store, and port from one place to another.
 Music CDs can be played on a computer having a CD-ROM drive
along with a sound board and speakers.
• This allows computer systems to be also used as music systems.
 As data once stored on an optical disk becomes permanent, danger of
stored data getting inadvertently erased/overwritten is removed.

49
… Cont’d

Limitation of Optical disk


• It is largely read-only (permanent) storage medium.
• Data once recorded, cannot be erased and hence the optical disks cannot
be reused.
• The data access speed for optical disks is slower than magnetic disks.
• Optical disks require a complicated drive mechanism.

50
Magnetic Tape
• Magnetic Tape is a plastic ribbon which is usually ½ inch or ¼ inch wide & 50 to 2400 feet
long.
 It is coated with iron-oxide material.
 It is similar to the tape of audio cassettes of tape recorders.
 Data is stored as binary digits.
 Data is accessed sequentially so searching becomes difficult.
Advantages
• Store data up to few gigabytes and Low cost.
• Magnetic tape used by both mainframes and microcomputers
Disadvantages:
• Sequential access so searching becomes difficult.
51
• We can either read or write data at one time.

You might also like