Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 597
Saeid Yazdani Avatar asked Dec 06 '22 21:12

Saeid Yazdani


1 Answers

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.

like image 179
Ernest Friedman-Hill Avatar answered Jan 05 '23 07:01

Ernest Friedman-Hill