Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

JVM, how it works?

 
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all:
I want to know how many JVMs can run in one host at a time? Can some one go throw the steps starting from running a program. How about if there are more than one program running at a time? If there are more than one JVM running, do they share the memory, or each JVM has ita own memory? What is the stuition in J2EE server, like tomcat. Is ther a limit on how much memory can be allocated to the jvm?
thanks
 
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Hanna
From www.artima.com, some free chapters on JVM might help from the book "Inside the Java Virtual Machine".
In addition to all of other googling , there is this guy "Robert Paris" who have done many system level things in terms of JVM, I guess, as I saw his posts on "Advanced" forum about questions I couldn't answer If he is looking at this thread he can share his experiences with us while other ranchers jump in with more input on this...
But overall I guess this is 'advanced' topic to discuss..
Regards
Maulin
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think part of the question was even simpler. The JVM is a program written in C/C++ for the native platform. So on Windows, it's a Windows program and Windows treats it like any other. If you start two copies of Word they each keep their own memory and work completely independently. Two copies of the JVM do the same. You start one when you run "java myprogram" on the command line or a shortcut. So first question, you can run as many JVMs as your memory and CPU can juggle. They're all ignorant of each other.
Second question, you can give a JVM about as much memory as you've got, I think. Surely you can give it more than you should give it. The garbage collector runs when there is not enough memory to create more objects. If you have huge memory it takes a longer time to fill it up and longer for the gc to clean it up. You can get to the point where the delay for gc bothers the user. Newer JVMs are better at this but it's still something to think about. We're running a product in a server with 8 gig of memory and the vendor says run two JVMs with no more than 1 gig each. I'd guess that gc stuff is part of the reason.
 
reply
    Bookmark Topic Watch Topic
  • New Topic