boost iostream映射文件和boost进程间映射文件之间有区别吗? [英] Is there a difference between boost iostream mapped file and boost interprocess mapped file?

查看:179
本文介绍了boost iostream映射文件和boost进程间映射文件之间有区别吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在内存中创建一个映射的二进制文件;但是我不确定如何创建要映射到系统中的文件.我阅读了几次文档,意识到有2种映射文件实现,一种在iostream中,另一种在进程间中.

I want to create a mapped binary file into memory; however I am not sure how to create the file to be mapped into the system. I read the documentation several times and realize there are 2 mapped file implementations, one in iostream and the other in interprocess.

你们对如何将映射文件创建到共享内存有任何想法吗?我试图允许多线程程序读取以二进制文件格式编写的大型double数组. iostream和进程间的映射文件又有什么区别?

Do you guys have any idea on how to create a mapped file into shared memory? I am trying to allow a multi-threaded program to read an array of large double written in a binary file format. Also what is the difference between the mapped file in iostream and interprocess?

推荐答案

据我所知,iostreams会将映射文件放置在共享内存中(这就是您想要的);但是,进程间将文件放置在另一个进程的地址空间中.

As far as I can tell, iostreams will place the mapped file in shared memory (this is what you want); however, interprocess however places the file in a another process's address space.

除非您有多个将以某种方式相互通信的进程(而不是线程),否则您应该使用iostream.

You should probably use iostreams unless you have multiple processes (not threads) that will be communicating with each other in some way.

这篇关于boost iostream映射文件和boost进程间映射文件之间有区别吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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