0

For some project I am plannning to develop a communication stack, which has to be used by multiple applications. The idea is to have the stack inside a shared library.The core of the stack requires some threads for handling rx/tx and message processing. This part will run in a dedicated process.

Some other applications will access the shared library via a set of function calls. In this case the stack and each application run in different processes.

The way I see it now I have to define some IPC mechanism inside the shared lib which passes messages back and forth between the stack logic and the application interface (either via pipes, sockets or shared mem).

I wonder what the usual approaches are for this kind of situations ?

Is it for example possible to instantiate the classes which handle the stack inside a shared memory segment, so it is not required to translate function calls into messages ?

Waldorf
  • 833
  • 2
  • 13
  • 24
  • The answer to your question will depend very much on details. I wrote a long answer here: http://stackoverflow.com/questions/14225010/fastest-technique-to-pass-messages-between-processes-on-linux/14225810#14225810 which discusses some of the decision process, and "what is best". Sometimes you'll also find that "what you need to do" only really works on one or another mechanism (e.g. detecting that the other end "disappeared" will not work in shared memory) – Mats Petersson Jan 18 '15 at 18:45
  • Read your answer. Has some good points. The reason why I am not looking to only a message passing mechanism is because there has to be also a lot of configuration via functions. After considering having a class in shared mem..and taking into account your remark that "the other end might have disappeared" then a combination seems useful. Class for config and pipe for data. – Waldorf Jan 18 '15 at 19:43
  • Surely the "configuration" is simply a message to say "configure parameter X with value Y" (exactly how you construct such a message is a different story, anything from a wordy string to a set of integers/enums will work - somewhat depending on what you start with) – Mats Petersson Jan 18 '15 at 19:45

0 Answers0