An arrangement is provided for using bit vector toggling to achieve
concurrent mark-sweep garbage collection in a managed runtime system. A
heap may be divided into a number of heap blocks. Each heap block may
contain a mark bit vector pointer, a sweep bit vector pointer, and two
bit vectors of which one may be initially pointed to by the mark bit
vector pointer and used for marking and the other may be initially
pointed to by the sweep bit vector pointer and used for sweeping. At the
end of the marking phase for a heap block, the bit vector used for
marking and the bit vector used for sweeping may be toggled so that
marking phase and sweeping phase may proceed concurrently and both phases
may proceed concurrently with mutators.