Mark DURING Sweep rather than Mark then Sweep

  • Slides: 21
Download presentation
Mark DURING Sweep rather than Mark then Sweep Presented by Ram Mantsour Authors: Chrisitan

Mark DURING Sweep rather than Mark then Sweep Presented by Ram Mantsour Authors: Chrisitan Queinnec, Barbara Beaudoing, Jean -Pierre Queille.

Introduction n n Mark DURING Sweep is intended as a real-time GC. Regular GCs

Introduction n n Mark DURING Sweep is intended as a real-time GC. Regular GCs introduces delays which may affect real time applications. Features parallel collection algorithm (concurrent marker sweeper and application) Designed for real-time applications in embedded systems.

What Mark During Sweep has to fulfill n Short and predictable response time very

What Mark During Sweep has to fulfill n Short and predictable response time very short time lag between events and handler (approx 50 micro sec). n Guaranteed throughput To avoid unexpected GCs. n n Operation with Narrow memory. Execution time upper bound for an allocating task.

Problems with Known schemes n n n Stop-and-Copy wastes memory and has problem with

Problems with Known schemes n n n Stop-and-Copy wastes memory and has problem with VM systems. Mark-and-sweep in stop-andcollect mode even if introduces lazy sweep - has marking delay. On-the-fly (concurrent mutator and collector) - possible mutator starvation.

Mark-During-Sweep - terminology. n n Roots in their usual meaning + free list. Mutator

Mark-During-Sweep - terminology. n n Roots in their usual meaning + free list. Mutator and collector (marker and sweeper). Tricolor marking (whether by header bit or bitmap. Grey bit for mutator-marker cooperation). “No black cell can point to a white cell” holds for mutator and marker (P 1)

Mark-During-Sweep - terminology (cont) n n Marker phase is finished when all Grey cell

Mark-During-Sweep - terminology (cont) n n Marker phase is finished when all Grey cell vanish. Sweeper claims all white cells as garbage. Two generations operation sweeping current while marking the next. Working schemes and (P 1) hold for generation of the marker.

Mark-During-Sweep - terminology (cont). n Comparisons:

Mark-During-Sweep - terminology (cont). n Comparisons:

The Algorithm conventions. n n Left(i), right(i), colour. N (i), shade. N(i). Cell is

The Algorithm conventions. n n Left(i), right(i), colour. N (i), shade. N(i). Cell is :

The Algorithm conventions (cont). n Shade. N(i): if the cell is white turn it

The Algorithm conventions (cont). n Shade. N(i): if the cell is white turn it to Grey.

The Marker.

The Marker.

The Marker. (cont) n n Termination is ensured. Not the very efficient to simplify

The Marker. (cont) n n Termination is ensured. Not the very efficient to simplify proof.

The sweeper.

The sweeper.

The Sweeper. (cont) n n Shading is necessary for (P 1). White. N is

The Sweeper. (cont) n n Shading is necessary for (P 1). White. N is necessary for the N+2 marker.

The collector.

The collector.

The Mutator. n n Whenever an edge is redirected the target of the edge

The Mutator. n n Whenever an edge is redirected the target of the edge is shade. G+1 ed. G+1 is the generation of the current marker.

Case Analysis.

Case Analysis.

Incremental GC. n n n Memory size (M with 2*M ptrs). Mutator consumption speed

Incremental GC. n n n Memory size (M with 2*M ptrs). Mutator consumption speed (v. E cells to unit of times) Sweeper rate (r. S ratio of reclaimed to swept cells in unit of time). Free list length (L, and is instantenous ). Marker rate (r. M rate of marked/ visited).

Incremental GC. (cont) n n No mutator starvation. M/L cells to visit by the

Incremental GC. (cont) n n No mutator starvation. M/L cells to visit by the marker and the sweeper. L regulate the time of the GC. Two kind of real-time tasks can be identified.

Variants n n Flip flops rather than incrementing G Blackening instead of shading in

Variants n n Flip flops rather than incrementing G Blackening instead of shading in the sweeper. Using a global counter of Grey cells instead of rescanning the heap (marker). Mark recursively as much as possible then collect left “Greys”.

Conclusions n n An algorithm for real-time embedded systems that has predictable response time,

Conclusions n n An algorithm for real-time embedded systems that has predictable response time, guaranteed throughput and can work with narrow memories. Mutator marker and sweeper run concurrently.

The END

The END