当它的只读共享内存 [英] Shared Memory when it's for read only
问题描述
我读 beej的共享内存段 <指南/ p>
在最后,他说:
更常见的是,这个过程将连接到段和运行了一点,而其他项目正在改变和读取共享段。它的整洁看一个进程更新段和看到的变化出现其他进程。同样,为了简单起见,样本code不这样做,但你可以看到数据是如何独立的进程间共享。
我的问题是:它是在必要的时候共享内存是只读
共享内存的主要目的是的进程间通信(IPC)
。
但是,当你做共享内存只读
目的是defeated.So至少应该有一个过程,可以写进去,然后你可以只读取休息该
流程。
I am reading beej's guide for Shared Memory Segments
At the end he says:
More commonly, a process will attach to the segment and run for a bit while other programs are changing and reading the shared segment. It's neat to watch one process update the segment and see the changes appear to other processes. Again, for simplicity, the sample code doesn't do that, but you can see how the data is shared between independent processes.
My question is: it is necessary when the shared memory is for read only?
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.
这篇关于当它的只读共享内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!