siva venkata prasad wrote:
Is it possible to have two JVM processes running under single CPU at same time..?
siva venkata prasad wrote:If yes how heap memory is shared across two JVM's?
siva venkata prasad wrote:
Is it possible to have two JVM processes running under single CPU at same time..?
If yes how heap memory is shared across two JVM's?
Henry Wong wrote:
siva venkata prasad wrote:If yes how heap memory is shared across two JVM's?
In general, OS uses virtual memory so that each program can "share" the physical memory. The programs don't use the same physical memory at the same time, but with paging (and swapping), they can share the memory.
siva venkata prasad wrote:
So shall i deduct from the above that if one JVM process will come across Out Of Memory error, it will not impact another JVM execution.. ?
siva venkata prasad wrote:Thanks Jeff.
Could you please clarify me on the below..
Two JVM's are running.. and each JVM process will create an object of certain type for every 2 seconds.. JVM1 ecncountered OOME error.. and so is it not necessarily that JVM2 will also get OOME because of certain operation taken by OS..?
Also is heap memory is global or can also be shared/allocated to each JVM during the launch of JVM.. I Mean, is it possible to dedicate some heap memory for JVM 1 and some to JVM 2 independently...if yes please tell me how to ?
siva venkata prasad wrote:Also is heap memory is global or can also be shared/allocated to each JVM during the launch of JVM.. I Mean, is it possible to dedicate some heap memory for JVM 1 and some to JVM 2 independently...if yes please tell me how to ?
Jeff Verdegan wrote:JVM2 will not get an OOME just because JVM1 did. However, if you have 2GB of memory on your system, and no virtual memory, and JVM1 is using 1.5 GB of memory, and JVM2 tries to use more than 0.5 GB of memory, then it will get OOME.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Rob Spoor wrote:
Jeff Verdegan wrote:JVM2 will not get an OOME just because JVM1 did. However, if you have 2GB of memory on your system, and no virtual memory, and JVM1 is using 1.5 GB of memory, and JVM2 tries to use more than 0.5 GB of memory, then it will get OOME.
Not necessarily. If possible the OS will use a page file (Windows) or swap partition (Linux / Unix) to use as "extra memory" on disk.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
fred rosenberger wrote:I believe you only get an OOME when the JVM asks the OS for more memory, and the OS says "Nope - you've gotten all you're going to get".
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Rob Spoor wrote:
fred rosenberger wrote:I believe you only get an OOME when the JVM asks the OS for more memory, and the OS says "Nope - you've gotten all you're going to get".
I don't think that's true. The JVM has a fixed maximum amount of memory it can use. By default it's 64MB but it can be specified using the -Xmx flag. An OOME occurs when the JVM needs more than this amount. If the OS can't provide the memory there will possibly also be an OOME, but this is not the only cause of OOMEs.