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.
What is a Distributed System?What is a Distributed System?
A distributed systemA distributed system is a collection of is a collection of autonomous autonomous hostshosts that that are connected that that are connected through a computer through a computer networknetwork. Each host . Each host executes executes componentscomponents and operates a and operates a distribution distribution middlewaremiddleware, which enables , which enables the components to coordinate their the components to coordinate their activities in such a way that users activities in such a way that users perceive the system as a single, perceive the system as a single, integrated computing facility.integrated computing facility.
Abstraction from network Abstraction from network protocolsprotocols
Network protocols do not provide right Network protocols do not provide right abstractions for building distributed systems:abstractions for building distributed systems:
Packet forwarding vs. procedure callPacket forwarding vs. procedure call Mapping of request parameters to byte streamsMapping of request parameters to byte streams Resolution of data heterogeneityResolution of data heterogeneity Identification of componentsIdentification of components Implementation of component activationImplementation of component activation Type safetyType safety Synchronization of interaction between Synchronization of interaction between
distributed componentsdistributed components Quality of service guaranteesQuality of service guarantees
Enable procedure calls across host Enable procedure calls across host boundariesboundaries
Call interfaces are defined using an Call interfaces are defined using an Interface Definition Language (IDL)Interface Definition Language (IDL)
RPC compiler generates presentation and RPC compiler generates presentation and session layer implementation from IDLsession layer implementation from IDL
Resolve data heterogeneityResolve data heterogeneity Common data representationCommon data representation Transmission of data declarationTransmission of data declaration
Map complex data structures to network Map complex data structures to network transport transport Static marshalling/unmarshallingStatic marshalling/unmarshalling Dynamic marshalling/unmarshallingDynamic marshalling/unmarshalling
Creating code for marshalling and Creating code for marshalling and unmarshalling is tedious and error-prone.unmarshalling is tedious and error-prone.
Code can be generated fully automatically Code can be generated fully automatically from interface definition.from interface definition.
Code is embedded in stubs for client and Code is embedded in stubs for client and server.server.
Client stub represents server for client, Client stub represents server for client, Server stub represents client for serve.Server stub represents client for serve.
Stubs achieve type safety.Stubs achieve type safety. Stubs also perform synchronization.Stubs also perform synchronization.
How can we make sure that How can we make sure that servers are able to perform operations servers are able to perform operations
requested by clients?requested by clients? actual parameters provided by clients match actual parameters provided by clients match
the expected parameters of the server?the expected parameters of the server? results provided by the server match the results provided by the server match the
expectations of client?expectations of client? Middleware acts as mediator between Middleware acts as mediator between
client and server to ensure type safety.client and server to ensure type safety. Achieved by interface definition in an Achieved by interface definition in an
What should client do while server executesWhat should client do while server executes Wait?Wait? Not care?Not care? Proceed concurrently and re-synchronise later?Proceed concurrently and re-synchronise later?
What should server do if clients request What should server do if clients request operations concurrentlyoperations concurrently Process them sequentially?Process them sequentially? Process them concurrently?Process them concurrently?
Each of these reasonableEach of these reasonable Most supported by middleware primitivesMost supported by middleware primitives
Multiple client objects can request operations Multiple client objects can request operations from servers concurrentlyfrom servers concurrently
What to do?What to do? Options:Options:
Queue requests and process them sequentiallyQueue requests and process them sequentially Start new concurrent threads for every requestStart new concurrent threads for every request Use a thread-pool and assign a thread to each new Use a thread-pool and assign a thread to each new
requestrequest To relieve programmer of server object:To relieve programmer of server object: Server-side threading implemented in object Server-side threading implemented in object
adaptersadapters POA in CORBAPOA in CORBA SCM in COMSCM in COM EJB Container in J2EEEJB Container in J2EE
Single-threaded:Single-threaded: Use when object implementations are not thread Use when object implementations are not thread
safesafe Default threading policy in CORBADefault threading policy in CORBA
ORB-controlled:ORB-controlled: Threads to execute object implementations are Threads to execute object implementations are
started, managed and stopped by the ORBstarted, managed and stopped by the ORB Programmer has to be aware that Programmer has to be aware that
implementations will be called concurrently and implementations will be called concurrently and make them thread safe (e.g. for stateful objects)make them thread safe (e.g. for stateful objects)
Unspecified how ORB implements thread Unspecified how ORB implements thread management.management.
Synchronous (Rendevous): Client-blocked until Synchronous (Rendevous): Client-blocked until server finished execution of requested server finished execution of requested operationoperation
Oneway: Client continues after request taken Oneway: Client continues after request taken by middleware, no synchronisation happens at by middleware, no synchronisation happens at allall
Deferred synchronous: Client continues after Deferred synchronous: Client continues after request taken by middleware, client polls for request taken by middleware, client polls for resultresult
Asynchronous: Client continues after request Asynchronous: Client continues after request taken by middleware and server informs about taken by middleware and server informs about the resultthe result
Return control to client as soon as request Return control to client as soon as request has been taken by middlewarehas been taken by middleware
Client and server are not synchronizedClient and server are not synchronized Use ifUse if
Server does not produce a resultServer does not produce a result Failures of operation can be ignored by client Failures of operation can be ignored by client
Oneway using Java ThreadsOneway using Java Threadsclass PrintSquad {class PrintSquad { static void main(String[] args) {static void main(String[] args) { Team team;Team team; Date date;Date date; // initializations of team and date omitted ...// initializations of team and date omitted ... OnewayReqPrintSquad a=new OnewayReqPrintSquad(team,date);OnewayReqPrintSquad a=new OnewayReqPrintSquad(team,date); a.start();a.start(); // continue to do work while request thread is blocked...// continue to do work while request thread is blocked... }}}}
// thread that invokes remote method// thread that invokes remote methodclass OnewayReqPrintSquad extends Thread {class OnewayReqPrintSquad extends Thread { Team team;Team team; Date date;Date date; OnewayReqPrintSquad(Team t, Date d) {OnewayReqPrintSquad(Team t, Date d) { team=t; date=d;team=t; date=d; }} public void run() {public void run() { team.print(date); team.print(date); // call remote method and then die// call remote method and then die }}}}
Declared statically in the interface Declared statically in the interface definition of the server objectdefinition of the server object
IDL compiler validates thatIDL compiler validates that operation has a void return typeoperation has a void return type does not have any out or inout parametersdoes not have any out or inout parameters does not raise type specific exceptionsdoes not raise type specific exceptions
Return control to client as soon as request Return control to client as soon as request has been taken by middlewarehas been taken by middleware
Client initiates synchronizationClient initiates synchronization Use ifUse if
Requests take long timeRequests take long time Client should not be blockedClient should not be blocked Clients can bear overhead of synchronizationClients can bear overhead of synchronization
Determined at run-time with using DIIDetermined at run-time with using DII By invoking By invoking send()send() from a from a RequestRequest object object And using And using get_response()get_response() to obtain result to obtain result
Return control to client as soon as request Return control to client as soon as request has been taken by middlewarehas been taken by middleware
Server initiates synchronizationServer initiates synchronization Use ifUse if
Requests take long timeRequests take long time Client should not be blockedClient should not be blocked Server can bear overhead of synchronizationServer can bear overhead of synchronization
Asynchronous Requests with Asynchronous Requests with ThreadsThreads
Client has interface for callbackClient has interface for callback Perform request in a newly created threadPerform request in a newly created thread Client continues in main threadClient continues in main thread New thread is blockedNew thread is blocked Requested operation invokes callback to Requested operation invokes callback to
pass resultpass result New thread dies when request is completeNew thread dies when request is complete
Asynchronous Requests using Asynchronous Requests using Message PassingMessage Passing
Message passing is starting to be provided Message passing is starting to be provided by object- and component-oriented by object- and component-oriented middlewaremiddleware Microsoft Message QueueMicrosoft Message Queue CORBA Notification ServiceCORBA Notification Service Java Messaging ServiceJava Messaging Service
Request and reply explicitly as messages Request and reply explicitly as messages Asynchronous requests can be achieved Asynchronous requests can be achieved
Distributed SystemsDistributed Systems MiddlewareMiddleware Advanced Communication in Object and Advanced Communication in Object and
Component MiddlewareComponent Middleware Design Problems for Distributed Objects Design Problems for Distributed Objects
and Componentsand Components Design Validation using Model CheckingDesign Validation using Model Checking Related WorkRelated Work ConclusionsConclusions
Client and server objects execute Client and server objects execute concurrently (or even in parallel when concurrently (or even in parallel when residing on different machines)residing on different machines)
This concurrency gives raise to the usual This concurrency gives raise to the usual problems:problems: DeadlocksDeadlocks Safety Property violationsSafety Property violations LivenessLiveness
Notifications of new Notifications of new price are sent only in price are sent only in response to trade response to trade updateupdate
Only traders that have Only traders that have subscribed for subscribed for notifications will notifications will receive themreceive them
Equity server cannot Equity server cannot accept new trade accept new trade unless notification of unless notification of previous trade is previous trade is completecomplete
It is always the case It is always the case that the EquityServer that the EquityServer will eventually be able will eventually be able to accept a tradeto accept a trade
Traders will always be Traders will always be able to eventually able to eventually enter a new tradeenter a new trade
Exploit the fact that object and Exploit the fact that object and component middleware provide only few component middleware provide only few primitives for synchronization of primitives for synchronization of distributed objectsdistributed objects
Representation of these primitives as Representation of these primitives as stereotypes in UML modelsstereotypes in UML models
Formal specification of stereotype Formal specification of stereotype semanticssemantics
Model checking of UML models against Model checking of UML models against given safety and liveness propertiesgiven safety and liveness properties
Inverardi et al. 2001. Automated Checking Inverardi et al. 2001. Automated Checking of Architectural Models using SPIN, ASE of Architectural Models using SPIN, ASE 2001.2001.
McUmber & Cheung, 2001. A general McUmber & Cheung, 2001. A general Framework for formalizing UML with Framework for formalizing UML with Formal Languages. ICSE 2001.Formal Languages. ICSE 2001.
Detect synchronisation problems in oo-Detect synchronisation problems in oo-middleware systems at designmiddleware systems at design
Define semantics for client/server Define semantics for client/server communication primitives communication primitives
Use model checking to detect potential Use model checking to detect potential execution traces that leading to property execution traces that leading to property violationsviolations
Confine designers to a pure UML Confine designers to a pure UML interaction onlyinteraction only
Introduce no new notationsIntroduce no new notations
Investigate heuristic approaches such as Investigate heuristic approaches such as pattern detection in the UML design pattern detection in the UML design diagramsdiagrams
Carry out an industrial case study to Carry out an industrial case study to analyse the scalability and feasibility of analyse the scalability and feasibility of our approachour approach
Provide semantic mapping to the Promela Provide semantic mapping to the Promela (SPIN), to demonstrate the general (SPIN), to demonstrate the general applicability of our conceptsapplicability of our concepts