Penguin
Note: You are viewing an old revision of this page. View the current version.

Serialisation is the concept of taking some in memory data structure and converting it to a form that can be easily written to a file, socket or other stream where it can be deserialised later into the same in memory data structure.

This is normally fairly straight forward, however it has some rather nasty corner cases, like dealing with groups of objects that form a cycle.

Serialisation is sometimes also called persistance usually if the same program is expecting to serialise the data on exit and deserialise it on startup again.

RPC is a special case of serialisation, where you specify which function to call and serialise it's arguments and get a serialisation of the return value back. Special care has to be taken about arguments that are passed by reference. Usually an IDL of some type is used to specify which arguments are passed by reference and what methods are supported by the RPC server. IDL is also used by some languages which do serialisation to specify how things are serialised.

Cross language serialisation has always been a problem. There are many (good) solutions that you can use based on support for your language, what goals you have and where your allegences lie.

One common solution recently has been XML based serialisation, there are two common RPC methods have been used which both use their own XML based serialisation:

XML of course has the property that it is very verbose, making debugging easy, and bandwidth consumption high. In this class is also the XML serialisation of ASN.1, which is just a serialisation method and isn't directly used for RPC.

There are several binary seralisation methods:

  • BER/DER (aka ASN.1 encodings). These generate fairly compact, portable seralisations.
  • IIOP? (from CORBA). This requires the corba IDL to serialise/deserialise.
  • SUNXDR?. This was invented at Sun. This is used for SunRPC (which in turn is used for things such as NFS).

Programming languages often have their own serialisation formats:

  • Python -- Pickle. (3 different versions).
  • PHP -- PHP "serialize()"
  • Perl -- Freeze/Thaw

CategoryProgramming