Where is Message queue content stored?
Asked Answered
L

1

6

While using the POSIX Message queues I noticed there were some files being created on the File system with the name I was creating the queues. My questions :

Q1. Do message queues queue up the messages on the Hard Disk and not RAM ?

Q2. If so, shouldn't this be very slow in implementation as it involves HardDisk ?


Edit:

I read this in the book 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.

Even if it is VFS, it is still stored on the HardDisk, right ?

With this information in mind, can someone comment on the second question now ? (and / or First one also if there is something more to add)

Loreenlorelei answered 27/2, 2013 at 15:29 Comment(1)
I think it is just stored in RAM and not stored on Harddisk. It is something similar to RAM disk, such that you may able to access it "like" a file system, but it doesn't exist on harddisk.Lough
A
7

Below link may give some clarity on first question http://man7.org/linux/man-pages/man7/mq_overview.7.html

Regarding second question, of course the file based queue will be slower than memory based one. But this may not be as slow as some random file access operations since it is optimized and implemented specific for queuing.

Antependium answered 29/11, 2013 at 8:48 Comment(1)
This deserves to be awarded the answerThecla

© 2022 - 2024 — McMap. All rights reserved.