JOEL CRICHLOW DISTRIBUTED SYSTEMS: COMPUTING OVER NETWORKS, PHI LEARNING SOFTWARE ARCHITECTURE FOR...
-
date post
20-Dec-2015 -
Category
Documents
-
view
214 -
download
0
Transcript of JOEL CRICHLOW DISTRIBUTED SYSTEMS: COMPUTING OVER NETWORKS, PHI LEARNING SOFTWARE ARCHITECTURE FOR...
J O E L C R I C H L O WD I S T R I B U T E D S Y S T E M S : C O M P U T I N G O V E R N E T W O R K S , P H I L E A R N I N G
SOFTWARE ARCHITECTURE FOR DISTRIBUTED SYSTEMS
SOFTWARE ARCHITECTURE
• Cooperating Processes• Process Groups• Client-Server• Peer-to-Peer• Component Models• Components and Frameworks• Web Services
COOPERATING PROCESSES
• Cooperating processes can be regarded as procedures or tasks in a distributed application• The processes must be identified and registered,
and communication among them facilitated and regulated• Programming languages and tools are available
for implementing distributed systems as cooperating processes
task CHARACTERBUFFER isentry WRITE (CHAR: in CHARACTER);entry READ (CHAR: out CHARACTER);
end CHARACTERBUFFERtask body CHARACTERBUFFER is
CHARBUFFER: CHARACTER;begin
loopaccept WRITE (CHAR: in CHARACTER) do
CHARBUFFER := CHAR;end WRITE;accept READ (CHAR: out CHARACTER) do
CHAR := CHARBUFFER;end READ;exit when CHARBUFFER = ASCII.EOF
end loopend CHARACTERBUFFER;task PRODUCER;task body PRODUCER is
PROCHAR: CHARACTER:begin
loop….. produce PROCHARCHARACTERBUFFER.WRITE (PROCHAR);
end loop;end PRODUCER;task CONSUMER;task body CONSUMER is
CONCHAR: CHARACTER;begin
loopCHARACTERBUFFER.READ (CONCHAR);….. process CONCHAR
end loop end CONSUMER;
CSP AND OCCAM
• CSP is a parallel language that permits the specification of programs particularly (but not exclusively) for Multiple Instruction Multiple Data (MIMD) machines and computer networks
• Occam is a commercial descendant of CSP• It was designed to market the CSP primitives and
structures as an effective tool for programming on transputers.
• The transputer is a microcomputer fitted with four bidirectional communication links facilitating connection to another transputer or some other device
CSP AND OCCAM
• In CSP (and Occam), the word ‘process’ refers to a number of sequential commands • Commands may be simple or structured• A parallel command specifies a number of
processes that are to be executed in parallel• All the processes start simultaneously and the
parallel command terminates successfully only if and when all the processes have successfully terminated
CSP AND OCCAM
• Communication between concurrently executing processes in CSP is through input and output commands
• Three conditions must hold before communication can take place between two processes
• If process A wants to send output to process B, then• an input command in B must specify that A is the source of the
input• an output command in A must specify that B is the destination of
the output• the target variable specified for the receipt of input must match
that specified by the output command.
• When these conditions are satisfied, the input and output commands are said to correspond and they are executed simultaneously
CSP AND OCCAM
• For example, let there be two processes ‘receiver’ and ‘sender’ defined as:• receiver:: sender ?(x, y)• sender:: receiver !(a + b, c*3)
• The process ‘receiver’ has the input command denoted by ‘?’• The process ‘sender’ has the output command ‘!’
CSP AND OCCAM
• When process ‘receiver’ issues its input command and process ‘sender’ its output command, they will be executed simultaneously to produce the effect • x := a + b• y := c*3
receiver input from
output to
senderreceiver
x y a+b c*3
sender
CSP AND OCCAM
• Parallel processes in Occam communicate indirectly through channels
• A channel is a one-way link between two processes• Channels are named and typed, and their names can be
passed as parameters. For example:
• channel ? variable• Indicates that a value from the channel is to be input into the variable
• channel ! expression• Indicates that the value of the expression is to be output on channel
• A notable implementation of CSP is JCSP, see http://wotug.org
PROCESS GROUPS
• Messages must be delivered to all the processes• Activities of the processes must be synchronized• Group Membership• List• Join• Leave
PROCESS GROUPS – MESSAGE DELIVERY
• Broadcast• Multicast• Atomic Broadcast/Multicast• Message Ordering• Totally ordered• Causally ordered
CLIENT-SERVER
• Some important issues in client–server design• How do clients and server communicate?• What guarantees are provided for secure data
storage and handling?• How should faults and failures be handled?
CLIENT-SERVER COMMUNICATION
• The communication structures RPC or RMI and/or message passing often form the software communication subsystem for client–server interaction.• Protocol superstructures are built upon the basic
communication subsystem• The Three-Message Protocol• The Single-Shot Protocol
PEER-TO-PEER
• A peer-to-peer (P2P) distributed system comprises symmetrical interacting processing nodes• The P2P communicating model can be any of
those specified in the previous sections• Computing nodes can have the dual roles of
server and client
COMPONENT MODELS
• Procedure-Oriented• Object-Oriented• CORBA (Common Object Request Broker
Architecture)• OMG• ORB• IDL• IIOP
CORBA
• Cliient Server exchange is facilitated through the Interface Definition Language (IDL)• For example, if a server maintains a Transaction object and TransQueue object of
Transactions, these can be specified for client use in the following IDL statements:
interface Transaction {attribute string id;attribute string type;attribute string data;};
interface TransQueue {readonly attribute string name;boolean IsEmpty();void Append(in Transaction t);Transaction Remove();Transaction FirstTrans();Transaction NextTrans(in Transaction t);};
CORBA
• The IDL interface will be mapped onto a target language• Clients can access the operations in these objects via the
interface by first uniquely identifying (or first binding to) the object, and then specifying the target operation. For example:
Qref = TransQueue._bind(object name: server name, host)
allows the object Qref at the client to access the operations of TransQueue at the specified server
If the binding is successful, then the reference Qref.FirstTrans() is a valid invocation of the FirstTrans operation on the remote TransQueue
CORBA client client
Object Request Broker - ORB
Server (objects)
client client
server
client client
server
ORB A ORB B IIOP
COMPONENTS AND FRAMEWORKS
• The integration of reusable components into a distributed system• A component must declare itself to the outside
world before it can be used• A framework is a reusable ‘semi-complete’
application
COMPONENTS AND FRAMEWORKS
• A component can be viewed as having state and behavior• State is referred to as ‘attribute’ or ‘property’ and behavior
as ‘method’• Properties and methods are declared in the interface to
facilitate interactions• The ‘event’ is another item in a component’s interface • Events in a component’s interface are associated with
activities within a component that might be of interest to the outside world
• If an application or another component is interested in that event, then it must subscribe to it
• Whenever the event fires (occurs) all interested are dynamically notified
COMPONENTS AND FRAMEWORKS
• Components – some tools• JavaBeans• Enterprise JavaBeans (EJB)• Microsoft COM, DCOM, .NET Remoting• ActiveX• Internet Communications Engine (ICE)
• Frameworks• Adaptive Communication Environment (ACE)
WEB SERVICES
• Interoperability among Web applications• Service-Oriented Architecture (SOA)• Web Services: the software technologies that
facilitate interoperation among and integration of Web applications
WEB SERVICES
client client
Web Services: XML, WSDL, UDDI, SOAP, etc.
Web application
client
Web application
WEB SERVICES
• An alternative approach to building a web service is to use the REST (Representational State Transfer) method introduced by Roy Fielding in 2000
• In a REST-style (usually termed RESTful) system• Each resource is uniquely identified• There exists a uniform interface for accessing resources• Every access to a resource is conveyed as a representation of its
state
• In the web context• The URI (Uniform Resource Identifier) provides resource
identification• The HTTP operations POST, GET, PUT and DELETE provide a
uniform interface• XML facilitates the representation of state
WEB SERVICES
• In RESTful client-server interactions the client can:• Request the creation of a resource matching a given
representation• Obtain a representation of the current state of the
resource• Create a representation of a new state for a current
resource and send that to the server• Request that a resource be deleted
• The client-server communication is stateless
WEB SERVICES
• The client-server communication is adequately supported by XML and HTTP• A RESTful web service uses:• HTTP POST to create a resource• HTTP GET to retrieve a resource• HTTP PUT to update a resource• HTTP DELETE to delete a resource
• A REST web service can be constructed using XML and HTTP without the need for additional message exchange functionality such as is provided by SOAP