写在升压只有内存映射? [英] Write Only Memory Mapping in boost?

查看:114
本文介绍了写在升压只有内存映射?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么不提高支持进程间只写内存映射?

Why doesn't boost interprocess support write only memory mapping?

也许我失去了一些东西,但不会只写映射是显著比读/写速度映射为操作系统没有从磁盘读取页面,刚刚冲洗掉从内存到页盘?此外,它也有被完全无阻塞(除冲洗和破坏)的利益。

Maybe I'm missing something but wouldn't a write only mapping be significantly faster than a read/write mapping as the OS doesn't have to read in the pages from the disk, just flush out pages from memory to the disk? Also it would have the benefit of being entirely non blocking (except for flushing and destruction).

我会从提振切换到本地操作系统内存映射受益?

Would I benefit by switching from boost to native OS memory mapping?

推荐答案

在事实上,如果你分配大小的新内存映射文件,比方说,20Gb的,你会得到大小的稀疏文件分配。

In fact if you allocate a new memory-mapped file of size, say, 20Gb, you'll get a sparse file allocation of that size.

在中的文件,我们需要有一个读操作的页面映射(如操作系统也许能告诉页面不在物理磁盘上的present还),只有当(如果)那些被弄脏的网页需要他们写出来。

When "mapping in" pages of that files, there need to be a read operation (as the OS might be able to tell that the page is not physically present yet on disk), and only when (if) those pages are dirtied need they be written out.

当然,这是依赖于实现,我不认为POSIX(可)保证这一点,但它不是不合理的行为IYAM,并且将只写映射的等价物。

Of course, this is implementation dependent and I don't think POSIX (can) guarantee this, but it's not unreasonable behaviour IYAM, and would be the equivalent of write-only mapping.

这篇关于写在升压只有内存映射?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