加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – 通过nfs共享的mmap文件?

发布时间:2020-12-14 01:14:20 所属栏目:Linux 来源:网络整理
导读:情景A: To share a read/write block of memory between two processes running on the same host,Joe mmaps the same local file from both processes. 情景B: To share a read/write block of memory between two processes running on two different ho
情景A:

To share a read/write block of memory between two processes running on the same host,Joe mmaps the same local file from both processes.

情景B:

To share a read/write block of memory between two processes running on two different hosts,Joe shares a file via nfs between the hosts,and then mmaps the shared file from both processes.

有人试过Scenario B吗?场景B中出现的哪些额外问题不适用于场景A?

解决方法

没有一些额外的操作,Mmap将不会共享数据.

如果更改文件的mmaped部分中的数据,则更改将仅存储在内存中.它们不会被刷新到文件系统(本地或远程),直到msync或munmap或关闭甚至决定OS内核及其FS.

使用NFS时,与使用本地FS相比,锁定和存储数据会更慢.刷新超时和文件操作时间也会有所不同.

On the sister site人说NFS可能具有较差的缓存策略,因此将对I / O请求计数与本地FS进行比较的NFS服务器的I / O请求会更多.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读