*
The moose likes Java in General and the fly likes JVM Instances Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "JVM Instances" Watch "JVM Instances" New topic
Author

JVM Instances

sihani rani
Ranch Hand

Joined: Jun 22, 2010
Posts: 32

I have lots of sonfusion about JVM and JVM instance.i ggogle it but could found related topics.my question is,

1)what is JVM instance?is there any different between JVM instanse and JVm(Means all JVM instance is difernet JVM)?
2)does application runs on diferent JVM or different JVM instance?
3)In eclipse i have configured one JVM in eclipse.ini file.where as i have mutiple projects in eclipse.all are useing one JVM?

Kindly help me.
Thanks in advance.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14104
    
  16

There are not two different things named "JVM" and "JVM instance". This is only an understanding of language problem. Your questions 1 and 2 are therefore not really meaningful.

When you start multiple Java programs on your computer, each of those programs will run in a separate process, with a separate JVM (instance).

Question 3: Only when you run your program from Eclipse, a new process, with a new JVM, will be started, in which your program is run. Just because you've opened a project in Eclipse to work on the code doesn't mean that there's a JVM running for that project.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
sihani rani
Ranch Hand

Joined: Jun 22, 2010
Posts: 32
Jesper de Jong wrote:There are not two different things named "JVM" and "JVM instance". This is only an understanding of language problem. Your questions 1 and 2 are therefore not really meaningful.

When you start multiple Java programs on your computer, each of those programs will run in a separate process, with a separate JVM (instance).

Question 3: Only when you run your program from Eclipse, a new process, with a new JVM, will be started, in which your program is run. Just because you've opened a project in Eclipse to work on the code doesn't mean that there's a JVM running for that project.


Thanks for your reply Jesper de Jong,

In each operating system having one JVM.but in windows task manager i can see more than one java.exe.
In here my question is
1)each java.exe process is different JVM or it is pointing to same JVM?
2)all JVM instance are having separate memory and heap and method area?..if its having different memmory and heap then it is different JVM,right?

Kindly give a solution on this.


Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14104
    
  16

sihani rani wrote:In each operating system having one JVM. but in windows task manager i can see more than one java.exe.

For each operating system, somebody has to implement a JVM specifically for that operating system. For example, Oracle implements a JVM for Windows and another one for Linux, and also for other operating systems. IBM implements a JVM for AIX, HP implements a JVM for HP-UX, etc.

sihani rani wrote:
1) each java.exe process is different JVM or it is pointing to same JVM?
2) all JVM instance are having separate memory and heap and method area?..if its having different memmory and heap then it is different JVM,right?

Each java.exe process is a separate JVM instance. Processes are normally isolated from one another. In the RAM of the computer, each java.exe process has its own copy (instance) of the JVM, its own memory space, its own heap.
sihani rani
Ranch Hand

Joined: Jun 22, 2010
Posts: 32
again thank you verymuch Jesper de Jong

now i understand the picture.

is each jvm instace sharing base JVM memory which we have configured initially?
can i add multiple JVM to Application Server?
If Yes,i have multiple application installed in App server.can i configure each application should run under some specific JVM??


Thanks in advance.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14104
    
  16

sihani rani wrote:is each jvm instace sharing base JVM memory which we have configured initially?

Where have you configured "base JVM memory"? Since JVMs run in separate processes, they do not share memory.

sihani rani wrote:can i add multiple JVM to Application Server?

You could have multiple JVMs running multiple instances of an application server that work together in a cluster. Usually you would run those on separate servers, and have them communicate via the network.
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Jesper de Jong wrote:
sihani rani wrote:is each jvm instace sharing base JVM memory which we have configured initially?

Where have you configured "base JVM memory"? Since JVMs run in separate processes, they do not share memory.


Actually they do, to a limited extent, in some cases.

Hey may be talking about the fact that some JVMs will share certain read-only portions of the core API (just native executable code maybe?) if you start multiple copies of the JVM at the same time, to reduce the combined memory footprint. I think I remember reading about that being put into some version of the Windows JVM a few years ago. And if Windows can do it, I assume Linux can too.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: JVM Instances