Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 2

CARC103 Week 9 Tutorial – Memory (Ch 06 – Part 2)

Work on the following questions:

1. Suppose we have a byte-addressable computer using fully associative mapping with 16-bit
main memory addresses and 32 blocks of cache. If each block contains 16 bytes, determine
the size of the offset field.
ANS
Main memory =16 bits
Cache = 32 blocks
Block Size= 16 bytes
Size of offset field=?
Block size
= 16 bytes
= 24 bytes

Thus, Number of bits in block offset = 4 bits


The size of the offset field is 4.

2. Suppose we have a byte-addressable computer using fully associative mapping with 16-bit
main memory addresses and 32 blocks of cache. If each block contains 16 bytes, determine
the size of the tag field.
ANS
Memory address size= 16 bits
Number of cache blocks= 32
Size of each block = 16 bytes
Offest field = Size of each block= 2^{4} = 4 bits
Tag field size = 16(Total number of bits) - 4 (Offset field size) = 12

Therefore, tag field is of size = 12 bits


The size of the tag field is 12.

3. How caching and virtual memory help to enhance the performance of computers?
ANS
Because cache memory is quicker than RAM and is closer to the CPU, it can receive and
begin processing instructions and data much more rapidly. When data or instructions need
to be written back to memory, the same technique is used. A virtual memory system
emulates RAM by utilising a part of the hard disc. Virtual memory allows a system to execute
bigger or numerous programmes at the same time, allowing each one to function as if it had
more memory without needing to buy extra RAM.

4. Define following terms:


a. Virtual address- it is the logical or the program address that is created by the
processor or the use.
b. Physical address- Physical address is the physical location in the memory
c. Mapping- It is the process of translating virtual address into physical address.
d. Page frames- It is the division of equal size blocks which is located in the physical
memory.
e. Pages- Page has the equal size to a Page frame which is the block into which virtual
memory is divided. It is also stored in disk until needed.
f. Paging- It is the process of copying virtual page from disk to a page frame in main
memory.
g. Fragmentation- When a process is loaded and unloaded into memory, the free
memory is split into smaller chunks. After that, the process may not be able to
allocate memory blocks due to the small size of the process, leaving the memory
blocks unused. This problem is known as fragmentation.
h. Page fault- A page fault is an interruption that occurs when a software program
attempts to access a memory block not currently stored in the system's RAM.

5. What is memory fragmentation? How external and internal fragmentation take place?
ANS
Memory fragmentation is a kind of memory disruption characterised by defects or
inconsistencies in memory sequences, as well as "coherence and substance" in the narrative
or tale of the event. Internal fragmentation occurs when memory is divided into fixed-sized
partitions. External fragmentation occurs when memory is divided into variable size
partitions based on the size of processes.

6. Compare Paging and Segmentation with respect to virtual memory.


ANS
In terms of memory access, the paging strategy is quicker. Paging is faster than
segmentation. Internal fragmentation might result from paging because certain pages may
go unused. External fragmentation might result from segmentation because certain memory
blocks may not be used at all.

You might also like