Re: Detecting CPUs and cores
A difference that makes no difference is no difference.
Eric Sosman wrote:
Well, yes: But it *does* make a difference. The difference
doesn't arise from the die layouts per se, but from attributes
that tend to go along with them. The cores may share resources
in ways that interfere and make their "computational power" non-
additive. Intel's hyperthreaded chips, for example, share a
single execution unit and a single path to memory; only one "CPU"
at a time can initiate an operation on either resource. Similar
remarks apply to Sun's T1 processor; the thirty-two "strands"
share eight execution units, one on-chip cache, and one floating-
point unit, but multiplex across four memory channels.
The differences make a difference -- but taking proper account
of them is far more involved than simply counting cores or chips.
You need to get into the architecture of what's shared and what
isn't, which components can run in parallel and to what degree,
and so on. This is well outside the scope of what cross-platform
Java is equipped to handle; one would need a lot of supplementary
information to make sense out of whatever number one obtained.
Given that I was speaking from the parochial point of view of being a
comp.lang.java.programmer, we are in agreement.
In Java terms, it makes no difference. The Intel HT is able to interleave
execution between its two virtual "cores" in its single actual core because of
its architecture; it actually achieves speedup from the parallelism. As a
Java programmer, one is divorced from the details of the "actual" differences
that you describe. As a Java programmer, the difference(s) make no
difference. Therefore as a Java programmer there really is no (useful)
difference between the multi-core imitation that an Intel HT gives, the actual
multi-core of an X2, or the separate die CPUs of a two-way Xeon motherboard.
Of course I realize that in some universe there are differences between these
that matter; that is the Zen of the pithy maxim that I offered. So let's
recast that cute little poster saying in order to maximize satori,
"When does the difference make a difference?"