wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes JVM concept Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "JVM concept" Watch "JVM concept" New topic
Author

JVM concept

amarkirt saroay
Ranch Hand

Joined: Mar 16, 2008
Posts: 167
If I have opened 3 console windows,and I run 3 different java programs on them,then is it the scenario of multiple JVM's running simultaneously?


SCJP-75%
SCWCD-82%
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39073
    
  23
As far as I can tell, yes. But unless you have something like sockets to connect them together, they are probably running independently of one another. If you are attempting simultaneous access to a resource, eg a File, the three processes may interfere with one another.
Aniruddh Joshi
Ranch Hand

Joined: Jul 29, 2008
Posts: 275

then synchronization would not help , right ?


Anrd
"One of the best things you could do is to simplify a larger application into a smaller one by reducing its process and complexity - Fowler"
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39073
    
  23
Don't know. We haven't got much detail to go on, but synchronization is to protect the contents of an object from what happens outside. This is protecting what happens outside from the contents of an object, so I think you are correct: synchronization wouldn't help.

If the Socket methods are synchronized, that might help. But I don't know that offhand; you will have to look it up.
Aniruddh Joshi
Ranch Hand

Joined: Jul 29, 2008
Posts: 275

i faced an issue with my quartz scheduler once (here)

the mistake was that i was triggering a new job each 2 minutes and one job took longer than that top execute... i thought these are multiple threads, hence synchronized it .
but as I now understand, it didn't work.
I read this javaranch journal,I made my job stateful and it solved the issue.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42039
    
  64
Synchronization as it is understood in the Java world only works within a single JVM. If you have multiple JVMs running that are accessing a shared resource (like a file), then they can't help.


Ping & DNS - my free Android networking tools app
 
GeeCON Prague 2014
 
subject: JVM concept