0

I learnt Runtime.getRuntime().exec() is used to call external applications from Java. There are processbuilders and apache commons exec which can also be used.

But I have few basic questions.

  1. How does the sub process creation takes place?. Will it inherit same memory that of the parent process?. Can we take control of memory allocation for the child process?.

  2. If parent process is killed, will it kill the child processes too?

  3. How much costlier (in terms of resource) does the creating a child process affects the parent process.

  4. Is there any pitfalls while doing so?.

I tried searching online but couldn't find a clear answer to my questions.

Thanks,

Aravind
  • 11
  • 4
  • The child process will not be killed after termination of the parent process. Some pitfalls are descirbed here: http://www.javaworld.com/article/2071275/core-java/when-runtime-exec---won-t.html – Software Craftsman Sep 22 '15 at 14:11
  • *"I tried searching online but couldn't find a clear answer to my questions."* Break them down one at a time and search on that. As an example the 4th question can be summed up in the search [Runtime.getRuntime().exec() pitfalls](https://www.google.com.au/search?q=Runtime.getRuntime().exec()+pitfalls) .. Voting to close as too broad for SO. – Andrew Thompson Sep 23 '15 at 13:45

0 Answers0