How to close cache prefetching in windows?

In a C / C ++ program, how to close the prefetch of each kernel on a Windows system?

+4
source share
2 answers

There is a call to the Windows API FlushInstructionCache ()

Perhaps this is what you need? It is usually used by a self-modifying code to make sure that changes to the code in RAM are visible to the processor.

+3
source

I saw this trick mentioned in some code, although I'm not 100% sure if this trick is what you are looking for, however the code was this

  Sleep (0);

Using Sleep(0) , you clear the CPU instructions and call the context switch ... Now you said โ€œfor each coreโ€, I donโ€™t think that you can explicitly choose a kernel for this, how do you know which kernel the code that is needed to close the cache prefetch is executed ....

0
source

Source: https://habr.com/ru/post/1303465/


All Articles