Can anyone please tell me how many jvm instances will created when we issue the following commands in different commands.
- command 1: c:\java -Xms32m -Xmx512m -Xss254k AccountSalary
- command 2: d:\java -Xms32m -Xmx512m -Xss254k AccountSalary
- command 3: c:\java -Xms32m -Xmx512m -Xss254k AccountSalary
Whether they will use save jvm heap size or for each java process different heap size?
Infinite! Multiple JVMs can run on a single machine, as for example, for execution of applets a separate JVM may exist and another JVM can be started by the User for execution of Java Byte Code, on a single machine.
you can have as many jvm as you can running on a single machine as every java.exe or javaw.exe will star a new jvm. and regarding calling a method u can use RMI. Show activity on this post. Yes you can run multiple VMs on the same machine.
An implementation Its implementation is known as JRE (Java Runtime Environment). Runtime Instance Whenever you write java command on the command prompt to run the java class, an instance of JVM is created.
Each java invocation starts its own JVM.
Each time you run the java
command, you create a new JVM instances. (And each JVM instance will be a distinct process.)
So, in your example, the number of JVM instances will be 3.
JVM instances do not share heaps. Each one will have its own heap. There is no saving of heap space by creating multiple heaps. (In fact you probably use more heap space by creating multiple JVMs ... compared with running 3 instance of your application in the same JVM using multi-threading.)
The heap sizes are independent. They are determined by the individual JVMs' command line options ...
With most JVMs, the only memory that is shared between JVM instances is the read-only segment containing the JVM code, and (possibly) shared native libraries.
Historically, there have been JVMs where compiled Java code can be shared between JVMs. However, it is complicated, and (AFAIK) current generation JVMs don't support this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With