multi core/cpu systems and Java

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

multi core/cpu systems and Java

alarmnummer
I have a question about multicore/multicpu processors (and especially
the Intel and AMD processors) and Java and threads.

The question is:
are Java threads (of a single vm) executed on all core`s or are they
bound to a single cpu?
With other words: if you are executing a single cpu-bound application,
do you get any benefits of a multicore system? The most logical answer
would be yes.. but a colleague claims that java threads are bound to a
single cpu so you won't get any performance gain.

The operating systems are: Windows and Linux 2.6 and the vm is the
standard 5.0 version from Sun.

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: multi core/cpu systems and Java

Jeremy Manson
Your colleague is incorrect.  Sun's JVM will distribute its threads
among however many processors there are on a machine and however many
cores there are on a given processor.  Java would be unsuitable for use
on modern server architectures if this were not the case.

I believe that it was true that Java was bound to a single CPU once upon
a time, but that was only in versions 1.0 and 1.1.  ISTR that there was
a patch for it in 1.1, and 1.2 had native support.  My memory on this
might be faulty.

                                        Jeremy

Peter Veentjer wrote:

> I have a question about multicore/multicpu processors (and especially
> the Intel and AMD processors) and Java and threads.
>
> The question is:
> are Java threads (of a single vm) executed on all core`s or are they
> bound to a single cpu?
> With other words: if you are executing a single cpu-bound application,
> do you get any benefits of a multicore system? The most logical answer
> would be yes.. but a colleague claims that java threads are bound to a
> single cpu so you won't get any performance gain.
>
> The operating systems are: Windows and Linux 2.6 and the vm is the
> standard 5.0 version from Sun.
>
> _______________________________________________
> Concurrency-interest mailing list
> [hidden email]
> http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: multi core/cpu systems and Java

Brian Goetz
In reply to this post by alarmnummer
The short answer to nearly all questions having to do with
logical/physical processors, and processor affinity: that's an OS issue,
not a JVM issue.

The only interpretation under which your colleague would be right is an
application with only a single thread; the basic unit of scheduling for
most OSes is the thread.  A program with only one thread can only run on
one CPU, but a program with more threads can use multiple CPUs.

Peter Veentjer wrote:

> I have a question about multicore/multicpu processors (and especially
> the Intel and AMD processors) and Java and threads.
>
> The question is:
> are Java threads (of a single vm) executed on all core`s or are they
> bound to a single cpu?
> With other words: if you are executing a single cpu-bound application,
> do you get any benefits of a multicore system? The most logical answer
> would be yes.. but a colleague claims that java threads are bound to a
> single cpu so you won't get any performance gain.
>
> The operating systems are: Windows and Linux 2.6 and the vm is the
> standard 5.0 version from Sun.
>
> _______________________________________________
> Concurrency-interest mailing list
> [hidden email]
> http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest