Prefetching

Prefetching is the act of retrieving memory into cache lines ahead of time, before the memory is to be accessed. While a prefetch is a slow operation, this doesn't necessarily matter if enough time (unrelated instructions to be executed) exists between the prefetch and the memory access in question. Then, the latency caused by the prefetch will be hidden, and the memory access will be orders of magnitude faster, since the memory is guaranteed to be in the cache upon access.

Prefetching can be done implicitly by the CPU (hardware prefetching) or explicitly by the programmer, by placing prefetch instructions in the code (software prefetching).

Software prefetching is often done heuristically by the compiler. In JRockit it is used, for example, to access TLA space for object allocation and in optimized code before large amounts of field accesses take place. Placing prefetch instructions in the wrong locations can be detrimental to performance.

See also Thread local area, Hardware prefetching, and Software prefetching.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.195.111