Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7079253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:38:57+00:00 2026-05-28T06:38:57+00:00

Is it possible to explicitly create static objects in the CPU cache, sort of

  • 0

Is it possible to explicitly create static objects in the CPU cache, sort of to make sure those objects always stay in the cache so no performance hit is ever taken from reaching all the way into RAM or god forbid – hdd virtual memory?

I am particular interested in targeting the large L3 shared cache, not intending to target L1, L2, instruction or any other cache, just the largest on-die chub of memory there is.

And just to clarify to differentiate from other threads I searched before posting this, I am not interested in privatizing the entire cache, just a small, few classes worth of region.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:38:58+00:00Added an answer on May 28, 2026 at 6:38 am

    No. Cache is not addressable, so you can’t allocate objects in it.

    What it seems like you meant to ask is: Having allocated space in virtual memory, can I ensure that I always get cache hits?

    This is a more complicated question, and the answer is: partly.

    You definitely can avoid being swapped out to disk, by using the memory management API of your OS (e.g. mlock()) to mark the region as non-pageable. Or allocate from “non-paged pool” to begin with.

    I don’t believe there’s a similar API to pin memory into CPU cache. Even if you could reserve CPU cache for that block, you can’t avoid cache misses. If another core writes to the memory, ownership WILL be transferred, and you WILL suffer a cache miss and associated bus transfer (possibly to main memory, possibly to the cache of the other core).

    As Mathew mentions in his comment, you can also force the cache miss to occur in parallel with other useful work in the pipeline, so that the data is in cache when you need it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: C# 'var' keyword versus explicitly defined variables EDIT: For those who are
It's possible to create lots of memory-intensive objects and then abandon references to them.
How does apache handle caching of certain files, and is it possible to explicitly
Possible Duplicate: Can I create an automatic property (no private member) with get and
is it possible to create java libraries the apps can use shared? It is
I may have missed something obvious with WPF, but is it possible to create
I'm trying to create a little Ruby hack to make something like the reverse
I wonder, whether it is possible to create class-methods in VBA. By class-method I
In Python it's possible to create a procedure that has no explicit return. i.e.:
Is it possible to create a function to be executed before/after each test runs?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.