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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:09:08+00:00 2026-06-08T12:09:08+00:00

In a high-performance computing context, I saw code like the following: typedef union {

  • 0

In a high-performance computing context, I saw code like the following:

typedef union
{
  erts_smp_rwmtx_t rwmtx;
  byte  cache_line_align_[ERTS_ALC_CACHE_LINE_ALIGN_SIZE(sizeof(erts_smp_rwmtx_t))];
}erts_meta_main_tab_lock_t;

erts_meta_main_tab_lock_t    main_tab_lock[16];

What does the cache_line_align_ appearing above do? Why is it useful?

  • 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-06-08T12:09:09+00:00Added an answer on June 8, 2026 at 12:09 pm

    When creating a program with multi-threading two parts of your program may try to access objects/primitives in memory that are right next to each other in a shared-memory system.

    Unfortunately, the computer hardware can not serve the one piece of memory to one processor and another piece to a different processor at the same time if both pieces are on the same cache-line.

    This pitfall is known as False Sharing.

    To overcome this, we can add in a buffer of space between the memory locations (variables) in question.

    That buffer of space does absolutely nothing, except spread our desired variables apart in memory.

    There may be some non-multi threaded programs which have been optimized for cache perfomance where you could see some similar trick, but in that case you usually want the variables that you will access most as close together as possible so they all fit on the same cache-line(s).

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

Sidebar

Related Questions

I was looking at the sample code for a lock-free queue at: http://drdobbs.com/high-performance-computing/210604448?pgno=2 (Also
In reading High performance MySQL from O'Reilly I've stumbled upon the following Another common
This is just a general question relating to some high-performance computing I've been wondering
C and Fortran have traditionally been used for High Performance Computing (Stuff to do
My job is mainly in high-performance 'scientific' computing. I've been doing that for ~15
I would like to filter with high performance XML elements from an XML document.
How good is boost::intrusive library for high performance computing? I want to use a
We have legacy C++ code performing high-performance data processing (e.g., large volumes of data
Recently I transferred a set of data from one server to hpcc(high-performance computing) Command
I am writing a High Performance ASP.NET Json API with soon > 1000 Request/Second.

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.