sending messages accross process boundaries.

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

sending messages accross process boundaries.

Post by Pype.Clicker »

Hi ...
I just wish to hear your opinion about the following problem:
I have client-server for the OS services: applications or kernel module can be either service providers (i.e. servers) or services users (i.e. clients) and services are invoked by sending a message to the server.

Now, i'm about to extend that behaviour (currently client and server were always in the same address space) to a multi-address space scheme where user-level code can be clients or server too ...

and i'm no more sure of who should serialize the messages...

I mean, when a message includes - for instance - a string, would you rather create a flat structure with the string and other stuff
  • at the client, i.e. the client will copy arguments into a flat array of byte whatever the message should look like and wherever the server is located,
  • at the server side, i.e. the server will ask for additionnal mapping if it has to read the string
  • or at the service runtime, i.e. the system will detect the message crosses a boundary and make serializing transparent to both client and server - and it doesn't serialize if no serializing is needed
thanks in advance ...
Tim

Re:sending messages accross process boundaries.

Post by Tim »

Pype.Clicker wrote:applications or kernel module can be either service providers (i.e. servers) or services users (i.e. clients)
Can they be both? e.g. network file system driver using TCP/IP to provide a Samba file system over the network.
I mean, when a message includes - for instance - a string, would you rather create a flat structure with the string and other stuff
Good question, and there are good arguments either way.

Option 1 is the 'Internet protocol -- put everything across the network' way.

Option 2 is the demand paging way.

Option 3 is the intelligent marshalling way.

I think that, in the end, options 1 and 3 are the same thing, except that with option 3 the application doesn't know that it's happening. If you haven't already, read up on how COM (a.k.a. DCE RPC) marshals data across address spaces. In essence, you define your interfaces in Interface Description Language; the IDL compiler emits some C code which can write data to the network at the client end and read it at the server end (and vice versa, for return values).

IMO, if you're doing this propertly, you should copy what DCE RPC/COM does.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:sending messages accross process boundaries.

Post by Pype.Clicker »

Tim Robinson wrote:
Pype.Clicker wrote:applications or kernel module can be either service providers (i.e. servers) or services users (i.e. clients)
Can they be both? e.g. network file system driver using TCP/IP to provide a Samba file system over the network.
Yes, for sure: a module can be client of one service and server for another ... being both client and server on the *same* service is not easy to set up, but it could be done (and is interresting when you have several servers and want to provide extension to what exist).
I think that, in the end, options 1 and 3 are the same thing, except that with option 3 the application doesn't know that it's happening.
The other difference is that in option 3, the marshalling isn't done if
if it's not necessary (for instance, if both server and client are in the same address space, there's no need for marshalling)
IMO, if you're doing this propertly, you should copy what DCE RPC/COM does.
Hmm ... maybe i should get another look into COM, but for what i remember, i didn't like the way it works ...

Btw, i may have found an alternative which looks like multipart message : as the client knows what should be transmit and the runtime service system (kinda middleware) knows how it should be transmitted, the client can provide a multipart list to the middleware, telling which are the flat components to be copied. So rather than trying to follow the pointers recursively, the client come with an exhaustive list of where message parts (strings, subobjects, etc) are, what are they sizes and in which order they should be stored.

When the server needs to read the string, it will rather ask for msg.part(2) than trying to follow msg->str1 ... If the message has been serialized, then part(2) has been changed to refer to the local copy when the message was delivered to the server; if the server and client are in the same address space, then we just have to keep the parts list unchanged :)
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:sending messages accross process boundaries.

Post by Pype.Clicker »

hmm ... i've been g00gling a bit for DCE/RPC, but all i found so far were broken links or uninterresting marketting stuff ... i'll search for more ... if you have some bookmarks to share, i'd be pleased to follow them.
Post Reply