Close
Register
Close Window

OpenDSA Stand-alone Modules

Chapter 0 modules

Show Source |    | About   «  0.136. Sequential-Fit Methods   ::   Contents   ::   0.138. Circular First Fit  »

First Fit

1. First Fit

The simplest method for selecting a block would be to move down the free block list until a block of size at least 30 is found. Any remaining space in this block is left on the freelist. If we begin at the beginning of the list and work down to the first free block at least as large as 30, we select the block of size 35. 30 units of storage will be allocated, leaving a free block with 5 units of space. Because this approach selects the first block with enough space, it is called first fit.

Now try it for yourself with the following exercise.

   «  0.136. Sequential-Fit Methods   ::   Contents   ::   0.138. Circular First Fit  »

nsf
Close Window