linux – 消息队列内容存储在哪里?

在使用POSIX消息队列时,我注意到文件系统上创建了一些文件,其名称是我创建队列.我的问题:

Q1.消息队列是否将硬盘上的消息排队,而不是RAM?

Q2.如果是这样,那么在实施中它是否应该非常慢,因为它涉及HardDisk?

编辑:

我在The Linux Programming Interface书中读到了这个:

On Linux,POSIX message queues are implemented as i-nodes in a virtual
file system,and message queue descriptors and open message queue
descriptions are implemented as file descriptors and open file
descriptions,respectively. However,these are implementation details
that are not required by SUSv3 and don’t hold true on some other UNIX
implementations.

即使它是VFS,它仍然存储在HardDisk上,对吧?

记住这些信息,现在有人可以评论第二个问题吗? (和/或第一个也有更多要添加的东西)

解决方法

以下链接可能会对第一个问题有所清晰


http://man7.org/linux/man-pages/man7/mq_overview.7.html

关于第二个问题,当然基于文件的队列将比基于内存的队列慢.但这可能不像一些随机文件访问操作那么慢,因为它是针对排队进行优化和实现的.

dawei

【声明】:唐山站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。