I have task to create messaging queue between processes that will not have size limit (up to 1 Mb, but most of messages are 128 bytes size).
So, I can't use:
- boost::interproc::message_queue - has limited size;
- zeromq (inproc://) - it is not implemented for Windows;
- sockets (zeromq, or any other socket interface) - I can't occupy any port;
That is why I decide to use boost::interproc::shared_memory_object.
I plan to truncate up to 1Mb of memory, and then put there any message with header, that will defines it's size or will inform that it is last message.
Function to write - that will lock named mutex, write to the end of heap message and move "last message" flag to show it.
Function to read - that will lock it, read all and delete, moving "finish flag" to beginning of heap.
That looks good, but question is to mapping 1MB of memory each time I want to read/write. I afraid that may be long operation. Is it true?
If mapping such big heap is high cost operation, how can I solve it? Maybe there is another mechanism for interproc message queue without message size limit?