aspose file tools*
The moose likes Performance and the fly likes Running Multiple Java Programs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "Running Multiple Java Programs" Watch "Running Multiple Java Programs" New topic
Author

Running Multiple Java Programs

Andrew Ceronoski
Greenhorn

Joined: Apr 21, 2009
Posts: 16
Hello:

I wrote a discrete event simulator that models data over a thirty year period. Due to my small time step size, my software is taking 7-10 hours to run.

I run the software as an executable, and the load the data into the software.

I am wondering if there is anyway in windows I can get all 12 of these runs going at the same time and have windows give them resources in the order that they were started (or something similar).

The simulation is being run on a desktop that I can leave on for long periods of time.

Any suggestions would be most appreciated! I hope there is a way I can start all of the runs at the same time!

Thank you!
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12788
    
    5
How much CPU time is consumed when one instance is running? If it is nearly 100% then extra instances would not add much.

If you have the memory you can certainly run multiple JVMs but I dont think you can control the order in which Windows lets them have CPU time.

Bill
Andrew Ceronoski
Greenhorn

Joined: Apr 21, 2009
Posts: 16
One instance uses about 82% of my resources.
Kees Jan Koster
JavaMonitor Support
Rancher

Joined: Mar 31, 2009
Posts: 251
    
    5
Dear Andrew,

What "resources" specifically?

A very crude way to control this is to set the less interesting processes to a lower process priority. I think the windows task manager lets you do this.


Java-monitor, JVM monitoring made easy <- right here on Java Ranch
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12788
    
    5
Using 82% of CPU time is pretty intense, I don't think you would gain much by starting a second process.

How much memory does one simulation use - if it is significant, starting a second process might cause virtual memory disk thrashing and slow things down considerably.

It might be more profitable to profile the application to see what takes the most time.

Of course, there is always the "cloud" approach for intense computing chores - surprisingly cheap, if your application is adaptable to -for example- the Google AppEngine or Amazon's Elastic Compute.

Bill
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16065
    
  21

William Brogden wrote:Using 82% of CPU time is pretty intense, I don't think you would gain much by starting a second process.


In point of fact, since multi-tasking incurs the non-trivial overhead of task switching, you might lose, instead of gain, especially if you're running more processes than you have CPU cores. Multi-threading works best on I/O-bound processes, providing your I/O doesn't itself become an objectionable bottleneck.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Running Multiple Java Programs