What is the difference between a mutator thread and a gc thread




















How to distinguish a mutator thread that is a Java program, say which thread does service the following single thread program mapping? There are exceptions such as the compiler threads which only modify the native code translations.

In general, I would assume any thread can modify state unless you have a specific reason to believe otherwise. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Ask Question.

Asked 3 years, 11 months ago. Active 3 years, 10 months ago. Viewed times. The concept of mutator thread is related to Garbage Collection.

How do you know the JVM even has a mutator thread? And what do you mean by 'catch'? EJP I change it to "distinguish" now. Add a comment. Raw pointers to on-heap objects have a risk of creating an edge Oilpan cannot understand and causing a use-after-free.

Raw pointers shall not be used to reference on-heap objects except raw pointers on native stacks. Exceptions can be made if the target object is guaranteed to be kept alive in other ways. Invoke pre-finalizers. At this point, no destructors have been invoked. Thus the pre-finalizers are allowed to touch any other on-heap objects which may get destructed in this sweeping phase. Step 3. As the mutator allocates new objects, lazy sweeping invokes destructors of the remaining dead objects incrementally.

There is no guarantee of the order in which the destructors are invoked. That's why destructors must not touch any other on-heap objects which might have already been destructed.

If some destructor unavoidably needs to touch other on-heap objects, it will have to be converted to a pre-finalizer. The pre-finalizer is allowed to touch other on-heap objects. The mutator is resumed before all the destructors has run. For example, imagine a case where X is a client of Y, and Y holds a list of clients. This causes a use-after-free. Methods in dynamically loaded classes are only assumed to conform if their method contexts are identical to those of already loaded methods.

Better conformance rules for dynamically loaded classes are almost certainly possible. Efficient use of the heap by many heaplets will be vital. We intend to remove the additional indirections required by calls to specialised methods through shadow vtables. Above all, this system offers a wide design space for garbage collection policy.

For example, how rapidly and to what size should heaplets be expanded? The simplest growth policy is to expand heaplets by one LAB at a time. However, it might be better to allow memory-greedy threads to expand more rapidly in order to reduce LAB-manager synchronisation overhead. It is also important to decide when to collect and what to collect.

Again, a simple solution may be allow heaplets to grow without restraint and to collect a heaplet only when the heap is full. However, as we noted above, this policy is likely to cause all threads to collect at about the same time - when the heap is full. It may be better to force a thread to collect by denying a request for a LAB when its volume of allocation since its last collection has exceed a threshold [ zorn89 ].

Assuming a mix of thread behaviours, such a policy will reduce the tendency of all threads to collect simultaneously. A variation on this solution is to favour threads that are more active. Suppose the thread mix consists of a number of threads with growing memory footprints and other threads that have more stationary footprints.

Rather than force the growing threads to collect repeatedly which may offer comparatively small returns if the thread is constructing a large data structure - a commonly observed behaviour , it may be better to force collection of threads whose growth phase has stopped by denying LAB allocation requests. Similarly, denial of LAB requests may be used to ensure that no thread remains uncollected for long periods of time. Other collection policies based on a thread's allocation and collection history are possible.

Conclusion We have presented a novel static analysis and garbage collector design that allows the heap to be divided into thread-specific heaplets that can be collected independently, thereby removing need to synchronise all mutator threads for GC. The analysis and collector have been incorporated into a production JVM. Acknowledgements Much gratitude is due to the following people: Richard Jones, for the invaluable contributions he made and the immeasurable patience he showed throughout this work; Steve Heller and David Detlefs of the Java Technology Group at Sun Microsystems Laboratories East for providing RJVM; Ralph Miarka, for assisting with the layout of this document.

Footnotes 1. Liveness by reachability provides a conservative estimate of what is live. Objects may no longer be needed by the application even though they are reachable from the roots [ hirz02a ]. Mutator is the term used in the memory management literature for the application program. From the memory manager's point of view, all it does is change the shape of the object graph.

Actually, shared heaplets could be collected separately cf. Beltway [ blac02 ] but either the world would have to be stopped or an incremental collector used. References ages98a O. GC points in a threaded environment. Agesen, D. Detlefs, and J. Garbage collection and local variable type-precision and liveness in Java Virtual Machines. ACM Press. Aldrich, C. Chambers, E.

Sirer, and S. Static analyses for eliminating unnecessary synchronization from Java programs. Springer-Verlag, September Aldrich, E. Sirer, C. Chambers, and S. Comprehensive synchronization elimination for Java. Science of Computer Programming , Alpern, C. Attanasio, A. Cocchi, D. Lieber, S. Smith, T. Ngo, J. Barton, S. Hummel, J. Sheperd, and M.

Implementing Jalapeno in Java. Alpern, D. Attanasio, J. Barton, M. Burke, P. Cheng, J. Choi, A. Cocchi, S. Fink, D. Grove, M. Hind, S. Hummel, D. Lieber, V. Litvinov, M. Mergen, T. Russell, V. Sarkar, M. Serrano, J. Shepherd, S. Smith, V. Sreedhar, H. Srinivasan, and J. The Jalapeno virtual machine. Support for garbage collection at every instruction in a Java compiler. Blackburn, R. Jones, K. McKinley, and J. Beltway: Getting around garbage collection gridlock.

In PLDI02, pages Escape analysis for object oriented languages. Boehm and M. Garbage collection in an uncooperative environment.



0コメント

  • 1000 / 1000