Sending messages to servers

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

Sending messages to servers

Post 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?
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post 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)
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
iammisc
Member
Member
Posts: 269
Joined: Thu Nov 09, 2006 6:23 pm

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

Post by deadmutex »

Thanks a lot! That really helped :D
Crazed123
Member
Member
Posts: 248
Joined: Thu Oct 21, 2004 11:00 pm

Post 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.
Post Reply