Problem with dual core processors: 50% ressources are not used.

Hello all,

I have noticed, that the java app cannot get normally more than 50% of the system ressources. I use different threads in my application, but the app still does't achieve 100% of system power. Max 50-60%.

If I run two processes, I get 100%, but I can't share memory space between this two process. Or I can?

What is the best way to write an application, that can use 100%, in other words, full power of dual core processors.

Thanks in advance.

[486 byte] By [flexeda] at [2007-11-27 9:58:02]
# 1
Search the forum for "dual core" I seem to remember seeing a few different threads like this.
_helloWorld_a at 2007-7-13 0:28:28 > top of Java-index,Java Essentials,Java Programming...
# 2
Try thread.setPriority() method. I am making guess and any commentsfrom experts on this method will be highly acknowledged.
Adi1000a at 2007-7-13 0:28:28 > top of Java-index,Java Essentials,Java Programming...
# 3

> Try thread.setPriority() method. I am making guess

> and any comments

> from experts on this method will be highly

> acknowledged.

Yeah. Don't do that, it's a bad idea.

Back to the original post, there are two reasons this can be happening.

1) Your code is not efficient multi-threading wise. If you are for example running two thread that are in theory parallel but in actual fact provide linear execution so that one is almost blocked by the other then multiple threads and multiple cores will underutilized. It's hard to speculate further on this without seeing your code.

2) The OS. First of all there is the issue of how the oS shares up the processor between processes. This varies and may or may not be configurable. The bottom line on this point is that your OS may be capping the utilization of the processor by process. Again there's not enough information give by you to expand on this point. The second OS issue regards how the OS deals with multi-core. Just because you have a multicore processor does not mean that your OS automatically can take advantage of it.

cotton.ma at 2007-7-13 0:28:28 > top of Java-index,Java Essentials,Java Programming...