Serialization

Serialization is converting its state into a byte stream in such a way that the byte stream can be converted back into a copy of the object.

This is done together with Marshalling to transmit data for IPC between multiple machines.

Why is serialization needed?

Like if you use shared memory, it’s not a concern. This is because you are sharing data on the same machine. However, when you’re sharing data across the network, to a different computer, that computer has different hardware.

There’s no guarantee that the computer is going to interpret the bits the same way (factors like Endianness, 32-bit vs. 64-bit system, floating point system, file systems). Things aren’t standardized.

  • Like your idea would be to copy the raw 0s and 1s, whatever is stored on the computer. But that doesn’t work unfortunately.

Serialization essentially neutralizes most of these differences because it provides a way to convert data into a platform-independent format.

Main serialization libraries: