43.6k views
5 votes
Consider the following two page replacement strategies: FIFO (First-In, First-Out) is a page replacement strategy in which the page that is evicted is the one that has been currently in the cache for the longest duration. LIFO (Last-in, First-Out) is a page replacement strategy in which the page that is evicted is the one that was brought into cache most recently in time.

(a) Show that neither FIFO nor LIFO is a marking algorithm. The following definition applies to parts (b) and (c):
Subsequence Property: A cache replacement policy P has the subsequence property if it satisfies the following: Let k be the size of the cache. Let σ be a sequence of memory accesses and let σ′ be any contiguous subsequence of σ that accesses at most k distinct memory locations. Then, P performs at most k evictions on σ′
(b) Determine whether or not each of FIFO and LIFO has the subsequence policy.
(c) Prove that any cache replacement policy that has the subsequence property has competitive ratio k/k−h+1, where k is the size of the cache, and h≤k is the size of the cache for OPT, the optimal offline cache replacement policy.

User Jenni
by
7.9k points

1 Answer

2 votes

Final answer:

Neither FIFO nor LIFO are marking algorithms, and both do not possess the subsequence property. Any replacement policy with the subsequence property has a competitive ratio of k/k-h+1, where k is the cache size for the policy and h is for the optimal policy.

Step-by-step explanation:

To address whether FIFO (First-In, First-Out) and LIFO (Last-In, First-Out) are marking algorithms, we should first understand that a marking algorithm is a type of cache replacement policy that can guarantee a competitive ratio of 2, which neither FIFO nor LIFO can do because they do not adapt to patterns in the request sequence.

FIFO tends to favor pages that have been in the cache the longest, regardless of the request sequence. Consequently, it does not have the subsequence property because it can evict more than k pages from a contiguous subsequence of accesses to k pages. On the other hand, LIFO evicts the most recently added page, which could have been a part of the contiguous subsequence of k accesses and might still lead to more than k evictions, showing that it also does not have the subsequence property. For any cache replacement policy P that has the subsequence property, the competitive ratio is k/k-h+1 where k is the cache size and h is the optimal cache size. The proof is not directly provided but involves showing that the number of evictions P makes is at most the number of evictions OPT makes plus the number of distinct pages in the extended sequence of memory accesses.

User Xstatic
by
7.3k points