Search code examples
javagarbage-collectionjvmjvm-hotspotjava-threads

Whether JVM runs in User Process or Separate Process


I have read JVM as a Process and as a deamon thread and As per Java, Each process has its own JVM and Garbage collector

Could some one please explain me with more details on this.

"Whether JVM runs on User Application Process or in Separate process." ??

Everywhere, I read it as an instance for Application Process. And I also read it as GC has multiple threads.

Whether GC is a separate process or it creates threads on User process.?


Solution

    1. JVM is running inside a process that was started by executing java.exe/javaw.exe on Windows or the java executable for Unix/GNU. Its owner would be the one that runs the executable. If two java programs are running then two JVMs in different processes will be created.

    2. GC is a thread inside the JVM, see here

    For example, the Java garbage collector is a daemon thread.