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 6565571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:06:37+00:00 2026-05-25T14:06:37+00:00

I am guessing that even reading from shared data in openmp causes some parallel

  • 0

I am guessing that even reading from shared data in openmp causes some parallel overheads, as depending on processor architecture (if different cores have their own cache…) it may be necessary to refresh the cache to ensure that no other cpu has modified the data before reading.

Am I right in thinking this?

If so, is there a way to tell openmp (on the intel compiler fwiw) that some of the shared data is constant, so such cache refreshing isn’t necessary?

If the answer is c++ const is there an easy way to turn non-const data into const data, without actually reallocating the memory, once the program has passed a certain point at runtime?

UPDATE

Ah, ok. I now remember where I got my impression that const was a good thing in this context: http://www.akkadia.org/drepper/cpumemory.pdf , section 6.4.1. It’s to do with false sharing, where readonly variables which share cache lines with readwrite variables incur the penalty of the cache line being marked exclusive by the readwrite variable. The linked document recommends, for example with gcc, to mark those vars as __attribute__((section(something.else))) to ensure they get stored elsewhere.

As it happens this is not relevant in my own situation – large arrays and stl containers of data in which the read/write granularity will span many cache lines and which are allocated from different memory pools in any case. So these will naturally be located on different cache lines. No problem!

  • 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-25T14:06:38+00:00Added an answer on May 25, 2026 at 2:06 pm

    Sharing read-only data among multiple cores has no overhead. The same copy of the data will be in the cache for all the cores that are using it.

    The only time you will incur overhead is when one of the cores writes to the shared data. In that situation, you will incur a (potentially large) overhead because the write will invalidate all the other copies of that cache line and force them to grab it from memory or from a different cache.

    In other words, the cache is only “refreshed” when somebody changes the data. There’s no periodic “refreshing”.

    So the answer to your question is: You do not have to do anything. There’s no way to tell OpenMP or the hardware that the data is constant and const will have no effect aside from syntax.

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

Sidebar

Related Questions

Here is my current question: I'm guessing that my problem (described below) is being
What happens? I'm guessing that somehow the post or page is parsed before displaying,
I'm guessing there's something really basic about C# inheritance that I don't understand. Would
I'm guessing the StackOverflow code has something along the lines of a UsersController that
Does anyone know of a Windows tool that will write the output from a
Due to 0 responses, I'm guessing that my LEFT JOIN question got into too
I created my own class that I want Core Data to use instead of
I'm cleaning up some pretty complicated code that I didn't write and I'm looking
I am using DevExpress GridView here, but I am guessing that the issue is
I am reading a tutorial on how to insert and update data into a

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.