Path: utzoo!mnetor!uunet!husc6!mailrus!nrl-cmf!ames!oliveb!sun!pepper!cmcmanis From: cmcmanis%pepper@Sun.COM (Chuck McManis) Newsgroups: comp.sys.amiga Subject: Re: IPC - A proposal Message-ID: <44626@sun.uucp> Date: 8 Mar 88 17:51:22 GMT References: <5375@well.UUCP> <739@nuchat.UUCP> <7455@agate.BERKELEY.EDU> <2116@polya.STANFORD.EDU> Sender: news@sun.uucp Reply-To: cmcmanis@sun.UUCP (Chuck McManis) Organization: Sun Microsystems, Mountain View Lines: 42 In article <2116@polya.STANFORD.EDU> (Tomas G. Rokicki) writes: > ... Do the above, > and everything's hunky-dory, except you have a FindPort() within > Forbid()/Permit() . . . Hmmm, the problem everyone is complaining about is the speed of doing a FindPort() which takes to long. Maybe what we need instead is a way of checking to see that a port we originally got was still valid and then encased the destruction of the port and sending to the port in F/P pairs. As an illustration : In the client : /* in the init section */ port = FindPort("Foobar.port"); /* in the loop */ Forbid(); If (IsValidPort(port)) PutMsg(port,msg); Permit(); In the server : /* in the init section */ port = CreatePort("Foobar.port"); /* in the exit code */ Forbid(); MoveMsgList(port,safearea); NewDeletePort(port); /* Marks memory pointed to by port as invalid */ Permit(); ReplyAllMsgs(safearea); exit(0); Note that the NewDeletePort() would scribble on the port in some way to make it appear invalid (nulling out the memory would be sufficient) The the client task knows that port is now invalid and won't send to it. Then the server sends replies to all the messages that were queued. And exits. If all of the clients follow this rule then A) it is fast (IsValidPort could be as simple as port.mn_Type == NT_MESSAGE) and B) it is reasonably safe from race conditions. --Chuck McManis uucp: {anywhere}!sun!cmcmanis BIX: cmcmanis ARPAnet: cmcmanis@sun.com These opinions are my own and no one elses, but you knew that didn't you.