增强磁盘或内存中的互斥体和信号量?
我想知道 Boost 互斥体和信号量是否在磁盘上存储任何信息,或者是否有一个选项可以避免这种情况(例如将数据存储在内存块中)。
我之所以关心这个细节,既是出于性能原因,也是为了避免过早扔掉我的 SSD...
谢谢。
I would like to know if Boost mutexes and semaphores store any information on the disk, or if there is an option to avoid that (e.g. storing the data in a memory block).
I care about this detail both for performance reasons, and also to avoid throwing my SSD away too soon...
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
它们纯粹存在于记忆中。任何内容最终保存在磁盘上的唯一方法是将该特定内存写入分页文件。然而,如果这种情况确实发生,它对 SSD 的作用不会比写入页面文件的其他内容更多。
They're purely in memory. The only way anything would end up on disk would be if that particular memory got written out to the paging file. If that does happen, however, it's not going to do any more to your SSD than anything else being written to the paging file.
没有。需要文件存储的 Boost 互斥体使用内存映射文件。但是主内存中的任何内容都可能被分页到磁盘,除非您执行一些与操作系统相关的操作来阻止它。
http://www.boost.org/doc/libs /1_37_0/doc/html/interprocess/synchronization_mechanisms.html
Nope. Boost mutexes that require file storage use memory-mapped files. But anything in main memory might possibly paged out to disk, unless you do some operating-system dependent action to prevent it.
http://www.boost.org/doc/libs/1_37_0/doc/html/interprocess/synchronization_mechanisms.html