Port Abstraction Questions

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
deadmutex
Member
Member
Posts: 85
Joined: Wed Sep 28, 2005 11:00 pm

Port Abstraction Questions

Post 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.
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Port Abstraction Questions

Post 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
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
User avatar
deadmutex
Member
Member
Posts: 85
Joined: Wed Sep 28, 2005 11:00 pm

Post by deadmutex »

Thanks for your comment! That really helped cleared things up.
Post Reply