Boost logo

Boost :

From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2006-02-07 12:01:20


Hi Darren,
> Generally I thought the documentation was good and thorough.

Thanks!

> 1. I wanted to see at least a paragraph describing what kinds of
> problems shared memory solves. I assume it is for inter-process
> communication on the same machine. What are the pros/cons compared to
> using TCP/IP sockets, and pipes? Sockets have the advantage that they
> work beyond the local machine, but presumably shared memory is quicker:
> I wanted to see a number to say just how much quicker.

At least UNIX sockets/pipes are built using shared memory, so it should
be fast! Think about a data-base in shared memory: it will be always
faster to do a lookup directly than sending a message to an application,
and waiting response. With sockets, you must serialize the data first to
a buffer, the OS copies that to internal memory and after that, to
another process' memory, and the other process must deserialize it. With
shared memory there is just one copy.

Above from that, shared memory is used to construct more advanced IPC
mechanisms, like message queues/pipes, UNIX domain sockets, so it's a
basic building block for more advanced mechanisms. Anyway, I have no
problem to add a paragraph describing this.

> 2. "Performance of Shmem" is better called "Optimization Options".
> http://ice.prohosting.com/newfunk/boost/libs/shmem/doc/html/shmem/performance.html

Yes, it's a better name. Performance should talk about numbers, not
about where you should optimize. Thanks.

> 3. In the quick guide
> (http://ice.prohosting.com/newfunk/boost/libs/shmem/doc/html/shmem/quick_guide.html):
>
> 3a. in the first example code you have "(void)offset;" on a line by
> itself. Is this a typo? If not it is unusual so needs more explanation.
> The same for "(void)msg;" in the second example.

Sorry, it's a copy-paste from a compilable example, where I use that to
avoid "not used variable" warnings. I will remove it. Thanks.

> 3b. I'd have liked to see a full example showing the interprocess
> communication. Or at least expand out "//Copy message to buffer" to show
> writing a string into the buffer.

The problem is that there is no standard C++ IPC mechanism. I could use
the boost::shmem::shared_message_queue to send the pointer and introduce
also this class.

> 4. I didn't understand the first sentence in the limitations.html page:
>
> "Shmem wants to be portable across multiple operating systems so that it
> can not count with an operating systems that maps shared memory to the
> same base address in all processes in the system"
>
> I think I'm stuck on "can not count with".

Sorry about my bad English. As other boosters have explained it tries to
say, in Jurko's words:

'can not count on the OS mapping a shared memory segments to the same
base memory address in all processes in the system that connect to it'

>> - What is your evaluation of the potential usefulness of the library?
>
> I don't know. For applications I can think of I would instead choose to
> use sockets, so I can easily move part of an application to another
> machine, or across a cluster. Also I can easily write part of an
> application in a different language.

Shared memory data-bases, construction of advanced IPC mechanisms
(pipes, message queues...) with lower overhead

Thanks and regards,

Ion


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk