简体   繁体   中英

How to close the prefetch of cache in windows?

在C / C ++程序中,如何关闭Windows系统中每个核心的预取?

There is a Windows API call FlushInstructionCache()

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

I have seen this trick mentioned in some code, although I am not 100% sure if this trick is what you're looking for, however, the code was this

Sleep(0);

By using Sleep(0) , you are clearing the CPU instructions and cause a context switch... Now you did say 'for each core', I do not think you can explicitly select a core to do that as how do you know which core is running the code that is need of a closing the pre-fetching of the cache....

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM