>I think the CUP needs to load the data structure to its CPU cache in
> order to operate them, right?
[quoted text clipped - 9 lines]
> its CPU cache to process? Or it can just load that particular item to
> its cache to update it?
Probably the latter. You can make arrays that, as a whole, are too big
to fit into cache.
- Oliver
Dimitri Ognibene - 03 May 2006 17:52 GMT
The cpu, usually, doesn't know anything about arrays so it works only
on elements.
However the cpu or the memory interface can load a whole segment of
data near to the memory element you are accessing..but you can't have
any control on this behavior, which however is enough fast, it is
usefull for cicles on array..
Dimitri
Kevin wrote On 05/03/06 12:21,:
> I think the CUP needs to load the data structure to its CPU cache in
> order to operate them, right?
Usually, yes. Note that most modern computers have
multiple levels of cache with different characteristics.
Also, it may be possible to do some kinds of manipulation
(e.g., block copies) without involving some caches.
> So when we have a java array, for example:
>
[quoted text clipped - 7 lines]
> its CPU cache to process? Or it can just load that particular item to
> its cache to update it?
In one sense you don't know. You write this line of
Java, javac compiles it, and the JVM executes it ... somehow.
The details of the execution are (mercifully -- take my word
for it) hidden from you.
In another sense, it's easy to get at least a partial
answer. Choose whichever cache level interests you and
consider its size. Then write a Java program with an array
of, say, five times that size. Do you think your program
will run, or do you think the CPU cache will explode like
Mr. Creosote after the "waafer-thin" mint?

Signature
Eric.Sosman@sun.com