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

  • Home
  • SEARCH
  • 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 8874337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:41:41+00:00 2026-06-14T18:41:41+00:00

We have some data structures that we are sharing across processes on Windows. (Via

  • 0

We have some data structures that we are sharing across processes on Windows. (Via a shared data segment in a DLL that’s loaded by all these processes.)

We need to synchronize some accesses and we measured that the performance hit of using a Win32 Mutex is too costly.

CRITICAL_SECTION cannot be put into shared memory due to some of it’s advanced features.

This leaves us with the requirement of a simple locking/mutex solution based directly on the Interlocked* family of function on Win32.

Before rolling my own I’d like to see if there’s robust implementations out there that handle the requirement of being lightweight, fast and working in shared memory for multiple processes, but it seems that this is something that’s a tad hard to google for me. (And, anyway, the CodeProject hits, well it’s often hard to tell whether it’s toy code or “robust”.)

So what I’d need could probably be called a user-mode recursive mutex that works for multiple processes when put in shared memory on Windows (note that only the locking part needs to be handled savely, I can live with restrictions / additional requirements for initialization).

  • 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-14T18:41:42+00:00Added an answer on June 14, 2026 at 6:41 pm

    Shared memory is a popular topic currently,

    Try boost::InterProcess – which provides mechanisms that could be used and utilizes common code x-platform.

    http://www.boost.org/doc/libs/1_52_0/doc/html/interprocess/sharedmemorybetweenprocesses.html

    The other reason is that the library provides mechanisms for synchronisation and other IPC mechanisms that may be useful in the future.

    http://www.boost.org/doc/libs/1_52_0/doc/html/interprocess/synchronization_mechanisms.html

    For reference the thing uses Atomic OPs as well for the mutex:

    http://www.boost.org/doc/libs/1_52_0/boost/interprocess/sync/spin/mutex.hpp

    inline void spin_mutex::lock(void)
    {
       do{
          boost::uint32_t prev_s = ipcdetail::atomic_cas32(const_cast<boost::uint32_t*>(&m_s), 1, 0);
    
          if (m_s == 1 && prev_s == 0){
                break;
          }
          // relinquish current timeslice
          ipcdetail::thread_yield();
       }while (true);
    }
    

    Also from the “chat below” this post look at the top answer for :
    Is there a difference between Boost's scoped mutex and WinAPi's critical section?

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

Sidebar

Related Questions

I have some data structures: all_unordered_m is a big vector containing all the strings
I have some multidimensional data structures that I need to do some interpolation on.
I have some data structures that stay unchanged if you try to add something
I have some C structures related to a 'list' data structure. They look like
I have some data loaded as a np.ndarray and need to convert it to
I have some data structures, and I would like to use one as a
I have some data in MongoDB that looks like this: { name: Steve, location:
In our application we have some data structures which amongst other things contain a
For some current projects, I'm working with several data structures that are pretty large
I have been trying to learn the ins and outs of some data structures

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.