Third thing that comes to mind, is to use the getSystemLoadAverage() method of the OperatingSystemMXBean as a threshold instead of the AtomicInteger: http://java.sun.com/javase/6/docs/api/java/lang/management/OperatingSystemMXBean.html
On 4/9/08, Christian Vest Hansen <[EMAIL PROTECTED]> wrote: > First thing that comes to my mind is Thread.setPriority(), and then > just let the different tasks run concurrently but with different > priorities and let the OS take care of managing the system resources > (which is its primary function anyway.) > > Second thing that comes to mind is to keep a shared AtomicInteger that > holds the number of running important tasks, and then let the > unimportant tasks check every so often if the AI is below some > threashold, and only run if it is. > > > > On 4/9/08, Daniel Green <[EMAIL PROTECTED]> wrote: > > > > Hello, > > > > I need to determine, based on some set of criteria, whether the > > program should perform computation or wait for resources to free up. > > Ultimately, I am trying to maximize the power of concurrency on > > multi-core/processor systems and need to figure out at what point I > > become at risk of lowering the efficiency of other tasks. Now there > > are only a few metrics that I know how to obtain, so I'm hoping > > someone can fill in the cracks in my understanding. What I figured I > > would do is raise a red flag after a certain point, determined either > > by a list of constant metric pairs or better yet, some kind of > > algorithm... I've never worked with this kind of thing before so I > > would greatly appreciate any sort of ideas, feedback, or help. > > > > What comes to mind immediately is memory consumption and the > > information that can be found in /proc/loadavg and /proc/meminfo on a > > Unix system. I am not, at this time, supporting other environments so > > it's alright if it's Unix specific. I imagine that this kind of task > > would inevitably have to be platform dependent. > > > > Thank you for at least reading this, > > Dan. > > > > > > > > > > > > -- > Venlig hilsen / Kind regards, > > Christian Vest Hansen. > -- Venlig hilsen / Kind regards, Christian Vest Hansen. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "JVM Languages" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/jvm-languages?hl=en -~----------~----~----~----~------~----~------~--~---
