What is Bitmap?


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 −

Bitmap

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.

Key Features of Bitmap

Some important features of bitmap are −

  • The unit size in bitmaps is very important and should be chosen with care.
  • If the unit size is smaller, the bitmap will be larger as it will hold the value 0 or 1 for each of the units. Similarly, if the unit size is larger, bitmap will be smaller.
  • The unit size need not be too large, as even with a unit size as small as 3 bytes, only one bit of the bitmap can represent 24 bits.,

Advantage of Bitmap

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.

Disadvantage of Bitmap

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.

Updated on: 31-Jan-2020

10K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements