2. communication paradigms - ejb tutorial · communication paradigms remote invocation remote...

28
Imed Bouchrika. Distributed Objects , Uni of Souk-Ahras 2014-2015 http://www.imed.ws 2. Communication Paradigms Master II Software Engineering Imed Bouchrika Dept of Mathematics & Computer Science University of Souk-Ahras [email protected]

Upload: others

Post on 23-May-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 2. Communication Paradigms - EJB Tutorial · Communication Paradigms Remote Invocation Remote Procedure Call ( RPC ) Is a way of communication in which a computer program can invoke

Imed Bouchrika. Distributed Objects , Uni of Souk-Ahras 2014-2015 http://www.imed.ws

2. Communication Paradigms

Master II – Software Engineering

Imed BouchrikaDept of Mathematics & Computer Science

University of Souk-Ahras

[email protected]

Page 2: 2. Communication Paradigms - EJB Tutorial · Communication Paradigms Remote Invocation Remote Procedure Call ( RPC ) Is a way of communication in which a computer program can invoke

Imed Bouchrika. Distributed Objects, Uni of Souk-Ahras 2014-2015 http://www.imed.ws

Distributed System DefinitionTanenbaum defines a distributed system as:

“a collection of independent computers that

appear to the users of the system as a single

computer”

independent : This means that, architecturally, the

machines are capable of operating independently.

single computer : The second point is that the software

enables this set of connected machines to appear as a

single computer to the users of the system.

2

Page 3: 2. Communication Paradigms - EJB Tutorial · Communication Paradigms Remote Invocation Remote Procedure Call ( RPC ) Is a way of communication in which a computer program can invoke

Imed Bouchrika. Distributed Objects, Uni of Souk-Ahras 2014-2015 http://www.imed.ws

Distributed System :The figure below shows a simple distributed systems for a number of

applications running through different operating system

The middleware takes responsibility for the heterogeneity of the

communications.

3

Page 4: 2. Communication Paradigms - EJB Tutorial · Communication Paradigms Remote Invocation Remote Procedure Call ( RPC ) Is a way of communication in which a computer program can invoke

Imed Bouchrika. Distributed Objects, Uni of Souk-Ahras 2014-2015 http://www.imed.ws

Communication

Communication :

is the activity of conveying or sending information through

the exchange of ideas, commands or ... as by speech, non-

verbal gestures, writings ,,, between two or more

participants

4

Page 5: 2. Communication Paradigms - EJB Tutorial · Communication Paradigms Remote Invocation Remote Procedure Call ( RPC ) Is a way of communication in which a computer program can invoke

Imed Bouchrika. Distributed Objects, Uni of Souk-Ahras 2014-2015 http://www.imed.ws

Few Questions

What are the entities ( Participants ) that are communicating ?

How do these entities communicate, or what Communication

Paradigm is used?

What Roles and responsibilities do these entities have in the overall

architecture?

How are these entities mapped on to the physical distributed

infrastructure (what is their placement)?

5

Page 6: 2. Communication Paradigms - EJB Tutorial · Communication Paradigms Remote Invocation Remote Procedure Call ( RPC ) Is a way of communication in which a computer program can invoke

Imed Bouchrika. Distributed Objects, Uni of Souk-Ahras 2014-2015 http://www.imed.ws

Who : Communication Entities

Processes

an executing instance of a computer program

Threads

“Lightweight Process” running within a process

Distributed Objects

An instance of a class that can be invoked at a distance

Components

A unit of functionality providing a service published through

an interface. Components are housed into a container.

Web Services.

6

Page 7: 2. Communication Paradigms - EJB Tutorial · Communication Paradigms Remote Invocation Remote Procedure Call ( RPC ) Is a way of communication in which a computer program can invoke

Imed Bouchrika. Distributed Objects, Uni of Souk-Ahras 2014-2015 http://www.imed.ws

Communication Entities

Distributed Objects :

Introduced to enable and encourage the use of object-

oriented approaches (OOP) in distributed systems

Decomposition for the given problem domain so that

Computation can be made through a number of interacting

objects.

Objects are accessed via interfaces, with an associated

interface definition language providing a specification of the

methods defined on an object

7

Page 8: 2. Communication Paradigms - EJB Tutorial · Communication Paradigms Remote Invocation Remote Procedure Call ( RPC ) Is a way of communication in which a computer program can invoke

Imed Bouchrika. Distributed Objects, Uni of Souk-Ahras 2014-2015 http://www.imed.ws

Communication Entities

Software Components:

Introduced to enable and encourage the use of object-

oriented approaches in distributed systems

Computation consists of a number of interacting objects

representing natural units of decomposition for the given

problem domain

objects are accessed via interfaces, with an associated

interface definition language providing a specification of the

methods defined on an object

8

Page 9: 2. Communication Paradigms - EJB Tutorial · Communication Paradigms Remote Invocation Remote Procedure Call ( RPC ) Is a way of communication in which a computer program can invoke

Imed Bouchrika. Distributed Objects, Uni of Souk-Ahras 2014-2015 http://www.imed.ws

Communication Entities

Web Services:

Introduced to enable and encourage the use of object-

oriented approaches in distributed systems

Computation consists of a number of interacting objects

representing natural units of decomposition for the given

problem domain

objects are accessed via interfaces, with an associated

interface definition language providing a specification of the

methods defined on an object

9

Page 10: 2. Communication Paradigms - EJB Tutorial · Communication Paradigms Remote Invocation Remote Procedure Call ( RPC ) Is a way of communication in which a computer program can invoke

Imed Bouchrika. Distributed Objects, Uni of Souk-Ahras 2014-2015 http://www.imed.ws

How : Communication Paradigms

Inter-Process communication

Remote Invocation

Indirect Communication

10

Page 11: 2. Communication Paradigms - EJB Tutorial · Communication Paradigms Remote Invocation Remote Procedure Call ( RPC ) Is a way of communication in which a computer program can invoke

Imed Bouchrika. Distributed Objects, Uni of Souk-Ahras 2014-2015 http://www.imed.ws

How : Communication Paradigms

Other Classifications of Paradigms :

Remote procedure call

Message-oriented communication

Stream-oriented communication

Software-based distributed shared memory

11

Page 12: 2. Communication Paradigms - EJB Tutorial · Communication Paradigms Remote Invocation Remote Procedure Call ( RPC ) Is a way of communication in which a computer program can invoke

Imed Bouchrika. Distributed Objects, Uni of Souk-Ahras 2014-2015 http://www.imed.ws

Communication Paradigms

Inter-Process communication

Communication between processes is based on low-level

support provided by the OS in the distributed system

including:File

Sockets

Piping

Signals

Shared Memory

....12

Page 13: 2. Communication Paradigms - EJB Tutorial · Communication Paradigms Remote Invocation Remote Procedure Call ( RPC ) Is a way of communication in which a computer program can invoke

Imed Bouchrika. Distributed Objects, Uni of Souk-Ahras 2014-2015 http://www.imed.ws

Communication Paradigms

Remote Invocation

Remote Procedure Call ( RPC )

Is a way of communication in which a computer program

can invoke a subroutine or function

To execute on a remote machine and returns the results

to the invoker if any.

The programmer usually write the same code as for the

local case

whilst all the complexity is hidden and managed by the

middleware

13

Page 14: 2. Communication Paradigms - EJB Tutorial · Communication Paradigms Remote Invocation Remote Procedure Call ( RPC ) Is a way of communication in which a computer program can invoke

Imed Bouchrika. Distributed Objects, Uni of Souk-Ahras 2014-2015 http://www.imed.ws

Communication Paradigms

indirect communication

This is through a third entity, allowing a strong degree of

decoupling between senders and receivers, in particular:

Space decoupling : senders do not need to know who they are

sending to

Time Decoupling : senders and receivers do not need to exist

at the same time

14

Page 15: 2. Communication Paradigms - EJB Tutorial · Communication Paradigms Remote Invocation Remote Procedure Call ( RPC ) Is a way of communication in which a computer program can invoke

Imed Bouchrika. Distributed Objects, Uni of Souk-Ahras 2014-2015 http://www.imed.ws

Communication Paradigms

indirect communication

Message-Based PassingMessage-Queues

Synchronous vs Asynchronous

Transient vs PersistentExample : JMS

Distributed Shared Memory

A form of memory architecture where physically separate

memories can be addressed as virtually one memory.Example: OpenSSI: Allows a collection of computers to be treated

as one large system.

Publish-Subscribe Systems

15

Page 16: 2. Communication Paradigms - EJB Tutorial · Communication Paradigms Remote Invocation Remote Procedure Call ( RPC ) Is a way of communication in which a computer program can invoke

Imed Bouchrika. Distributed Objects, Uni of Souk-Ahras 2014-2015 http://www.imed.ws

Roles : Client-Server

2 architectural styles stemming from the role of

individual processes

Client-server

Peer-to-Peer

16

Page 17: 2. Communication Paradigms - EJB Tutorial · Communication Paradigms Remote Invocation Remote Procedure Call ( RPC ) Is a way of communication in which a computer program can invoke

Imed Bouchrika. Distributed Objects, Uni of Souk-Ahras 2014-2015 http://www.imed.ws

Client-Server

Processes divided into two groups:

Server: process implementing a specific service

(file system service, database service, ...)

Client: process that requests a service from a

server by sending it a request and subsequently

waiting for the server’s reply

17

Page 18: 2. Communication Paradigms - EJB Tutorial · Communication Paradigms Remote Invocation Remote Procedure Call ( RPC ) Is a way of communication in which a computer program can invoke

Imed Bouchrika. Distributed Objects, Uni of Souk-Ahras 2014-2015 http://www.imed.ws

Client-Server

Request-reply protocol

