In: Computer Science
List two algorithms commonly used to identify a frame for replacement
1.
First In First Out (FIFO) :
Here, whenever there is a need of replacement, the frame that came into the memory the earliest, is removed/replaced.
For example, let's say the memory can hold a maximum of 3 frames, in slots s1, s2, s3.
Following is a sample sequencing :
As seen, frame 5 (which came in first amongst all of frames 5, 1, 14) was replaced, and the incoming frame 18 replaced in its place.
2.
Least Recently Used (LRU) :
Here, whenever there is a need of replacement, the frame that has been used least recently, is removed.
We take the same example as above.
Also, we maintain a linked list, where the element on the leftmost side is the oldest (least recently used), and the element on the rightmost is newest (most recently used).
As seen, frame 1 (which was the least recently used frame) was replaced, and the incoming frame 18 replaced in its place.