Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Serialization as an IPC mechanism?

I wrote an implementation and an auto code generator for allowing different process to do Inter process Communication using Message queues.

My Implementation works fine with the primitive data types, but fails when user wants to pass Non-POD [Plain Old Datatypes] types.

On people's suggestion here on SO I read about Boost Serialization and how it allows to serialize even the Non-PODs.

Question :

Q1. Is serialization/De-serialization considered an IPC mechanism in itself or it is used along with other implementation ? [ In other words, should I enhance my message queue implementation using serialization, or I should move on to Serialization as the IPC mechanism itself ? ]

If yes, wouldn't it be slow as it involves writing the data onto hard disk and reading it from there ?

or it is just my misunderstanding and all IPC like d-bus might actually save the data onto disk and just pass on the file identifier to the other process to read ?

like image 562
Amit Tomar Avatar asked Feb 03 '26 12:02

Amit Tomar


1 Answers

Serialisation/Deserialisation isn't an IPC mechanism in and of itself - You need to use something like pipes to communicate between different processes. Having said that, you could definitely serialise/deseralise data to and from these pipes.

Using such a strategy could be slow, but if so, any slowness would come from serialisation and buffering. If you're using pipes, you're just passing the serialised bytes through memory, not by writing to the disk and then reading from the disk.

I wrote an implementation of a pattern like this in C# a while ago, there's a blog post on it here if you're interested in some implementation ideas.

like image 54
Fabian Tamp Avatar answered Feb 05 '26 00:02

Fabian Tamp



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!