Top Banner
Mark Stanovich Operating Systems COP 4610
12

Mark Stanovich Operating Systems COP 4610. Primitives to Build Distributed Applications send and receive Used to synchronize cooperating processes running.

Jan 18, 2016

Download

Documents

Emmeline Terry
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Mark Stanovich Operating Systems COP 4610. Primitives to Build Distributed Applications send and receive Used to synchronize cooperating processes running.

Mark StanovichOperating Systems

COP 4610

Page 2: Mark Stanovich Operating Systems COP 4610. Primitives to Build Distributed Applications send and receive Used to synchronize cooperating processes running.

Primitives to Build Distributed Applicationssend and receive

Used to synchronize cooperating processes running on different machines

Communicate through mailboxes (ports) Temporary holding areas for messages

Atomic operations send/receive the entire message or nothing

Page 3: Mark Stanovich Operating Systems COP 4610. Primitives to Build Distributed Applications send and receive Used to synchronize cooperating processes running.

More on send and receiveTo put a message to the network

send(message, destination_mbox)receive(buffer, mbox)

Waits until a message arrives Copies the message into a given buffer

Page 4: Mark Stanovich Operating Systems COP 4610. Primitives to Build Distributed Applications send and receive Used to synchronize cooperating processes running.

Remote Procedure Call (RPC)Allows you to invoke a procedure on either a

local or remote machineClient

RemoteMachineSay(“Meow”);Server

MachineSay(“Meow”);

Implemented on top of two-way messaging

Page 5: Mark Stanovich Operating Systems COP 4610. Primitives to Build Distributed Applications send and receive Used to synchronize cooperating processes running.

RPC IllustratedServer (callee)Client (caller)

OS or Network

Server stubClient stub

call reply callreply

Page 6: Mark Stanovich Operating Systems COP 4610. Primitives to Build Distributed Applications send and receive Used to synchronize cooperating processes running.

Procedure StubsProvide the invocation interface

programmerse.g. foo(int a)

Client stubBuild messages (a.k.a. marshalling)Send messagesWait for responseUnpack replyReturn result

Page 7: Mark Stanovich Operating Systems COP 4610. Primitives to Build Distributed Applications send and receive Used to synchronize cooperating processes running.

Server StubCreate N threads to wait for requestsLoop

Wait for commandDecode and unpack request parameters

(unmarshalling)Call procedureBuild replay message with resultsSend reply

Page 8: Mark Stanovich Operating Systems COP 4610. Primitives to Build Distributed Applications send and receive Used to synchronize cooperating processes running.

RPC vs. Procedure CallFrom the programmer’s viewpoint

Similar semanticsPointers are instantiated before transmission

Data structures pointed by the pointer are copied

Processes running on the remote machine is in a different address space

Page 9: Mark Stanovich Operating Systems COP 4610. Primitives to Build Distributed Applications send and receive Used to synchronize cooperating processes running.

Implementation IssuesStubs are automatically generatedNeed to have a well-known port to talk to

serversServer can upgrade the implementation

without recompiling client applications

Page 10: Mark Stanovich Operating Systems COP 4610. Primitives to Build Distributed Applications send and receive Used to synchronize cooperating processes running.

Interprocess CommunicationRPC is just another way to communicate

between processesExample uses

Microkernel operating systems Portions of an OS are implemented at the user level

to minimize the kernel-level codeObject linking and embedding (OLE)

Mix-and-match applications

Page 11: Mark Stanovich Operating Systems COP 4610. Primitives to Build Distributed Applications send and receive Used to synchronize cooperating processes running.

Using RPC for IPC+ Fault isolation: bugs are unlikely to

propagate across different address spaces+ Modularity: independent component

upgrades+ Location transparency: a service can be

provided from local or remote machines

Page 12: Mark Stanovich Operating Systems COP 4610. Primitives to Build Distributed Applications send and receive Used to synchronize cooperating processes running.

Using RPC for IPC- Poor performance- Increased number of failure modes

Network failure Machine failure

- More outcomes for procedure execution No execution Partial execution ...