【正文】
implemented in one of three ways. ? Zero capacity – 0 messages Sender must wait for receiver (rendezvous). ? Bounded capacity – finite length of n messages Sender must wait if link full. ? Unbounded capacity – infinite length Sender never waits. IPC: An example: Mach ? Each task has two special mailboxes: the Kernel mailbox and the Notify mailbox. ? Message transferring ? msg_send, msg_receive, msg_rpc. ? Mailbox creation ? port_allocate. IPC: An example: Windows 2K ? LPC: local procedure call facility ? Two types of ports: connection ports and munication ports. ? Messagepassing techniques ? For small messages, to use the port’s message queue as intermediate storage and copies the message from one process to other ? For a large message, to pass the message through a section object (or shared memory) ? … CLIENTSERVER COMMUNICATION ? Sockets ? Remote Procedure Calls ? Remote Method Invocation (Java) C/S: Sockets ? A socket is defined as an endpoint for munication. ? Concatenation of IP address and port ? The socket :1625 refers to port 1625 on host ? Communication consists between a pair of sockets. C/S: Socket Communication C/S: Java Socket Programming ? Writing C/S Application using Java Sockets ? KnockKnockProtocol Server: Knock knock! Client: Who39。 } INTERPROCESS COMMUNICATION (IPC) ? IPC . Sharedmemory ? Efficiency, ? Centralized vs Distributed. ? Two IPC operations ? send ? receive ? IPC issues ? Naming: direct or indirect munication ? Symmetric or asymmetric munication ? Automatic or explicit buffering ? Send by copy or send by reference ? Fixedsized or variablesized messages InterProcess Communication (IPC) ? Implementation issues ? How to refer to each other: ? Direct munication ? Indirect munication ? How to synchronize each other ? Blocking ? Nonblocking ? How to handle messages in the link. IPC: Naming ? Direct munication ? Processes must name each other explicitly: ? send (P, message) – send to process P ? receive(Q, message) – receive from process Q ? Properties of direct munication link ? Links are established automatically. ? A link is associated with exactly one pair of municating processes. ? Between each pair there exists exactly one link. ? Asymmetry in addressing