Date: Wed, 13 Nov 1996 12:06:11 -0800 (PST) From: "Eric J. Schwertfeger" <ejs@bfd.com> To: Joe Greco <jgreco@brasil.moneng.mei.com> Cc: Christopher Masto <exidor@superior.net>, hackers@FreeBSD.org Subject: Re: Programming technique for non-forking servers? Message-ID: <Pine.BSF.3.95.961113111742.10888A-100000@harlie> In-Reply-To: <199611131803.MAA23482@brasil.moneng.mei.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 13 Nov 1996, Joe Greco wrote: > > (more often recently) I'm working on something that screams for a > > couple of cooperating processes.. coming from the Amiga world, this > > seems very natural, and on the Amiga it was very simple. One process > > opens up a "message port", and another process sends messages to it. > > The closest thing I have seen is creating a socket in the Unix > > domain.. but this doesn't seem very popular, so I get the feeling it > > isn't often the right answer. > > As far as I can tell... you're wrong. :-) > > UNIX is fundamentally different from crud like DOS... interprocess > communication is a core part of the system and is actively encouraged. As was (is?) the Amiga. I think SYSV IPC is closer to the Amiga's IPC than sockets. Basically, you created named (or unnamed, if the program would be the only thing using it) ports, then send structures to the port. Since the Amiga didn't protect memory at all, it was quite efficient, as the recipient could free the port, reply, or modify the packet and reply. You got a pointer to a block of memory, rather than a stream (more like UDP than TCP). You could probably emulate this with UDP, and some kind of way of registering a name to a port, and lookup. This is assuming you don't just allocate a port number. The best part of it all was that this was built into everything. All window events were sent to a program by sending a message to the port, you could even do async IO by setting it up so that you got notified of the event by a message sent to your port. And all processes (as opposed to tasks) had their own port. Had to, as the equivelent of signals was done through this port. > Where else can you whip out a dozen lines of C code that connects to a > process in Japan and starts talking to it? No arguments there. > IPC is _great_. It is _often_ the right answer. Exactly, which is why I still occasionally pine for an OS built around it :-) What I actually think Amiga programmers are missing is the shared addressing space, so that two tasks/processes could easily handle the same data structures, and seeing each other's modifications. While this isn't hard, there don't seem to be any handy tutorials on doing it in a unix-like environment, whereas it was hard not to figure it out on the Amiga. I think a handy thread-safe library based on either mmap/sockets or SYSV IPC/SHM would be a wonderful gift to the world at large. And yes, I'll do it if no one beats me to it. Of course, it'll take me until next year to find enough free time just to figure out the scope of what I want (feel free to email me if you want to bias me :-). Darn, and I just got rid of my Amiga RKM's this year.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.95.961113111742.10888A-100000>