Reputation: 21
I am a beginner in java. My requirement is to develop an agent application which check whether a system (CPU) is in good health to handle/run more java applications(There are several CPU’s available to run a java application. So, we should select the most healthy CPU according to its performance ). What are the factors should I consider to check the CPU health? I already included RAM and CPU load to check CPU health.
*Is it possible to check the Heap memory ,I am getting the Heap usage of the current running program. Is there any way to find Heap memory used by all programs together run in Java Virtual Machine?
*Can I use number of Threads here?
Thanks in advance.
Upvotes: 1
Views: 202
Reputation: 7261
You're talking about task scheduling. This is a complex problem. Unless your project's core value lies in better CPU scheduling, I really recommend you rely on the operating system's scheduler instead, which likely has been improved over years or decades. This makes the endeavor very simple and you can ask more specific questions about how to influence the system's scheduler using Java APIs.
You'll want to look at the Java threading API and other concurrency-related packages.
If you really think you can get some benefits from very simple ("naive") scheduling, make sure to test all your scenarios to confirm. Often you'll encounter unexpected ramifications to your heuristics that may make things worse.
If you're an expert in task scheduling and your project's core value does lie in better scheduling, I suggest you rephrase your question to make it more explicit that you're looking for Java-related features. Note that the JVM is quite abstract, it might not provide the flexibility you require.
If you're not an expert in task scheduling and your project's core value still lies in better scheduling, I guess you're in for a nice ride. I suggest starting with thicker resources and asking more specific questions on SO or other places as you encounter them.
Good luck.
Upvotes: 2