Sunday, March 31, 2013

MMTk mechanisms, policies, and plans

Class Diagram: MMTk Policies
MMTk is a flexible memory management utility written using java, for Jikes RVM. It is also ported to Rotor - the Microsoft's open C# runtime. Key Compositional Elements in MMTk are utilities, policies, and plans.

Bootstrapping
Jikes is meta-circular, as it is written in Java, the language it interprets as a JVM. Here, the functionality of the parent interpreter is applied directly to the source code being interpreted, without any additional implementation. Hence it requires a bootstrap VM to run upon, to create a boot image. However, it doesn't run on an external JVM. Rather, a small boot image runner written using C is responsible for loading the image files at run time, and it transfers the control to the native VM code that runs on the host [1].

Interruptibility
Compiler pragmas are used by MMTk to control the inlining and interruptibility, and scoped across methods and classes, where more specific pragma scopes such as method pragmas override the broader ones such as class pragmas. Classes annotated @Uninterruptible make the class uninterruptible. If most of the methods in a class are uninterruptible, annotating the class as uninterruptible is reasonable and preferred. All the policies and plans have the unintteruptible classes.


1) Mechanisms (utility)
MMTk comes with the utility classes that provides mechanism for the memory management, across multiple policies and plans that use those policies. An ideal example showing the usage of the utility package is, the interface Constants. All the classes either implement the Constants interface, or are sub classes of the classes that implement the interface.

1. Bump pointer allocation
2. Free list allocation
3. Large object allocation
4. Finalization

2) Policies (policy)
Spaces are contiguous regions of virtual memory, that is managed by a single policy. MMTk maps policies to spaces. In an address space, any given policy can manage multiple spaces.

Policies are implemented following the local/global pattern, and named XXXSpace and XXXLocal.
1. Copying Collector - CopySpace extends Space | CopyLocal extends BumpPointer
Class Diagram: MMTk Plans
2. Explicitly Managed Collector - ExplicitFreeListSpace extends SegregatedFreeListSpace | ExplicitFreeListLocal extends SegregatedFreeListLocal
3. ExplicitLargeObjectSpace extends BaseLargeObjectSpace |
4. Immortal Collector - ImmortalSpace extends Space | ImmortalLocal extends BumpPointer
5. Treadmill Collector - LargeObjectSpace extends BaseLargeObjectSpace | LargeObjectLocal extends LargeObjectAllocator
6. Mark-Compact Collector (MarkCompactCollector) - MarkCompactSpace extends Space | MarkCompactLocal extends BumpPointer
7. Mark-Sweep Collector - MarkSweepSpace extends SegregatedFreeListSpace | MarkSweepLocal extends SegregatedFreeListLocal
8. RawPageSpace extends Space
9. SegregatedFreeListSpace extends Space

Each instance of a policy space maps to a single virtual memory space, with P instances of the local class attached, where the collector is P-way parallel.


3) Plans (plan)
It is the highest level of composition, as it composes policies to build a memory management algorithm.
1. CMS (concurrent.marksweep)
2. CopyMS (copyms)
3. GenCopy (generational.copying)
4. GenMS (generational.marksweep)
5. GenImmix (generational.immix)
6. MC (markcompact)
7. MS (marksweep)
8. RC (refcount.fullheap)

9. GenRC (refcount.generational)
10. SS (semispace)
11. GCTrace (semispace.gctrace)
12. UsePrimitiveWriteBarriers (semispace.usePrimitiveWriteBarriers)
13. StickyImmix (stickyimmix)
14. StickyMS (stickyms)

No comments:

Post a Comment

You are welcome to provide your opinions in the comments. Spam comments and comments with random links will be deleted.