why occupation doesn't rise up to 100%? - why the JVM doesn't manage the two thread correctly, even if they're totally separated?
1. Probably the operating system has other things to do 2. What did you expect it to do?
Joined: Jun 16, 2006
I was wrong about timings (two threads go faster), however CPU occupation doesn't reach full load even if there aren't any other processes working.
Author and all-around good cowpoke
Joined: Mar 22, 2000
even if there aren't any other processes working.
That is not necessarily true - operating sytems do many things without consulting the user. My Windows systems occasionally start doing lots of disc operations for no apparent reason for example. The task manager shows loads of mysterious processes just hanging around.
Normally to max out CPU's you go into tight loops and do lots of math ...
Check your OS e.g. does your kernel support your chip ...
Check other Apps....
Check shared resources between threads ...
i.e. check calls to static members , remove them all and re time
i.e. the first thing that occurred is what is 'out' wired up to, note your outputting in a loop, any form of I/O particularly shared I/O will drop the CPU utilisation depending on how its implemented i.e. if you only have one file log / VDU think about how the CPU's OS copes with that or not. The OS'es must be damm efficient, I/O buffers whatever as most multi threaded apps seem to pour logs down the same hole, personally I always time stamped my output and put them in per thread logs, as usually I only wanted to see ones thread output at a time and could always combine them back up if needed. I know some logs are ultra fast but I'ed love to see some stats in a multi threaded environment if some one has some ??
Would love to run some test figures but don't have the (multi core)hardware :-(
"Eagles may soar but weasels don't get sucked into jet engines" SCJP 1.6, SCWCD 1.4, SCJD 1.5,SCBCD 5
Joined: Jun 16, 2006
thank you! however, if you pass me some class, i can do tests for you :-)
Because the OS is not going to yield complete control of the CPU to your program. So sometimes your processes/threads will be suspended for other processes/threads. These other processes/threads to not have to tax the CPU 100%. They can in fact, sit idle, but they still will get some of the CPU time.