Is there a way in C++ to specifically put a certain variable in the processor's cache?
If not is there a way with inline x86 assembly code?
Is there a way in C++ to specifically put a certain variable in the processor's cache?
If not is there a way with inline x86 assembly code?
L33t sp3@k sux0rz (uZ it t@k3s 10 m1|\|ut3s 2 tr@nzl@te 1 \/\/0rd & th3n j00 h@\/3 2 g3t p@$t d@ m1zpelli|\|gz, @tr0(i0u$ gr@mm@r @|\|d 1n(0/\/\pr3#3|\|$1bl3 $l@|\|g. 1t p\/\/33nz j00!!
Speling is my faverit sujekt
I am a signature virus. Add me to your signature so that I may multiply.
No, and no.
There is very little control over the cache from a software point of view (besides being able to say "this memory can be cached/this memory cannot be cached").
In almost every case, the processor makes the most intelligent decisions as to how it caches.
if you simply access the variable it will most likely be cached. you cannot control how long it stays there though, it could be removed (ie. flushed to memory and overwritten) at any time.