سؤال

I am currently reviewing memory partitions and I have a problem that is really confusing me. Suppose you have 5 memory partitions: 100K, 500K, 200K, 300K, and 600K.

Also suppose you have 4 processes that need to be allocated memory. (212K, 417K, 112K, and 426K)

Using the First Fit algorithm and processing the allocations in the order above I see that 426K does not fit into any of the leftover partitions. Assuming it is last.

What happens in this case?

|100K|500K----------------------|200K----|300K-------|600K-------------------------------------|

هل كانت مفيدة؟

المحلول

In the case you describe, the last request for memory just cannot be fulfilled.

Obviously there is always the possibility that a memory request cannot be fulfilled - in your case, just ask for 601K, and it cannot be fulfilled. What will happen? That's a design decision, someone decides what should happen, someone writes code to implement it.

But that is really not part of the allocation algorithm, it's a completely separate problem. The memory allocation algorithm should focus on strategies that are most likely capable of fulfilling requests.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى softwareengineering.stackexchange
scroll top