Of course Java can, and will, use more than one core. Java has been running on SMP and (many, maaaany) more systems for many years. If you have two threads that do not max out CPU usage on a single core it is downright stupid to put them on different cores or processors. Threads share memory space which would have to be synchronized between different cores or even processors if they were to run seperatly. It would take up extra L1 and L2 cache space without even being able to use this succesfully.
It’s true you may miss some form of control with a JVM compared to hand coded assembly, but if you read some of the comments here
you see why that might not be a bad idea. Luckily, with recent versions of Sun’s VM there are all kinds of clever tricks in the VM to optimize for threading, including some tricks that would be very hard to do tranparantly in C or C++ (such as thread local memory space for the exact problem described at the top of this post). Effective threading in Java, IMHO, is a lot easier than in some other languages.
It would be nice if you could discover the actual number of cores (virtual and none virtual) through Java, but I’m sure there will be some JNI libs that will support this.
