2

我正在阅读beej 的共享内存段指南

最后他说:

更常见的是,一个进程将附加到该段并运行一段时间,而其他程序正在更改并读取共享段。观察一个进程更新段并看到更改出现在其他进程上是很不错的。同样,为简单起见,示例代码并没有这样做,但您可以看到数据是如何在独立进程之间共享的。

我的问题是:共享内存是只读的时候有必要吗?

4

1 回答 1

2

The main purpose of shared memory is the Inter-process communication (IPC). But when you make shared memory read only the purpose is defeated.So at least there should be one process which can write into it and then you can make to READ ONLY for rest of the processes.

于 2012-11-06T10:31:41.590 回答