18

Page 19: 2. Communication Paradigms - EJB Tutorial · Communication Paradigms Remote Invocation Remote Procedure Call ( RPC ) Is a way of communication in which a computer program can invoke

Imed Bouchrika. Distributed Objects, Uni of Souk-Ahras 2014-2015 http://www.imed.ws

Client-Server

The client can be either Thin or Thick client.

Thin client is designed so that

The amount of client software should be small

The bulk of processing takes place on the servers.

Because the software requirements are minimal, less

hardware is needed to run the software.

There is no need for much administration, expansion

slots and maintenance.

Examples : X terminal or Web Browser-based websites.

19

Page 20: 2. Communication Paradigms - EJB Tutorial · Communication Paradigms Remote Invocation Remote Procedure Call ( RPC ) Is a way of communication in which a computer program can invoke

Imed Bouchrika. Distributed Objects, Uni of Souk-Ahras 2014-2015 http://www.imed.ws

Client-Server

The client can be either Thin or Thick client.

Thick client (or fat client )

performs the bulk of data processing operations.

A server may perform rather rudimentary (primitive) or

simple tasks such as storing and retrieving data.

20

Page 21: 2. Communication Paradigms - EJB Tutorial · Communication Paradigms Remote Invocation Remote Procedure Call ( RPC ) Is a way of communication in which a computer program can invoke

Imed Bouchrika. Distributed Objects, Uni of Souk-Ahras 2014-2015 http://www.imed.ws

Client-Server

Request-reply protocol

Requests are sent in messages from clients to a server

When a client sends a request for an operation to be

carried out

Replies are sent in messages from the server to the clients

21

Page 22: 2. Communication Paradigms - EJB Tutorial · Communication Paradigms Remote Invocation Remote Procedure Call ( RPC ) Is a way of communication in which a computer program can invoke

Imed Bouchrika. Distributed Objects, Uni of Souk-Ahras 2014-2015 http://www.imed.ws

Client-Server

A process can be both a client and a server, since

servers sometimes invoke operations on other servers

The terms “client” and “server” apply only to the roles

played in a single Request

But in general they are distinct concepts:

Clients are active and server are passive

Server run continuously, whereas clients last only as

long as the applications of which they form a part

22

Page 23: 2. Communication Paradigms - EJB Tutorial · Communication Paradigms Remote Invocation Remote Procedure Call ( RPC ) Is a way of communication in which a computer program can invoke

Imed Bouchrika. Distributed Objects, Uni of Souk-Ahras 2014-2015 http://www.imed.ws

Client-Server

Multi-tier architecture (n-tier architecture)

Client–server architecture in which

Presentation,

Application processing

( Business Logic )

Data management functions

are logically separated.

23

Page 24: 2. Communication Paradigms - EJB Tutorial · Communication Paradigms Remote Invocation Remote Procedure Call ( RPC ) Is a way of communication in which a computer program can invoke

Imed Bouchrika. Distributed Objects, Uni of Souk-Ahras 2014-2015 http://www.imed.ws

Peer 2 Peer

24

Page 25: 2. Communication Paradigms - EJB Tutorial · Communication Paradigms Remote Invocation Remote Procedure Call ( RPC ) Is a way of communication in which a computer program can invoke

Imed Bouchrika. Distributed Objects, Uni of Souk-Ahras 2014-2015 http://www.imed.ws

Peer 2 Peer

All the processes involved in a task or activity play similar

roles,

Peers do interact cooperatively without any distinction between

client and server processes or the computers that they run on

All peers run the same program and offer the same set of

interfaces to each other.

The aim of the P2P architecture is to exploit the resources

(both data and hardware) in a large number of participating

computers for the fulfilment of a given task or activity

25

Page 26: 2. Communication Paradigms - EJB Tutorial · Communication Paradigms Remote Invocation Remote Procedure Call ( RPC ) Is a way of communication in which a computer program can invoke

Imed Bouchrika. Distributed Objects, Uni of Souk-Ahras 2014-2015 http://www.imed.ws

Peer 2 Peer

Examples for Peer 2 Peer Applications.

Napster ?

Torrents

Mule ...

26

Page 27: 2. Communication Paradigms - EJB Tutorial · Communication Paradigms Remote Invocation Remote Procedure Call ( RPC ) Is a way of communication in which a computer program can invoke

Imed Bouchrika. Distributed Objects , Uni of Souk-Ahras 2014-2015 http://www.imed.ws

Group Chat using Sockets

Master II – Software Engineering

Imed BouchrikaDept of Mathematics & Computer Science

University of Souk-Ahras

[email protected]

Page 28: 2. Communication Paradigms - EJB Tutorial · Communication Paradigms Remote Invocation Remote Procedure Call ( RPC ) Is a way of communication in which a computer program can invoke

Imed Bouchrika. Distributed Objects, Uni of Souk-Ahras 2014-2015 http://www.imed.ws

Chat Server

28