• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4742
  • Last Modified:

Process List in JAVA

Hi all,

I'm trying to build a JAVA application that, among many other things, fetches a list of the system processes currently executing on the machine and their properties (CPU usage, memory, etc). As it is now I'm parsing the result of a command (like ps on UNIX) to find this information. However this seems to be rather ineficient, especially on *NIX systems that typically have over 100 processes executing at a time.
On Windows I'm using another

I've read somewhere (another forum) that JNI would be the best way to do this task... I think I understood what it was but can someone point me out where to start looking for it?
Or can someone suggest another alternative on how to do this?

I'm fully aware of the fact that whatever the solution, it will be very dependent on the Operating System. My design is prepared to deal with that so it's more of an hassle than a problem.

Any help is much appreciated and the points may be increased to reflect that appreciation.
  • 3
  • 2
  • 2
1 Solution
>> and the points may be increased to reflect that appreciation

500 is the max number of points you can give ;-)

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

          You can use JNI for this , as the above one pointed.
           In windows, I used JNI and PDH  libraries for this same work. [ you could get many more with PDH].

           In linux, I used JNI and read /proc for getting the processes and cpu usage and everything.
           but, in linux, i dont think you need to use any JNI. You can directly read /proc from java itself.

            In windows , you can use PSAPI also. [I know much about this].

Hope this hleps
pauloaguiaAuthor Commented:
I had forgotten how fast things work around here ;)

TimYates: That frist link seems promising. I'll have a better look into them later today or maybe tomorrow before accepting any as an answer. I'll be wanting to make up a working example of my own before I can say that either of them is the way to go.

durgaprasad_j: I didn't know what PDH is and I had to take a look around. I don't think that I'll need that, especially since I'd still have to look deeper into it and I'm already charting unknow territory (with JNI). Thanks for the suggestion anyway :)

I'll get back to this later.
pauloaguiaAuthor Commented:
As suspected, that first link contained the needed information (still in the process of tweaking it to my needs but I can see I'm on the right track).

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now