The concept of mutator thread is related to Garbage Collection.
The basic threading model in Hotspot is a 1:1 mapping between Java threads (an instance of java.lang.Thread) and native operating system threads.
What do the different (HotSpot) JVM thread types do?
In hotspot/src/share/vm/runtime/thread.hpp
// Class hierarchy
// - Thread
// - NamedThread
// - VMThread
// - ConcurrentGCThread
// - WorkerThread
// - GangWorker
// - GCTaskThread
// - JavaThread
// - various subclasses eg CompilerThread, ServiceThread
// - WatcherThread
JavaThread
is the nearest one to mutator thread. However, JavaThread
has some children classes:
CodeCacheSweeperThread
, CompilerThread
, // Usually I see C1, C2 compiler in JVMjmitiAgentThread
, ServiceThread
.I don't think CodeCacheSweeperThread, CompilerThread, jmitiAgentThread are mutator threads... But how is ServiceThread?
Besides, I think CompilerThread
should be an internal thread of JVM but not a mutator thread.
How to distinguish a mutator thread that is a Java program, say which thread does service the following single thread program (1:1 mapping)?
public class HelloWorld {
public static void main(String[] args) {
// Prints "Hello, World" to the terminal window.
System.out.println("Hello, World");
}
}
The concept of mutator thread is related to Garbage Collection.
AFAIK, It's not a term generally associated with Java as every thread is assumed to be able to modify the heap. 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.