Like Tree2Likes

Is serialization needed, if portability isn't important?

This is a discussion on Is serialization needed, if portability isn't important? within the C++ Programming forums, part of the General Programming Boards category; Now is just as good a time as any to mention that I always reach for "sqlite" by default when ...

  1. #16
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,260
    Now is just as good a time as any to mention that I always reach for "sqlite" by default when writing code for others and I've never had a wiggle of a performance issue due to that aspect of communication.

    Soma

  2. #17
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,239
    If the different processes are considered to be all logically part of the same program (i.e. the fact that there are multiple processes is an "implementation detail"), and the modules are always built together and deployed together, then I would share structures directly, at will. This is especially the case if the processes are direct fork()'s of each other -- share away!

    If the processes are more like clients/servers, peers, SOA entry points, or otherwise, then I would transport data with extreme paranoia (as if they could all potentially be implemented with alien technology).

    EDIT: Obviously there are serious issues if the shared data contains pointers which are actually dereferenced.
    Last edited by brewbuck; 04-13-2012 at 01:04 PM.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  3. #18
    Registered User manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    Kolkata@India
    Posts
    2,498
    Quote Originally Posted by brewbuck View Post
    If the different processes are considered to be all logically part of the same program (i.e. the fact that there are multiple processes is an "implementation detail"), and the modules are always built together and deployed together, then I would share structures directly, at will. This is especially the case if the processes are direct fork()'s of each other -- share away!

    If the processes are more like clients/servers, peers, SOA entry points, or otherwise, then I would transport data with extreme paranoia (as if they could all potentially be implemented with alien technology).
    I don't think it'll matter in this case;
    as the file I'll be mapping to virtual memory will already contain the data (which will be mutable, to an extent, by one of the processes).
    So, the alien tech paranoia would have to exist, as the data could be created by an alien.
    I'm trying to reduce that to the point that there would be no issues.

    EDIT: Obviously there are serious issues if the shared data contains pointers which are actually dereferenced.
    It wouldn't.
    Manasij Mukherjee | gcc-4.8.2 @Arch Linux
    Slow and Steady wins the race... if and only if :
    1.None of the other participants are fast and steady.
    2.The fast and unsteady suddenly falls asleep while running !



  4. #19
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    You might also want to look into Boost.Interprocess. Not only does it provide nice C++ abstractions around shared memory, it also has some container classes that you can place into such memory.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C++ Serialization
    By SevenThunders in forum C++ Programming
    Replies: 4
    Last Post: 04-29-2008, 03:12 AM
  2. Replies: 3
    Last Post: 06-12-2007, 11:21 AM
  3. Serialization yay!
    By Shamino in forum C++ Programming
    Replies: 11
    Last Post: 06-10-2007, 05:53 PM
  4. Serialization
    By Asagohan in forum C++ Programming
    Replies: 8
    Last Post: 10-11-2005, 10:57 PM
  5. Program Portability (code portability)
    By Perica in forum C++ Programming
    Replies: 2
    Last Post: 11-10-2002, 09:03 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21