File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Performance and the fly likes problem with Runtime.exec() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "problem with Runtime.exec()" Watch "problem with Runtime.exec()" New topic

problem with Runtime.exec()

Prashanth Nair

Joined: May 13, 2004
Posts: 21
I have a process monitoring program in linux which
executes the class through Runtime.exec()
and monitors the status of the child processes
periodically from a Thread.i am looking up
the processes from an rmi registry and will
write the status periodically.

when a "ps -ef | grep java" is done from the
terminal,it was showing 3 process ids.One for
the monitoring Main class,another for rmiregistry
and the third for the program which is being monitored

If i start this monitoring program ,its
observed that the system becomes slow.
I am not able to find out why is this happening
Is it because i am starting another jvm instance?

William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
Is it because i am starting another jvm instance?

Starting another jvm instance would only cause a temporary pause.
I suspect your problem lies elsewhere - how frequently does your monitoring program run?
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

Just by the way:
ps -C java is more efficient than ps -ef | grep java - i.e. the grep java might find itself.
Prashanth Nair

Joined: May 13, 2004
Posts: 21
The montoring program will run in a while loop and will check the status every 60 secs
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63858


There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

JavaRanch Sheriff

[Asking smart questions] [About Bear] [Books by Bear]
It is sorta covered in the JavaRanch Style Guide.
subject: problem with Runtime.exec()
It's not a secret anymore!