Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with Runtime.exec()

 
Prashanth Nair
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

cheers
prashanth
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
Bill
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The montoring program will run in a while loop and will check the status every 60 secs
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64980
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"prasanthNair",

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.

Thanks!
bear
JavaRanch Sheriff
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic