[interfacekit] Re: BSession(NG)

On 2004-05-09 at 15:16:29 [+0200], Adi Oanca wrote:
> Ingo Weinhold wrote:
[...]
> > Isn't the problem, that there is no maximum message size, since some 
> > messages
> > contain arguments of variable size (like BRegions)? So one either has to 
> > be
> > prepared to split messages or to resize the send/receive buffers.
> > 
> > I personally would favor a strategy employing a fixed transfer buffer and
> > passing larger messages via areas. Using the new syscall to transfer area
> > ownership, we will probably introduce, this should be pretty cheap.
> 
>     An AreaLink class is already in our repository, still I don't know if
> it works. But this too has the same problem as port communication - a
> maximum size, and we again have to split messages.

That isn't what I meant. I was thinking of port communication as already 
proposed, using a fixed-sized buffer. When a message whose size exceeds the 
buffer capacity shall be sent, one would allocate an area for the message, 
transfer the area ownership to the target application, and send through the 
port only a short message containing the ID of the area and the size of the 
actual message. The receiver gets the address of the area, processes the 
message and deletes the area.

For client server communication (as in our case), it would be best to always 
let the server do the area ownership transfer, to avoid stray areas resulting 
from a client crashing between transfering the area ownership and sending the 
port message.

>     Now, regarding the way app_server communicates with the client side...
> aren't areas the fastest method? If then, why are we using ports? :-|

I haven't had a look at the AreaLink class yet, but I suspect, it uses areas 
as shared memory between client and server. This is probably really the 
fastest way to transfer data, but also an unsafe one. A client application 
can generally not be trusted. If it runs amok, it may write random data into 
any shared memory. For things like bitmap data that is rather harmless, but 
not for data whose integrity is of importance. In such a case to be on the 
safe side the server would need to first copy the data into local memory, 
check the integrity and then process them further. And if one needs to copy 
the data anyway, one can as well use a port in the first place.

CU, Ingo

Other related posts: