FOR FREE YEAR SOLVED

First Fit and Next Fit

 

1) First Fit 

Allocate the first hole that is big enough. Searching starts at the beginning of the set of holes. We can stop searching as soon as we find a free hole that is large enough.

 

The first-fit method keeps the free/busy lists organized by memory locations, low-order memory to high-order memory. 

 

Let’s take an example, now one process P3 wants to allocate at the memory, and according to the first fit whenever the process P3 will get available space first, fit in it if available space fit for it.

 

If the P3 size is 30MB then it fit the first location of the memory, first appropriate free location size is 100MB so, it is appropriate for P3

 

 

2) Next Fit:

Next fit whenever the pointer right now at the memory (linked list) at this moment, it will search from this location, not again from the first position.

 

 Let us take an example if the pointer of the memory (linked list) at position 2, and P4 with size 8 MB want to allocated, then it searches for appropriate place P4 from position 2 (not from first), it works like the first fit and allocated at appropriate free position with size 40 MB, but not first position, from current position.