c++ - Boost.Interprocess 是否牺牲性能来实现可移植性

标签 c++ boost process ipc boost-interprocess

我刚刚读了this page Boost.Interprocess 文档。这似乎表明,为了适应不同操作系统之间的差异并达成某种共识,某些进程间机制并没有使用操作系统提供的直接对应的本地机制来实现,而是使用其他机制来模拟。我想知道这是否会对性能造成相当大的影响。

该页面的最后一部分与我特别相关,引用如下

Since each mechanism can be emulated through diferent mechanisms (a semaphore might be implement using mapped files or native semaphores) permissions types could vary when the implementation of a named resource changes (eg.: in Windows mutexes require synchronize permissions, but that's not the case of files). To avoid this, Boost.Interprocess relies on file-like permissions, requiring file read-write-delete permissions to open named synchronization mechanisms (mutex, semaphores, etc.) and appropiate read or read-write-delete permissions for shared memory. This approach has two advantages: it's similar to the UNIX philosophy and the programmer does not need to know how the named resource is implemented.

根据这篇文章,我猜测大部分 kernel objects Windows native 提供的进程间同步(例如,Event、Mutex、Semaphore)只是没有被 Boost.Interprocess 使用。

最佳答案

我以前见过使用 native 内核对象。

当我阅读它时,该消息只谈到了权限

它提到这是模拟的,以防底层对象具有不同的访问控制。它实际上并没有提到它是如何模拟的。

关于c++ - Boost.Interprocess 是否牺牲性能来实现可移植性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33042427/

相关文章:

c++ - 带 std::index_sequence 的三元运算符

c++ - move 是 c++ 中的关键字吗?

c++ - 以不同产品的返回值(value) boost 工厂

c++ - boost 业力 : how does this implicit call to transform_attribute work?(或没有?)

c++ - 如何在新的单独线程中运行 vector 中的每个函数?

javascript - Node.js - 生成 gzip 进程

c++ - Linux API 列出正在运行的进程?

c++ - -fPIC 忽略目标(所有代码与位置无关),无用警告

c++ - LibCurl Unicode 数据

c++ - 将 std::set 或 std::map 与共享内存一起使用