Presentation is loading. Please wait.

Presentation is loading. Please wait.

U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts Amherst Operating Systems CMPSCI 377 Lecture.

Similar presentations


Presentation on theme: "U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts Amherst Operating Systems CMPSCI 377 Lecture."— Presentation transcript:

1 U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts Amherst Operating Systems CMPSCI 377 Lecture 20: Distributed Systems (RPC)

2 U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 2 Today Key challenges to distribution in operating systems Resource sharing Timing (synchronization) Critical sections Deadlock detection & recovery Failure recovery

3 U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 3 Computation vs. Communication Communication fast & cheap ) can utilize all resources in distributed environment Communication slow & expensive ) do most processing locally Reality: somewhere in the middle Where are the tradeoffs?

4 U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 4 Resource Sharing Data migration: move data Computation migration: move computation to data Job migration: move job (computation & data) Fundamental tradeoff: speed vs. cost

5 U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 5 Data Migration: Copying Process at site A accesses file at site B = copy file B to process A Costly if file is large Data format conversion Multiple copies ) consistency problems All subsequent accesses at A are local

6 U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 6 Data Migration: Remote Access Keep file at B, access remotely from A Saves file transfer cost Converting may be difficult in pieces Single copy of file = no consistency problems Performance bottleneck

7 U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 7 Computation Migration More efficient to transfer computation than data Example: database query Motivates remote procedure calls (RPC) A sends message to process at B Process performs requested action Sends result back to A

8 U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 8 Job Migration May be required: Job needs hardware somewhere in system Job requires licensed software Can improve performance: Load balancing: Even workload across distributed system Computational speedup: Concurrent (parallel) execution of parts of job

9 U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 9 Client/Server Model Common structure for distributed computation Server: process/processes providing service Name servers, file servers, database server May exist on more than one node Client uses service Binds to server locates on network, establishes connection Request-response interaction May use RPC

10 U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 10 Remote Procedure Call Servers export procedures for clients to call Client does procedure call to use server OS manages communication

11 U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 11 RPC Implementation Issues For each procedure for which we want to support RPC: RPC mechanism uses procedure signature (number & type of args & return value) Generates client stub: bundles RPC arguments, sends to server Generates server stub: unpacks message, invokes procedure call

12 U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 12 RPC: Implementation Issues client stub: build message send message await response unpack reply return result server stub: create threads loop await command unpack message call proc. w/thread build reply send reply

13 U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 13 RPC Binding How does client know right port? Binding may be static (fixed at compile-time) Or dynamic (fixed at run-time) Most RPC systems: dynamic binding via name service Server exports interface, identifies itself to net Client asks name service for location of server, establishes connection

14 U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 14 Example: Java RMI public static void bind(String name, Remote obj) Binds server to name public static Remote lookup(String name) Returns server object corresponding to name UnicastRemoteObject supports references to non-replicated objects using TCP Exports interface automatically when server object is constructed Tools: rmiregistry server-side name server rmic : given server interface, generates client & server stubs that create & interpret packets

15 U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 15 Example: Server in Java Server Defines interface listing method signatures Implements each method in interface Main: Creates one or more server objects (subclasses of RemoteObject ) Registers objects with remote object registry Client Looks up server in remote object registry Uses normal method call syntax for remote methods Handles RemoteException

16 U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 16 Example: Hello World Server (1/3)

17 U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 17 Example: Hello World Server (2/3)

18 U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 18 Example: Hello World Server (3/3)

19 U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 19 Example: Hello World Client

20 U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 20 Example: Hello World Client

21 U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 21 Summary Data, computation, job migration Client-server model Mechanism: RPC Common model for communication in distributed apps Effectively: language support for distribution Relies on stub compiler Used even on single nodes for communication across address spaces

22 U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 22 Next Time Distributed File Systems


Download ppt "U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts Amherst Operating Systems CMPSCI 377 Lecture."

Similar presentations


Ads by Google