a question about Java program on Linux
Hi, i wrote a java program and run it on my linux server.
i did close the program every time, but when i checked ps -aux , i found that there're lots of the "Java myprogram" instance.... anyone knows what's wrong? |
I don't know exactly what the program does but is it possible that it references it self and possibly runs multiple copies of itslef.
Also try to be more specific: What distro and what does the program do(or is supposed to do) |
What you see is not due to Java, but to the (somewhat broken) way Linux is implementing threads.
Except maybe on specific experimental versions, Linux threads are more or less processes, each one with its process ID. So each line you see on the ps output represent actually a thread. Other OSs, e.g. Solaris, do not exhibit this artifact. |
so, will it cost too much resource on my linux machine? if yes, how to solve this problem?
|
Switch to Solaris ! :D
|
Without knowing the code that your working with, like was said above, it's a thread that is showing up. So it's possible your not stopping some threads that you (or your program) created. You need to make sure to explicitly stop the thread. But without seeing the code that we are talking about I'm just guessing. Also, resources aren't the biggest worries with this. Accidentally having orphaned threads running about your system should be treated like a error and not allowed to happen. Hope that helps.
|
All times are GMT -5. The time now is 02:52 AM. |