Boost logo

Boost Users :

Subject: [Boost-users] Which is the effective way for data transfer for Interprocess shared memory ?
From: Kalyan Chakravarthy Gudimella (kalyan.gudimella_at_[hidden])
Date: 2015-04-22 11:20:20


Hi,

I am currently evaluating boost interprocess library for using shared
memory.

I found two ways to transfer complex data structures.

1. Creating data structures directly in shared memory.

E.g.
http://www.boost.org/doc/libs/1_58_0/doc/html/interprocess/allocators_containers.html#interprocess.allocators_containers.containers_explained.containers_of_containers

class complex_data{
   int id_;
   char_string char_string_;
   int_vector_vector int_vector_vector_;

   public:
   //Since void_allocator is convertible to any other allocator<T>, we
can simplify
   //the initialization taking just one allocator for all inner containers.
   complex_data(int id, const char *name, const void_allocator &void_alloc)
      : id_(id), char_string_(name, void_alloc), int_vector_vector_(void_alloc)
   {}
   //Other members...};

2. Serializing data into bufferstream and deserializing it.

E.g.http://www.boost.org/doc/libs/1_58_0/doc/html/interprocess/streams.html

My initial trial shows that streaming to bufferstream took 7 times more
time than using direct shared structures.

Can you please help me to choose the effective way between these two
approaches?

thanks,
Kalyan



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net