Caching data

This is a discussion on Caching data within the C++ Programming forums, part of the General Programming Boards category; Is there a way in C++ to specifically put a certain variable in the processor's cache? If not is there ...

  1. #1
    ! |-| /-\ +3 1337 Yawgmoth's Avatar
    Join Date
    Dec 2002
    Posts
    187

    Caching data

    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.

  2. #2
    Cat
    Cat is offline
    Registered User
    Join Date
    May 2003
    Posts
    1,571
    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.

  3. #3
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 PM
  2. singly linked circular list
    By DarkDot in forum C++ Programming
    Replies: 0
    Last Post: 04-24-2007, 08:55 PM
  3. Program Crashing
    By Pressure in forum C Programming
    Replies: 3
    Last Post: 04-18-2005, 10:28 PM
  4. Errors
    By Rhidian in forum C Programming
    Replies: 10
    Last Post: 04-04-2005, 12:22 PM
  5. Replies: 1
    Last Post: 07-31-2002, 11:35 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21