Management Notes

Reference Notes for Management

Consider a swapping system in which memory consists of the following hole sizes 10K, 4K, 16K, 2K, 11Kbytes. Which holes are taken for the successive segment requests of 12K, 10K and 9K if the best fit algorithm

Consider a swapping system in which memory consists of the following hole sizes 10K, 4K, 16K, 2K, 11Kbytes. Which holes are taken for the successive segment requests of 12K, 10K and 9K if the best fit algorithm

 Options:

(a) 14K, 16K, 11K
(b) 14K, 10K, 11K
(c) 16K, 14K, 11K
(d) 16K, 11K, 14K
(e) 10K,14K,16K.

The Correct Answer Is:

(b) 14K, 10K, 11K

Correct Answer Explanation: (b) 14K, 10K, 11K

The correct answer to this problem is (b) 14K, 10K, 11K. This is determined by applying the best fit algorithm, which aims to allocate the smallest available hole that is large enough to accommodate the incoming segment.

In detail, when the first segment request of 12K is received, the best fit algorithm searches for the smallest hole that can accommodate 12K. The 14K hole is the best fit, leaving a remaining hole of 2K.

Next, when the 10K segment request comes in, the algorithm again searches for the smallest hole that can accommodate 10K. The 10K hole is the best fit from the remaining holes, leaving two holes: 4K and 2K.

Finally, when the 9K segment request arrives, the algorithm looks for the smallest hole that can fit 9K. The 11K hole is the best fit, leaving a remaining hole of 2K.

Now, let’s examine why the other options are not correct:

a) 14K, 16K, 11K:

The best fit for the 12K request is indeed the 14K hole, leaving 2K of unused space.

However, for the 10K request that follows, the best fit should be the 10K hole, which is not accounted for in this sequence. The 16K hole is chosen instead, which does not optimize memory usage.

Lastly, for the 9K request, the best fit should be the 11K hole, but this sequence places the 11K hole last, leading to suboptimal memory allocation.

(c) 16K, 14K, 11K:

Similar to the previous option, the first segment request is correctly allocated to the 14K hole.

However, for the 10K request, the best fit should be the 10K hole, but this sequence allocates the 16K hole, resulting in inefficiency.

Finally, the 11K hole is selected for the 9K request, which is also not in accordance with the best fit algorithm.

(d) 16K, 11K, 14K:

The 14K hole is correctly chosen for the 12K request, leaving 2K of unused space.

When the 10K request arrives, the best fit is the 10K hole, but this sequence allocates the 11K hole, leading to inefficient memory usage.

Lastly, for the 9K request, the 16K hole is selected, which is not the best fit and does not optimize memory allocation.

(e) 10K, 14K, 16K:

This sequence begins with the 10K hole for the 12K request, which is incorrect. The best fit for the 12K request should be the 14K hole.

Then, for the 10K request, the 14K hole is chosen, which doesn’t align with the best fit algorithm. The best fit should be the 10K hole.

Lastly, for the 9K request, the 16K hole is selected, which is not the best fit according to the algorithm.

In summary, all options apart from (b) fail to follow the best fit algorithm consistently across the three segment requests, leading to inefficient memory allocation and unused space in at least one of the allocations. The correct sequence, 14K, 10K, 11K, optimizes memory usage by selecting the best-fit holes for each segment request, minimizing wastage.

Related Posts

Smirti

Leave a Comment