简体   繁体   中英

Barrier implementation for inter process in shared memory

I am looking for an inter-processes barrier implementation. Processes are in shared memory (ie. on the same ndoe).

Processes are MPI ones. I do not want to use the MPI_Barrier function, because the general policy for all the MPI implementation is active waiting. I want my processes sleeping as long as they wait.

The restrictions:

  • should be in C, maybe in C++
  • no spinlock, so it could use semaphore
  • linux OS

I am confident it exists thousands of barrier implementation, but I do not find any?!

Thanks

pthread_barrier is the POSIX API for barriers. They may live in process shared memory if you initialize them accordingly.

You should check out Boost. I believe that it has an interprocess module that you can use.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM