Download Scheduling Garbage Collection in Embedded Systems

Transcript
36
Chapter 3
Automatic Memory Management
[Ben90] has generalized Brooks’ algorithm to handle multiple generations, giving
the collector the advantages of the generation-based algorithms while still preserving reasonable real-time properties.
Making copying and mark-sweep algorithms incremental increases the realtime performance of the algorithms, but at the same time introduces new sources
of overhead. One such source is the additional work that has to be performed by
read and write barriers. Another source of overhead is floating objects. It might
happen during a GC cycle that an object that has been marked as live by the collector becomes unreachable due to the actions of the mutator. The collector will
retain the object and the memory occupied by the object will not be reclaimed during the on-going cycle. The memory will be reclaimed during the next cycle, but
floating objects will cause both some storage and time overhead. Bengtsson’s thesis
[Ben90] contains a thorough analysis of the efficiency of different incremental GC
algorithms.
Special properties of the system or programming languages can in some situations be used to achieve performance sufficient for soft real-time systems. An
example of this is early versions of the Erlang programming language [ADVW92].
Here, each process was assigned a separate heap. The heap size was in most cases
just a few hundred bytes. Due to language properties, there could be no pointers
between objects allocated on different heaps; processes communicated by passing
copies of data objects to each other. The heaps were garbage collected individually
using a stop-the-world policy, but since the heaps were very small so were the individual delays. The technique is, however, not generally applicable to other types of
systems: The strategy does not scale up when larger heaps are required. In addition, the overhead for keeping track of references from one heap to another
increases quickly as the number of heaps is increased.
3.8 Scheduling properties
Systems that have to comply with real-time demands also put demands on the
memory management strategy. The chosen strategy must be efficient enough not
to prevent the software from meeting its deadlines. Several levels of real-time
demands exist. Some applications may have very relaxed demands while others
may have very strict demands. Different memory management solutions might be
appropriate depending on the level of real-time demands. This section discusses
which memory management strategies are available to meet various timing
requirements.
3.8.1 Stop-the-world
The only time-related requirement for a batch system is that the time for the
processing should be as short as possible. This implies that a GC strategy that min-