Page 1 of 1

Sending messages to servers

Posted: Sun Feb 25, 2007 10:32 pm
by deadmutex
I've been wondering for a while about how a user-level server is able to communicate with another server(file server, memory server, etc...) when it first loads.

How is it possible for the server to send messages if it doesn't know where to send them? Also, how can the server know if other servers even exist?

Posted: Mon Feb 26, 2007 2:54 am
by Combuster
this can be achieved by either fixing the location (port?) of the server or having a fixed location where this information is stored. (like, asking a kernel where a softlink is pointing)

Posted: Mon Feb 26, 2007 10:27 pm
by iammisc
The way this happens in my kernel is that on startup my server sets its name as something special like "VFS" or "PCI". the kernel stores this info and will return the server's pid when a syscall is called.

Posted: Tue Feb 27, 2007 8:23 am
by deadmutex
Thanks a lot! That really helped :D

Posted: Tue Feb 27, 2007 8:50 pm
by Crazed123
Those are the common approaches. What you're really looking for (in true Computer-Science overgeneralization) is a namespace of server processes wherein any process can look up a server process to perform some task.

Note that the namespace need not be global. You can quite easily give each process its own namespace if you like, as long as the names all eventually map to identifiers in some global namespace. Plan 9 took an approach a bit like this, giving every process its own "file-system" full of "files" representing various system resources under various names.

You can also choose to support or not support aliasing. You could have a name refer to another name, which refers to another name. That could continue with arbitrary depth until either a cycle is formed or a globally-valid identifier is reached.

Heck, you could also put resources other than server processes into the namespace. Plan 9 did.

And yes, these are legitimate design decisions you should make. Not making them leads to kludging things on later, or rewriting. Not one line of my kernel survives from the original version, and I can tell you that making up for an earlier lack of design is not a pleasant task.