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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T18:22:25+00:00 2026-06-05T18:22:25+00:00

I have heard that when dealing with mutexes, the necessary memory barriers are handled

  • 0

I have heard that when dealing with mutexes, the necessary memory barriers are handled by the pthread API itself. I would like to have more details on this matter.

  1. Are these claimings true, at least on the most common architectures around?
  2. Does the compiler recognize this implicit barrier, and avoids reordering of operations/read from local registers when generating the code?
  3. When is the memory barrier applied: after successfully acquiring a mutex AND after releasing it?
  • 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-05T18:22:27+00:00Added an answer on June 5, 2026 at 6:22 pm

    The POSIX specification lists the functions that must “synchronize memory with respect to other threads”, which includes functions like pthread_mutex_lock() and pthread_mutex_unlock().

    In Appendix A.4.11 it is spelt out that functions that “synchronize memory”:

    • …would have to be recognized by advanced compilation systems so that memory operations and calls to these functions are not reordered by optimization; and

    • …would potentially have to have memory synchronization instructions added, depending on the particular machine.

    It is never explicitly specified what kind of memory synchronization instructions are implied – the implicit specification is that if you use a pair of “synchronizing instructions” to ensure that a read in one thread must happen after a write in the other, then your program will operate correctly. This includes both compiler and architectural reordering effects.

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

Sidebar

Related Questions

I have heard that in C++, using an accessor ( get...() ) in a
I have heard that web-based chat clients tend to use networking frameworks such as
I have heard that GTK covers all controls so that developers do not care
I have heard that DateTime.Now is very expensive call (from here ) Is GETDATE()
I have heard that prepared statements with SQLite should improve performance. I wrote some
I have heard that MSBuild 4.0 has increased Regex parsing support. However, I am
I have heard that MbUnit comes with pretty nice test decorators which allow writing
I have heard that Duplicity is a nice tool for doing incremental backups. The
I'm considering using JRuby on App Engine but have heard that Juby app on
We have all heard that XPS is Microsoft's answer to Adobe's PDF. Since PDF

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.