3
$\begingroup$

I often hear Prefetching as a technique for speeding up, for example, sequential memory access pattern. The prefetch should occur sufficiently far ahead in time to mitigate the latency of memory access, for example in a loop traversing memory linearly.

According to the famous "What Every Programmer Should Know About Memory" paper by Ulrich Drepper, it is written:

This prefetching would remove some of the costs of accessing main memory since it happens asynchronously with respect to the execution of the program

(emphasis mine)

I could not find references on Google or Wikipedia corroborating or proving this. Does anyone know where I can find if this is true?

The only reasoning I can think of is rhetorical: it must be asynchronous b/c otherwise prefetching offers no benefit to sequential access... unless the execution time of prefetching a cache line is less than bypassing prefetch and placing the same cache line from RAM directly into cache.

$\endgroup$
2
$\begingroup$

If it is implemented in hardware, prefetching is typically done asynchronously.

It's also possible for a compiler to insert extra prefetch instructions into the code. Thus, the initiation of the fetch is done synchronously, but then the memory access continues asynchronously.

See https://en.wikipedia.org/wiki/Cache_prefetching.

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.