CS241 System Programming Interprocess Communication (VII)ContentsAdministrativeInterprocess Communication Paradigms within a Single MachineConnection-Oriented Communication Paradigm for Client-Server InteractionConnection-Oriented Communication Paradigm between two Remote MachinesConnection-less Communication Paradigm between Two Different MachinesConnection-less Communication Paradigms between Two Different MachinesRemote Procedure Call (1)Remote Procedure Call (2)Remote Procedure Call (3)More RPC (4)RPC Semantics (5)Application of RPCApplication of RPC (Distributed File System)Performance Issues when Exchanging Messages between Clients and ServersSynchronous or AsynchronousLossNamingOther Performance IssuesNetwork Model - Topology: criteriaFully ConnectedHierarchicalStar-Connected NetworkBus-Connected NetworkRing-Connected NetworkRoutingContention - Collision DetectContention - Token PassingContention - Message SlotsSummaryCS241 System Programming Interprocess Communication (VII)Klara NahrstedtLecture 404/28/2006ContentsCommunication Paradigms – Putting it TogetherRemote Procedure CallPerformance Issues – Things to be aware offAdministrativeRead R&R Chapter 19,20MP5 is on – deadline May 1 (Monday), 4pmConflict Exam – Check the newsgroup posting Homework 2 – posted April 24 – deadline May 3, midnightQuiz 12 – May 3 OPTIONAL !!! –Cover Synchronization–Cover File Systems–Cover Memory Management There is more than 1 metaserver running for mp5, all the students appear to be using just one of them, check the status page, and spread out a little better; similarly, if need be, more servers will be running over the weekendInterprocess Communication Paradigms within a Single MachinePipes–Pipe command creates a communication butter that two processes (Parent and Child) can use to access via fildes[0] to read from and fildes[1] to write to. Shared memory–Shmid – shared memory segment is attached to the calling process –Shmget, Shmat assist in creating the shared memory segment and attaching it to the calling process–Read/write assist in communicating via shared memoryMessage Queues–Msqid – major data structure for message queue is needed–Msgget, msgsnd, msgrsv assist in creating the message queue and communicating via message queueConnection-Oriented Communication Paradigm for Client-Server Interaction TCPTCPNetworkProgramLogic for Server ProcessProgramLogic forClientProcessConnection-Oriented Communication Paradigm between two Remote MachinesConnection is established–Setup the socket structure–Bind the process and socket to a specific port on each side–Use the socket structure and port throughout the whole session until the connection is closedTCP Protocol ensures that the connection is reliable, packets arrive in order, and connection is on throughout the whole session In this paradigm we don’t need connection-related control operations (e.g., acknowledgement, reply messages) since TCP executes them and controls the data stream.Connection-less Communication Paradigm between Two Different Machinesu_openudp(p)u_openudp(p)u_sendtohost()closeu_recvfrom()UICI UDP ServerUICI UDP Clientcreate UDP endpointbound to port pCreate unbound UDP endpointWait for request send requestprocess requestresume waitingclose endpointrequest messageu_sendto()send responsereply messageu_recvfrom()wait for responseUDPUDP ProtocolNetworkProgramLogicFor ServerProcessProgram LogicFor ClientProcessConnection-less Communication Paradigms between Two Different MachinesNo connection setupDatagram messages are being exchangedSince no connection exists, each message must have in its send/recv message the source and destination information. Underlying UDP protocol provides only a forwarding mechanism, nothing elseIf the application processes want more reliability, but want to run on top of the UDP protocol, they must provide this capability themselves via ‘request-reply’ protocol or ‘request-reply-acknowledgement’ protocolsRemote Procedure Call (1)Steps in making a remote procedure call–the stubs are shaded grayRemote Procedure Call (2)Implementation IssuesCannot pass pointers–call by reference becomes copy-restore (but might fail)Weakly typed languages–client stub cannot determine sizeNot always possible to determine parameter typesCannot use global variables–may get moved to remote machineRemote Procedure Call (3)Parameters of RPC are marshaled into message in the RPC client processMessage sent and local RPC process waitsRemote machine receives RPC message, spawns remote process that will execute the remote computation on behave of the user clientRemote process assumes same protection domain as local processMore RPC (4)Remote process assembles parameters and makes procedure callRemote process marshals return parameters into messageMessage sent and remote process diesLocal process resumes and unpacks resultRPC Semantics (5)at most onceat least onceonceidempotentApplication of RPCTCPNetworkTCPDiskDisplayThin Client Machine Server MachineRPC ClientProcessRPC ServerProcessUser I/OProcessIPC12345910111213678Client Stub Server StubApplication of RPC (Distributed File System)Transfer Models(a) upload/download model(b) remote access model(a)(b)Performance Issues when Exchanging Messages between Clients and ServersSynchronous or asynchronousLoss, Timeouts, Acknowledgments, Sequence numbersCongestionSynchronous or AsynchronousSynchronous–Process waits for message – Rendezvous–Process waits for message to be receivedAsynchronous–Pool of messages with query mechanism to retrieve a message–Processes send messages without delay–Processes receive messages from poolLossTimeouts–Try again after some time limit–Heart Beat or Keep AliveAcknowledgments–Reply after message–Lost acknowledgementsSequence numbers–Losses become knownNamingAuthentication–Who is the message from?–Who gets the message?Ports–Send to a Port ID – any server process can receive. Process IDs – only one process receivesOther Performance IssuesHow many times is a message copied before its delivered?Loss of cache by receiving messageWait time for synchronous/asynchronous messagesSearch time for asynchronous messagesHow do network functions impact message passing/exchange–Network Model –
View Full Document