Question: please write in java 30 5 30 5 h h (iii) Evict LFU. This algorithm evicts the pages in the LFU (least frequently used) principle.

30 5 30 5 h h (iii) Evict LFU. This algorithm evicts the pages in the LFU (least frequently used) principle. This means that the algorithm keeps a count of how many times a page in the cache has been requested since it is placed in the cache and evicts the page that has the smallest count. If there are two or more pages with the same count, the one with a smaller index (i.e., leftmost such page in the cache) is evicted. We assume that the initial cache content each has a count of 1 to start with. The frequency count is reset to 1 if a page is evicted, in other words, a page entering the cache will have a count of 1. The hit and miss sequence will then be hhmhhh with 5 h and 1 m. request cache beforehand hit/miss cache afterward remarks 20 20 30 10 h no change 20 30 10 h no change 20 30 10 20 30 5 20 and 30 have count 2 while 10 has count 1 and is evicted 20 30 5 no change 20 30 5 no change 20 20 30 5 h no change (iv) Evict LFD. This algorithm evicts the pages in the LFD (longest forward distance) prin- ciple. This means that the algorithm looks at future requests and evicts the page whose next request is the latest. If there are two or more pages with the same distance to next request because they are not requested anymore, the one with a smaller index (i.c. leftmost such page in the cache) is evicted. The hit miss sequence is hhmhhh with 5 h and 1 m. request cache beforehand hit/miss cache afterward position of next request 20 30 10 120 20 30 10 no change 620 20 30 10 no change 640 20 30 10 20 30 5 615 30 20 30 5 no change 20 30 5 h no change 20 20 30 5 h no change 20 30 5 h h h 5 Csize, ISIZ CArray TArray, evictLFU(int[] cArray, int cSize, int[] rArray, int rSize) evictLFD(int[] cArray, int cSize, int[] rArray, int rSize) 1091 . DIA TRINO 30 5 30 5 h h (iii) Evict LFU. This algorithm evicts the pages in the LFU (least frequently used) principle. This means that the algorithm keeps a count of how many times a page in the cache has been requested since it is placed in the cache and evicts the page that has the smallest count. If there are two or more pages with the same count, the one with a smaller index (i.e., leftmost such page in the cache) is evicted. We assume that the initial cache content each has a count of 1 to start with. The frequency count is reset to 1 if a page is evicted, in other words, a page entering the cache will have a count of 1. The hit and miss sequence will then be hhmhhh with 5 h and 1 m. request cache beforehand hit/miss cache afterward remarks 20 20 30 10 h no change 20 30 10 h no change 20 30 10 20 30 5 20 and 30 have count 2 while 10 has count 1 and is evicted 20 30 5 no change 20 30 5 no change 20 20 30 5 h no change (iv) Evict LFD. This algorithm evicts the pages in the LFD (longest forward distance) prin- ciple. This means that the algorithm looks at future requests and evicts the page whose next request is the latest. If there are two or more pages with the same distance to next request because they are not requested anymore, the one with a smaller index (i.c. leftmost such page in the cache) is evicted. The hit miss sequence is hhmhhh with 5 h and 1 m. request cache beforehand hit/miss cache afterward position of next request 20 30 10 120 20 30 10 no change 620 20 30 10 no change 640 20 30 10 20 30 5 615 30 20 30 5 no change 20 30 5 h no change 20 20 30 5 h no change 20 30 5 h h h 5 Csize, ISIZ CArray TArray, evictLFU(int[] cArray, int cSize, int[] rArray, int rSize) evictLFD(int[] cArray, int cSize, int[] rArray, int rSize) 1091 . DIA TRINO
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
