xyz
xyz

Reputation: 8917

Do 2 java processes share JVM

Say I run 2 java processes in a machine, do they share JVM or they have their own separate JVM. I remember setting something like export JVM_OPTS="-Xms64m -Xmx1024m"

then which JVM is this for?

Upvotes: 4

Views: 662

Answers (3)

Andrea Colleoni
Andrea Colleoni

Reputation: 6021

They have their own separate JVM.
If you export JVM_OPTS, the variable affects all JVMs reading that value.
If you want to share JVM among different computations you must use multithreading.

Upvotes: 4

Flavio
Flavio

Reputation: 11977

The two processes are separate, you can see two of them in the process list. The options you specified will be used by all the JVMs you will start on that machine.

Upvotes: 0

Matteo
Matteo

Reputation: 14930

You will start two JVM processes.

The settings in JVM_OPTS will be read from both when starting and both will create an allocation pool with a maximum size of 1GB

Upvotes: 2

Related Questions