Computer Science 425 Distributed SystemsRemote and Local Method InvocationsProxy and Skeleton in Remote Method InvocationRemote Procedure Call (RPC)Client and Server Stub Procedures in RPCStubsThe Stub Generation ProcessFiles Interface in Sun XDRFinding RPCsDealing Room SystemArchitecture for Distributed Event NotificationSlide 12Example TransactionTransactionTransaction Failure ModesProperties of Transactions (ACID)Bank Server: Coordinator InterfaceBank Server: Account, Branch interfacesConcurrent Transactions:Lost Update ProblemConc. Trans.: Inconsistent Retrieval Prob.Concurrency Control: “Serial Equivalence”Conflicting OperationsBefore you go… 2002, M. T. Harandi and J. Hou (modified: I. Gupta) Lecture 15-1Lecture 15-1Computer Science 425Distributed SystemsComputer Science 425Distributed SystemsLecture 15Inter-process Communication & Distributed Objects (II)Sections 4.3-4.4, Chapter 5, Sections 13.1-13.3 2002, M. T. Harandi and J. Hou (modified: I. Gupta) Lecture 15-2Lecture 15-2Remote and Local Method InvocationsRemote and Local Method Invocationsinvocation invocationremoteinvocationremotelocallocallocalinvocationinvocationABCDEFLocal invocations have exactly once semanticsIdeally want similar semantics for remote invocationsProcessObjectProcessProcess 2002, M. T. Harandi and J. Hou (modified: I. Gupta) Lecture 15-3Lecture 15-3Proxy and Skeleton in Remote Method InvocationProxy and Skeleton in Remote Method Invocationobject Aobject BskeletonRequestproxy for BReplyCommunicationRemote Remote referenceCommunication module modulereference module modulefor B’s class& dispatcherremoteclient serverProcess P1Process P2Architecture attempts to ensure transparency when possible 2002, M. T. Harandi and J. Hou (modified: I. Gupta) Lecture 15-4Lecture 15-4Remote Procedure Call (RPC) Remote Procedure Call (RPC) Uniform, reusable, user-friendly, and action based. Provide a familiar interface for the application developer Implements the request-reply primitive Format of the message is standard Supports code reuse Client process calls for invocation of a procedure at the server process. Semantics are similar to RMIs – at least once, at most once, maybe Standard interface, independent of applications A library of reusable procedures, distributed over all sites. 2002, M. T. Harandi and J. Hou (modified: I. Gupta) Lecture 15-5Lecture 15-5Client and Server Stub Procedures in RPCClient and Server Stub Procedures in RPCclient procedureRequestReplyCommunicationCommunication module moduledispatcherservice client stub server stubprocedureprocedureclient process server process procedure 2002, M. T. Harandi and J. Hou (modified: I. Gupta) Lecture 15-6Lecture 15-6Stubs Stubs Stubs are generated automatically from interface specifications. Stubs hide details of (un)marshalling from application programmer & library code developer. Client Stubs perform marshalling into request messages and unmarshalling from reply messages Server Stubs perform unmarshalling from request messages and marshalling into reply messages Stubs also take care of communication & invocation 2002, M. T. Harandi and J. Hou (modified: I. Gupta) Lecture 15-7Lecture 15-7The Stub Generation Process The Stub Generation Process Interface SpecificationStub GeneratorServerStubCommonHeaderClient StubClientSource RPCLIBRARYServerSource Compiler / LinkerRPCLIBRARYClientProgram ServerProgramCompiler / Linkere.g., SUN XDRe.g., rpcgengcc.o, .exe.o, .exe.c.c.c.c.hgcc 2002, M. T. Harandi and J. Hou (modified: I. Gupta) Lecture 15-8Lecture 15-8Files Interface in Sun XDRFiles Interface in Sun XDRconst MAX = 1000;typedef int FileIdentifier;typedef int FilePointer;typedef int Length;struct Data {int length;char buffer[MAX];};struct writeargs {FileIdentifier f;FilePointer position;Data data;};struct readargs {FileIdentifier f;FilePointer position;Length length;};program FILEREADWRITE { version VERSION {void WRITE(writeargs)=1; 1Data READ(readargs)=2; 2 }=2;} = 9999;Program numberVersion numberOnly one argument allowedCan specify as structAvailable with most Sun systems, and NFS 2002, M. T. Harandi and J. Hou (modified: I. Gupta) Lecture 15-9Lecture 15-9 Finding RPCs Finding RPCs ClientProgram ServerprocedureServerStubClient StubComm. ModuleComm. ModuleDispatcherSERVERCLIENTFinding An RPC:RPCs live on specific hosts at specific ports.Port mapper on the host maps from RPC name to port#When a server process is initialized, it registers its RPCs (handle) with the port mapper A client first connects to port mapper (daemon on standard port) to get this handleThe call to RPC is then made by connecting to the corresponding port 2002, M. T. Harandi and J. Hou (modified: I. Gupta) Lecture 15-10Lecture 15-10Dealing Room SystemDealing Room SystemDealer’s computerInformationproviderDealerExternalsourceExternalsourceInformationproviderDealerDealerDealerNotificationNotificationNotificationNotificationNotificationNotificationNotificationNotificationDealer’s computerDealer’s computerDealer’s computerNotificationNotificationAt each dealer:One object per named stock[Publish-Subscribe System] e.g, stock market 2002, M. T. Harandi and J. Hou (modified: I. Gupta) Lecture 15-11Lecture 15-11Architecture for Distributed Event NotificationArchitecture for Distributed Event Notificationsubscriberobserverobject of interestEvent serviceobject of interestobject of interest observersubscribersubscriber3.1.2.notificationnotificationnotificationnotification 2002, M. T. Harandi and J. Hou (modified: I. Gupta) Lecture 15-12Lecture 15-12Computer Science 425Distributed SystemsComputer Science 425Distributed SystemsTransaction Processing 2002, M. T. Harandi and J. Hou (modified: I. Gupta) Lecture 15-13Lecture 15-13Banking transaction for a customer (ATM)Transfer $100 from saving to checking account;Transfer $200 from money-market to checking account;Withdraw $400 from checking account.Transaction:1. savings.deduct(100) /* includes verification */2. checking.add(100) /* depends on success of 1 */3. mnymkt.deduct(200) /* includes verification */4. checking.add(200) /* depends on success of 3 */5. checking.deduct(400) /* includes verification */6. dispense(400)7. commit Example TransactionExample TransactionClientServerTransaction 2002, M. T. Harandi and J. Hou (modified: I. Gupta) Lecture 15-14Lecture 15-14Transaction Transaction Sequence of
View Full Document