OS 5 Mark Answers
OS 5 Mark Answers
Memory fragmentation occurs when memory is not used efficiently. There are three types:
1. Internal Fragmentation
Happens when fixed-size memory blocks are allocated, and the process doesn't use the entire block.
2. External Fragmentation
Occurs when total free memory is enough, but it is scattered and not contiguous.
Example: Free blocks: 100 KB, 200 KB, and 300 KB. A request for 500 KB can't be fulfilled.
3. Compaction
A method to deal with external fragmentation by combining all free spaces into one large block. However, it is
CPU-intensive.
Q2. Explain virtual memory concept with respect to paging, segmentation and TLB
Virtual Memory allows execution of processes that may not be completely in main memory. It uses disk space
1. Paging
Divides memory into fixed-size pages (logical) and frames (physical). The OS maps pages to frames using a
page table.
2. Segmentation
Divides memory into logical units called segments (code, data, stack). Each segment has a base and a limit.
A cache that stores recent page table entries to speed up address translation.
Partition selection algorithms allocate memory to processes from available memory blocks.
Given:
First Fit:
Best Fit:
Worst Fit:
Conclusion: Best Fit makes the most efficient use of memory in this case.
Reference String: 3, 0, 4, 3, 2, 1, 4, 6, 3, 0, 8, 9, 3, 8, 5
Page Faults:
FIFO: 12
LRU: 10
Optimal: 9
VFS is an abstraction in Linux that allows different file systems to be accessed using a common interface.
Components:
Benefits:
- Easy to extend