aspose file tools
The moose likes Threads and Synchronization and the fly likes Multiple JVM, Shared Memory, Single Thread Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "Multiple JVM, Shared Memory, Single Thread" Watch "Multiple JVM, Shared Memory, Single Thread" New topic
Author

Multiple JVM, Shared Memory, Single Thread

Pat Denton
Greenhorn

Joined: Oct 26, 2005
Posts: 17
I've been asked to research a potentially disasterous situation. We have 25 JVM's processing requests. We jave an executable that is single threaded although is being accessed via JNI by 1 or more of the 25 JVM's. The class that accesses this executable has been modified so that the method is synchronized as to only allow a single request at a time.

Here are my assumptions.

If the JVM's are sharing memory and the stated class is placed in that shared memory region, the calls to JNI won' crap out because the method is synchronized, however, the requests could get so backed up, http craps out waiting for responses back from the system.

If the JVM's are NOT sharing memory, then as soon as JVM-1 hits the executable and then JVM-2 requests the executable, the executable will crap out because it is single threaded.

Is this accurate? What am I missing?
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 10892
    
  26

Hi Pat,

Your assumptions sound logical to me.

As long as you can only have a single thread accessing the executable, you run the risk of it becoming the bottleneck. Is there any way you can cache the information received from the executable or run multiple instances of it?

Regards, Andrew


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Hemal Pandya
Greenhorn

Joined: Nov 10, 2005
Posts: 18
Originally posted by Pat Denton:
If the JVM's are sharing memory and the stated class is placed in that shared memory region, the calls to JNI won' crap out because the method is synchronized.



Synchronization in java refers only to a single a JVM. You will need some external mechanism for serializing access to the executable across multiple processes.
[ November 24, 2005: Message edited by: Hemal Pandya ]
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Multiple JVM, Shared Memory, Single Thread
 
Similar Threads
Threads 002
Design 01
Objective 7.1
volatile and static keywords
Threads 003: Server-Side Strategies