A bitmap is a mapping from one system such as integers to bits. It is also known as bitmap index or a bit array.
The memory is divided into units for bitmap. These units may range from a few bytes to several kilobytes. Each memory unit is associated with a bit in the bitmap. If the unit is occupied, the bit is 1 and if it is empty, the bit is zero.
The bitmap provides a relatively easy way to keep track of memory as the size of the bitmap is only dependent on the size of the memory and the size of the units.
An image that clarifies the use of bitmap is as follows −
The bitmap given in the image writes 1 for the occupied memory unit and 0 for the unoccupied memory unit. The first 5 units are occupied with A and the corresponding entry in the bitmap is 11111. The next three units are empty so their entry in the bitmap is 000. After that, 6 units occupy B. So there entry in the bitmap is 11111. This continues and the result obtained in the bitmap for A, B, C, D and E is shown in the image.
Some important features of bitmap are −
The bitmap is quite useful as it provides a way to keep track of the memory using only a little memory for the bitmap table. The size of the bitmap is purely dependent on the size of the memory as well as the size of the memory unit.
A major problem in the bitmap occurs if a ‘n’ size memory block needs to be occupied by a process. Then a ‘n’ size vacancy is needed in the bitmap where the values are all zeroes.