[libvirt-users] method for communication between containers

Daniel P. Berrange berrange at redhat.com
Wed Apr 9 09:07:11 UTC 2014

On Wed, Apr 09, 2014 at 05:55:57AM +0000, WANG Cheng D wrote:
> Dear Daniel,
> As you know, following your suggestion, I can expose shared memory to
> two containers hosted by the same machine, thus the two containers can
> exchange data. Now I have a new problem: how does the containers avoid
> concurrent accesses to the shared memory? In a native system, this can
> be achieved by using semaphore. But I don't know how the two containers
> can see the same semaphore. Do I need to design a mechanism to control
> the access to the shared memory?

Correct, there's no way to share semaphores. Since you hav shared
memory though, can you use a POSIX process shared mutex that is
allocated in that shared memory block.

|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

More information about the libvirt-users mailing list