Java Threads – are they executed on separate CPU’s?

Z

zigzagdna

I am on Windows 2003 standard edition server which has 4 CPU’s. I am
running Apache Tomcat, I see java.exe with many threads in task
manager. Will these threads be executed over different CPU’s. i.e, a
thread is running on Cpu 1, another o CPU 2, etc concurrently.

How can one monitor which threads or on which CPU’s?
 
K

Knute Johnson

I am on Windows 2003 standard edition server which has 4 CPU’s. I am
running Apache Tomcat, I see java.exe with many threads in task
manager. Will these threads be executed over different CPU’s. i.e, a
thread is running on Cpu 1, another o CPU 2, etc concurrently.
Yes.

How can one monitor which threads or on which CPU’s?

I don't think you can.
 
R

Roedy Green

I am on Windows 2003 standard edition server which has 4 CPU’s. I am
running Apache Tomcat, I see java.exe with many threads in task
manager. Will these threads be executed over different CPU’s. i.e, a
thread is running on Cpu 1, another o CPU 2, etc concurrently.

How can one monitor which threads or on which CPU’s?

yes,

no, not without some third party tool. A thread hops from CPU to CPU
over its lifetime. Which thread runs on which CPU is controlled by the
OS.

The OS runs a physical thread for each CPU. When that thread hits a
roadblock, it looks in the list of waiting threads, and picks the
highest priority one. The pool is common to all the CPUs (in the
general case), so it pretty much random which CPU will be associated
with which running thread at any given time.
--
Roedy Green Canadian Mind Products
http://mindprod.com
Your old road is
Rapidly agin'.
Please get out of the new one
If you can't lend your hand
For the times they are a-changin'.
 
D

Daniel Pitts

I am on Windows 2003 standard edition server which has 4 CPU’s. I am
running Apache Tomcat, I see java.exe with many threads in task
manager. Will these threads be executed over different CPU’s. i.e, a
thread is running on Cpu 1, another o CPU 2, etc concurrently.
It is possible, but part of it is up to the thread scheduler of the OS.
Chances are they will be distributed though.
How can one monitor which threads or on which CPU’s?
You generally can't unless you "bind" the thread to a CPU. The thread
scheduler can choose to move a thread to another CPU, if that CPU is the
most idle.
Binding threads has performance implications (sometimes good, sometimes
bad), so don't do it if you don't need to.

I believe you can see at least CPU usage in the task manager, that might
be enough for you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top