OS Tutorial #3

You might also like

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

OS Tutorial #3

1. What is the purpose of a page replacement algorithm?

These algorithms are used in operating systems that utilize paging


technique for virtual memory management. Page Replacement
Algorithms determine which pages swap in/out of memory when a
page needs to be allocated to memory.

2. Briefly explain what is meant by Belady's Anomaly

Belady’s Anomaly states that page faults may occur as the number
of pages in memory increase. The FIFO page replacement algorithm
is easy to program and understand but is not always efficient. That
was recognized by Belady in 1970 and hence forth the name
Belady’s Anamoly.

3. Differentiate between FIFO, LRU, MFU and the second


chance algorithm. In each case give an example.

FIFO – in this algorithm the Operating System keeps track of all the
pages in memory by using a queue. The most recent pages are
stored in the back and the earliest at the front.

LRU – Least Recently Used algorithm states that pages that have
been most heavily used in the past few instructions are most likely
to be used heavily in the next few instructions too.

MFU – unlike LRU, this algorithm discards the most recently used
items first.
e.g. Database memory caches.

Second Chance – this is a modified form of the FIFO algorithm in


which unlike FIFO that just looks at the front of the queue and
immediately swaps out a page, it checks to see if its referenced bit
is set. If it is not set, the page is swapped out. Otherwise, the
referenced bit is cleared and the page is inserted at the back of the
queue.

4. What factors would you use to consider that memory is using an


optimal Page Replacement?

• CPU Usage
• Memory Usage

5. Memory Compaction Explained.

Memory Compaction is the relocation of all partitions in a variable-


OS Tutorial #3

partition multiprogramming system to one end of main memory to


create the largest possible memory space. This is done in Windows
by a feature called disk defragmentation.

You might also like