Barrier implementation for inter process in shared memory

随声附和 提交于 2019-12-13 04:59:19

问题


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


回答1:


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




回答2:


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



来源:https://stackoverflow.com/questions/4461954/barrier-implementation-for-inter-process-in-shared-memory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!