Is there a way, any command etc., that can be used to see a thread
status just like we get process status using ps, top and prstat
commands?
Actually, my java program spawns threads for some data load process.
Some times it takes too much time and in these cases I need to find
the status of the threads, like how much memory it is consuming etc.
And if possible kill the thread. Can I do this?
My OS is Solaris 9.
Thanks & Regards,
Amit
> Is there a way, any command etc., that can be used to see a thread
> status just like we get process status using ps, top and prstat
> commands?
prstat -L will show all LWPs (threads) individually. pstack and pflags
report on individual LWPs, but the Solaris 9 versions don't allow you
to stipulate the thread number (you can in Solaris 10).
> Actually, my java program spawns threads for some data load process.
> Some times it takes too much time and in these cases I need to find
> the status of the threads, like how much memory it is consuming etc.
> And if possible kill the thread. Can I do this?
Not with system tools - the only object you can kill is a process.
If you want to "kill" a thread you'll need to provide the facility in
your program. For example, the thr_kill(2) call sends a signal to (aka
"kills") a thread, but it can only be called from the process itself.
The thread will obviously need to include code to handle the signal.
--
Stefaan A Eeckels
--
Governments are like babies: digestive tracts with a big appetite at
one end and no sense of responsibility at the other. The better run
ones from time to time get clean diapers...
Thanks Stefaan.
These:
http://www.camelrichard.org/matching-java-thread-nid-tid-solaris-10-threads-using-pstack
http://www.unixville.com/~moazam/stories/2004/05/18/debuggingHangsInTheJvm.html
http://kb.dbatoolz.com/tp/2476.drill_down_to_java_thread_consuming_cpu_on_solaris.html
may not be unhelpful.
Kartik Vashishta