Page 1 of 1

Port Abstraction Questions

Posted: Thu Jan 04, 2007 12:20 am
by deadmutex
I'm kinda confused about the idea about using ports in message passing. The wiki says that you would send messages to ports instead of the individual thread. Would each port be connected to a unique mailbox or could multiple ports refer to the same one? Does there even need to be a mailbox at all? Also, how would other threads from different processes know of the existence of ports created by servers?

PS: If anyone can point to an article or paper explaining message passing ports, it would be very much appreciated. Thanks.

Re: Port Abstraction Questions

Posted: Thu Jan 04, 2007 1:16 am
by Brendan
Hi,
deadmutex wrote:I'm kinda confused about the idea about using ports in message passing. The wiki says that you would send messages to ports instead of the individual thread. Would each port be connected to a unique mailbox or could multiple ports refer to the same one? Does there even need to be a mailbox at all?
IMHO this is just different terminology: port = mailbox = message exchange = something (e.g. a number) to uniquely identify where the message is being sent (and possibly, where it was sent from).
deadmutex wrote:Also, how would other threads from different processes know of the existence of ports created by servers?
One way is to use the (virtual) file system. For example, if you write a font engine you might create a file called "/services/my_font_engine" that contains the port/mailbox/exchange for the font engine. Alternatively the OS might have a seperate name lookup service so you can do something like "bindMessagePort(name, portNumber)" and other people can do "portNumber = findMessagePort(name)".
deadmutex wrote:PS: If anyone can point to an article or paper explaining message passing ports, it would be very much appreciated. Thanks.
I've never seen a generic article - most articles describe how a specific form of messaging was (or could be) implemented, but don't discuss the wide variety of different ways it could be done.

The essential idea is sending N bytes from A to B, but what those bytes are, what range of values N can be, what A and B are (and how they are allocated, if they are allocated), how the scheduler is involved and how it is actually implemented are all things that vary significantly.


Cheers,

Brendan

Posted: Thu Jan 04, 2007 4:48 pm
by deadmutex
Thanks for your comment! That really helped cleared things up.