1 / 22

Operating Systems CMPSCI 377 Lecture 20: Distributed Systems (RPC)

Operating Systems CMPSCI 377 Lecture 20: Distributed Systems (RPC). Emery Berger University of Massachusetts Amherst. Today. Key challenges to distribution in operating systems Resource sharing Timing (synchronization) Critical sections Deadlock detection & recovery Failure recovery.

dorotheat
Download Presentation

Operating Systems CMPSCI 377 Lecture 20: Distributed Systems (RPC)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Operating SystemsCMPSCI 377Lecture 20: Distributed Systems (RPC) Emery Berger University of Massachusetts Amherst

  2. Today • Key challenges to distribution in operating systems • Resource sharing • Timing (synchronization) • Critical sections • Deadlock detection & recovery • Failure recovery

  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. Resource Sharing • Data migration: move data • Computation migration: move computation to data • Job migration: move job (computation & data) • Fundamental tradeoff: speed vs. cost

  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. 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. 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. 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. 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. Remote Procedure Call • Servers export procedures for clients to call • Client does procedure call to use server • OS manages communication

  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. RPC: Implementation Issues client stub:build messagesend messageawait responseunpack replyreturn result server stub:create threadsloop await command unpack message call proc. w/thread build reply send reply

  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. 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. 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. Example: Hello World Server (1/3)

  17. Example: Hello World Server (2/3)

  18. Example: Hello World Server (3/3)

  19. Example: Hello World Client

  20. Example: Hello World Client

  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. Next Time • Distributed File Systems

More Related