• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

caching windows exe

 
Frank Tap
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am running a windows exe using Runtime.getruntime().exec. This works fine. However I am running the same exe hundreds of time and I would like to keep it in memory. The exec command deletes the tread after it is finished. Is there a way to keep the process in memory after it is finished and run it again?
 
Jayesh A Lalwani
Rancher
Posts: 2756
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. Everytime you run a process, the OS has to do the work of loading the code in memory, allocating the heap, etc, etc. An application that forks a heavy process won't scale. If possible you are better off moving that logic to a background process that stays running and listens on a port for requests. Your main application can send a request to the background process whenever it needs the work to be done.

 
Winston Gutkowski
Bartender
Pie
Posts: 10091
56
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Frank Tap wrote:I am running a windows exe using Runtime.getruntime().exec. This works fine. However I am running the same exe hundreds of time and I would like to keep it in memory. The exec command deletes the tread after it is finished. Is there a way to keep the process in memory after it is finished and run it again?

And further to Jayesh's good advice, I'd suggest that this sort of micro-optimization is way premature, and probably harmful - especially for something that only runs hundreds of times.

Hundreds of millions of times - then it might be worth thinking about; but only if you can prove that it actually has a significant benefit.
W.A. Wulf wrote:More computing sins are committed in the name of efficiency (without necessarily achieving it) than for any other single reason — including blind stupidity.

Winston
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic