13.07.2015 Views

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Inter-process communication 305Before line 10Finger portAFingerrequestFinger portAFingerA’s portAfter line 15After line 17Finger portAFingerA’s portresponseFigure 9.7 Using well-known portsA process that creates a port is given a port capability by the port manager in thekernel. This number is like a port descriptor in that it has meaning only to that processand is used in the ReadPort and WritePort calls to specify which port is being used.However, we allow the process to write this capability as part of a message (sent to anyport). The process that receives the message now has the transmitted capability and mayuse the port it refers to.Transfer of capabilities can be used to introduce two processes to each other. Forexample, let us build the equivalent of a pipe between the List and Sort processes, suchas was shown in Figure 9.5. We will use bound ports for this example, although otherkinds could work as well. Since bound ports may have only one reader and one writer,we will stipulate that when a process writes a port capability to a port, it loses that capability.We will assume the following service calls:Load(load-image file). This call builds the new process and also builds a newbound port. It returns to the caller (the parent) the write capability for that port andinitializes the new process (the child) with a read capability for the port.CreatePort. This call builds a new bound port and returns both the read and thewrite capability.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!