简体   繁体   English

共享内存中进程间的屏障实现

[英]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. 流程是MPI流程。 I do not want to use the MPI_Barrier function, because the general policy for all the MPI implementation is active waiting. 我不想使用MPI_Barrier函数,因为所有MPI实现的一般策略都是活动等待。 I want my processes sleeping as long as they wait. 我希望我的进程只要等待就可以休眠。

The restrictions: 限制条件:

  • should be in C, maybe in C++ 应该在C中,也许在C ++中
  • no spinlock, so it could use semaphore 没有自旋锁,因此可以使用信号量
  • linux OS Linux操作系统

I am confident it exists thousands of barrier implementation, but I do not find any?! 我相信它存在成千上万个障碍实施程序,但是我找不到任何?!

Thanks 谢谢

pthread_barrier is the POSIX API for barriers. pthread_barrier是用于屏障的POSIX API。 They may live in process shared memory if you initialize them accordingly. 如果您进行相应的初始化,它们可能会驻留在进程共享内存中。

You should check out Boost. 您应该查看Boost。 I believe that it has an interprocess module that you can use. 我相信它具有可以使用的进程间模块。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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