Problem

The case study presents an in-place nonincremental garbage collector. Modify and extend it...

The case study presents an in-place nonincremental garbage collector. Modify and extend it to become an incremental collector. In this case, program() becomes mutator(), which allows the function collect() to process k cells for some value of k. To prevent mutator() from introducing inconsistencies in structures possibly not completely processed by collect(), mutator() should transfer any unmarked cells from freeCells to markDescendants.

Another very elegant modification is obtained by grouping all four lists in a circular list, creating what Henry Baker (1992) called a treadmill (Figure 1a). Pointer free is moved in a clockwise direction if a new cell is requested; pointer toBeMarked is moved k times when allowed by the mutator. For each nonatom cell currently scanned by toBeMarked, its head and tail are transferred in front of toBeMarked if they are not marked. After toBeMarked meets endNonFree, there are no cells to be marked, and after free meets nonFree, there are no free cells on the list of free cells (Figure 1b). In this case, what remains between nonFree and endNonFree (former nonFreeCells) is garbage, and hence, it can be utilized by the mutator. Therefore, the roles of nonFree and endNonFree are exchanged; it is as though nonFreeCells became freeCells (Figure 1c). All root pointers are transferred to a part of the treadmill between toBeMarked and endFree (to create a seed of the former markDescendants) and the mutator can resume execution.

Figure 1 Baker’s treadmill.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 12
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT