Search code examples
c#cpusecond-level-cache

Is accessing CPU cache (read and write) through C# possible?


I want to know if there are implemented stuff in C# which allows to access CPU cache. It is just interesting for me but I do not have something to do with the cpu cache at the moment. So I was wondering if it is a system limited access or it is avilable to users also. I am talking about L1/L2 or whatever they are called!

Would be nice to hear your comments, external linkes and maybe some code snippets! Thanks.


Solution

  • No programming language has direct access to CPU cache. Reading and writing the cache is something done automatically by the hardware; there's no way to write instructions which treat the cache as any kind of separate entity. Reads and writes to the cache happen as side-effect to all instructions that touch memory.