Chapter-3 Edited
Chapter-3 Edited
Contents
Characteristics and hierarchy of memory
systems
Cache memory
Main memory
Secondary memory
Virtual memory
Memory management
Characteristics of Memory System
• The memory unit is a essential
component in any digital computer since
it is needed for storing programs and
data.
1.Location : It represents the internal or
external location of the memory in a
computer. The internal memory is inbuilt in
computer memory.
• CPU: Registers
• Internal: Main memory and cache
• External: Storage devices (tapes, discs,
USB pen drive)
Characteristics of Memory System
2. Capacity
It is the most important feature of computer
memory. Storage capacity can vary in external
and internal memory. External devices'
storage capacity is measured in terms of Giga
bytes, whereas the internal memory is
measured with bytes or words. The storage
word length can vary in bits, such as 8, 16 or
32 bits.
Characteristics of Memory System
3.Unit of Transfer
bits that can be read or write in or out of the memory devices. The
o External memory: The transfer rate of bit or unit is not equal to the
j = i modulo m
Where:
i = main memory block number
j = cache block number
m = number of blocks in the cache
Cache Memory
Example
A computer system uses 16-bit memory addresses. It has a
2K-byte cache organized in a direct-mapped manner with 64
bytes per cache block. Assume that the size of each memory
word is 1 byte.
Calculate the number of bits in each of the Tag, Block/index,
and Word/block offset fields of the memory address.
Solution
Block size = 64 bytes = 2^6 bytes = 2^6 words (since 1 word = 1 byte)
Therefore, Number of bits in the Word field = 6
Cache size = 2K-byte = 2^11 bytes; Number of cache blocks = Cache
size / Block size = 2^11/2^6 = 2^5 Therefore, Number of bits in the
Block field = 5
Total number of address bits = 16
Therefore, Number of bits in the Tag field = 16 - 6 - 5 = 5
For a given 16-bit address, the 5 most significant bits, represent the Tag,
the next 5 bits represent the Block, and the 6 least significant bits
represent the Word/block offset.
Cache Memory
Associative Mapping: Here the mapping of the main memory block can be
done with any of the cache block. The memory address has only 2 fields; word
& tag. This technique is also called as fully associative cache mapping.
Example
Consider a fully associative mapped cache of size 16 KB with block size 256
bytes. The size of main memory is 128 KB. Find Number of bits in tag field.
Solution
Given
Cache memory size = 16 KB
Block size = Frame size = Line size = 256 bytes
Main memory size = 128 KB
We consider that the memory is byte addressable.
Number of Bits in Physical Address
Size of main memory = 128 KB = 2^17 bytes Thus, Number of bits in physical
address = 17 bits
Number of Bits in Block Offset
Block size = 256 bytes = 2^8 bytes Thus, Number of bits in block offset = 8
bits
Number of Bits in Tag
Number of bits in tag = Number of bits in physical address – Number of bits in
Cache Memory
Set-Associative Mapping: It is the combination of advantages of both
direct & associative mapping. Here, the cache consists of a number
sets, each of which consists of a number of blocks.
Example: Consider a 2-way set associative mapped cache of size 16
KB with block size 256 bytes. The size of main memory is 128 KB. Find
Number of bits in tag.
Solution
Given
Set size = 2
Cache memory size = 16 KB
Block size = Frame size = Line size = 256 bytes
Main memory size = 128 KB
We consider that the memory is byte addressable.
Number of Bits in Physical Address
Size of main memory = 128 KB = 217 bytes
Cache Memory
Number of Bits in Block Offset
Block size = 256 bytes = 28 bytes
Thus, Number of bits in block offset = 8 bits
4.The computer loads the OS from the hard drive into the
system’s RAM. CPU has immediate access to the OS as the
critical parts of the OS are maintained in RAM as long as the
computer is on.
This enhances the performance and functionality of the
overall system.
5.Now the system is ready for use.
Secondary Memory
6.When you load or open an application it is loaded in the
RAM.
Since the CPU looks for information in the RAM, any data
and instructions that are required for processing (read,
write or update) is brought into RAM.
To conserve RAM usage, many applications load only the
essential parts of the program initially and then load
other pieces as needed.