-2

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-------------------------------------|

1
  • Defragment / compact memory if possible. If the problem persists then wait. If waiting is not possible then fail. Commented Nov 7, 2017 at 23:37

1 Answer 1

2

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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.