1 of 120

Distributed Systems

MODULE 1

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

1

2 of 120

  • Introduction
  • Networks of computers are everywhere.
  • A distributed system as one in which hardware or software components located at networked computers communicate and coordinate their actions only by passing messages.
  • Distributed systems has the following significant consequences

Concurrency - The capacity of the system to handle shared resources can be increased by adding more resources No global Clock - When programs need to cooperate they coordinate their actions by exchanging messages. Close coordination often depends on a shared idea of the time at which the programs’ actions occur. Independent Failures - Faults in the network result in the isolation of the computers that are connected to it, but that doesn’t mean that they stop running.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

2

3 of 120

The prime motivation for constructing and using distributed systems stems from a desire to share resources.

Examples

Web Search

Massively multiplayer Online Games

Financial Trading

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

3

4 of 120

Focus on Resource Sharing

Share hardware resources such as printers, data resources such as files, and resources with more specific functionality such as search engines.

Example: users are concerned with sharing data in the form of a shared database or a set of web pages – not the disks and processors on which they are implemented.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

4

5 of 120

At one extreme, a search engine on the Web provides a facility to users throughout the world, users who need never come into contact with one another directly. At the other extreme, in computer-supported cooperative working (CSCW), a group of users who cooperate directly share resources such as documents in a small, closed group.

service for a distinct part of a computer system that manages a collection of related resources and presents their functionality to users and applications.

client-server computing.

A complete interaction between a client and a server, from the point when the client sends its request to when it receives the server’s response, is called a remote invocation.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

5

6 of 120

  • In an object-oriented language, resources may be encapsulated as objects and accessed by client objects, in which case we speak of a client object invoking a method upon a server object.
  • An executing web browser is an example of a client. The web browser communicates with a web server, to request web pages from it

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

6

7 of 120

Challenges

  • Heterogeneity
  • Openness
  • Security
  • Scalability
  • Failure Handling
  • Concurrency
  • Transparency
  • Quality of Service

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

7

8 of 120

Heterogeneity

Heterogeneity (that is, variety and difference) applies to all of the following:

• networks;

• computer hardware;

• operating systems;

• programming languages;

• implementations by different developers.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

8

9 of 120

  • A computer attached to an Ethernet has an implementation of the Internet protocols over the Ethernet, whereas a computer on a different sort of network will need an implementation of the Internet protocols for that network.
  • Data types such as integers may be represented in different ways on different sorts of hardware
  • The calls for exchanging messages in UNIX are different from the calls in Windows.Different programming languages use different representations for characters and data structures such as arrays and records.
  • Programs written by different developers cannot communicate with one another unless they use common standards ��

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

9

10 of 120

  • Middleware • The term middleware applies to a software layer that provides a programming abstraction as well as masking the heterogeneity of the underlying networks, hardware, operating systems and programming languages.
  • Some middleware, such as Java Remote Method Invocation (RMI) (see Chapter 5), supports only a single programming language.
  • Middleware provides a uniform computational model for use by the programmers of servers and distributed applications. Possible models include remote object invocation, remote event notification, remote SQL access and distributed transaction processing.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

10

11 of 120

  • Heterogeneity and mobile code • The term mobile code is used to refer to program code that can be transferred from one computer to another and run at the destination – Java applets are an example.
  • The virtual machine approach provides a way of making code executable on a variety of host computers: the compiler for a particular language generates code for a virtual machine instead of a particular hardware order code.
  • For example, the Java compiler produces code for a Java virtual machine, which executes it by interpretation. ��

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

11

12 of 120

Openness

The openness of a computer system is the characteristic that determines whether the system can be extended and reimplemented in various ways.

The openness of distributed systems is determined primarily by the degree to which new resource-sharing services can be added and be made available for use by a variety of client programs.

‘Requests For Comments’, or RFCs,

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

12

13 of 120

  • Open systems are characterized by the fact that their key interfaces are published.

• Open distributed systems are based on the provision of a uniform communication mechanism and published interfaces for access to shared resources.

• Open distributed systems can be constructed from heterogeneous hardware and software, possibly from different vendors.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

13

14 of 120

Security

  • Security for information resources has three components: confidentiality (protection against disclosure to unauthorized individuals), integrity (protection against alteration or corruption), and availability (protection against interference with the means to access the resources)For example:
  • 1. A doctor might request access to hospital patient data or send additions to that data.
  • 2. In electronic commerce and banking, users send their credit card numbers across the Internet.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

14

15 of 120

Denial of service attacks: A user may wish to disrupt a service for some reason. This can be achieved by bombarding the service with such a large number of pointless requests that the serious users are unable to use it. This is called a denial of service attack.

Security of mobile code: Mobile code needs to be handled with care.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

15

16 of 120

Scalability

Distributed systems operate effectively and efficiently at many different scales, ranging from a small intranet to the Internet. A system is described as scalable if it will remain effective when there is a significant increase in the number of resources and the number of users.

Controlling the cost of physical resources: As the demand for a resource grows, it should be possible to extend the system, at reasonable cost, to meet it. For example, if a single file server can support 20 users, then two such servers should be able to support 40 users. Controlling the performance loss: Algorithms that use hierarchic structures scale better than those that use linear structures. But even with hierarchic structures an increase in size will result in some loss in performance: the time taken to access hierarchically structured data is O(log n), where n is the size of the set of data.Preventing software resources running out:Avoiding performance bottlenecks: In general, algorithms should be decentralized to avoid having performance bottlenecks.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

16

17 of 120

Failure handling

Computer systems sometimes fail. When faults occur in hardware or software, programs may produce incorrect results or may stop before they have completed the intended computation.

Detecting failures: Some failures can be detected. For example, checksums can be used to detect corrupted data in a message or a file. Masking failures: Some failures that have been detected can be hidden or made less severe. Two examples of hiding failures:

1. Messages can be retransmitted when they fail to arrive.

2. File data can be written to a pair of disks so that if one is corrupted, the other may still be correct.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

17

18 of 120

Tolerating failures: Most of the services in the Internet do exhibit failures – it would not be practical for them to attempt to detect and hide all of the failures that might occur in such a large network with so many components.

Recovery from failures: Recovery involves the design of software so that the state of permanent data can be recovered or ‘rolled back’ after a server has crashed.Redundancy: Services can be made to tolerate failures by the use of redundant components. 1. There should always be at least two different routes between any two routers in the Internet.

2. In the Domain Name System, every name table is replicated in at least two different servers.

3. A database may be replicated in several servers to ensure that the data remains accessible after the failure of any single server; the servers can be designed to detect faults in their peers; when a fault is detected in one server, clients are redirected to the remaining servers.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

18

19 of 120

Concurrency

Both services and applications provide resources that can be shared by clients in a distributed system.

any object that represents a shared resource in a distributed system must be responsible for ensuring that it operates correctly in a concurrent environment.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

19

20 of 120

Transparency

Transparency is defined as the concealment from the user and the application programmer of the separation of components in a distributed system, so that the system is perceived as a whole rather than as a collection of independent components.

Access transparency enables local and remote resources to be accessed using identical operations.

Location transparency enables resources to be accessed without knowledge of their physical or network location (for example, which building or IP address).

Concurrency transparency enables several processes to operate concurrently using shared resources without interference between them.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

20

21 of 120

Replication transparency enables multiple instances of resources to be used to increase reliability and performance without knowledge of the replicas by users or application programmers.

Failure transparency enables the concealment of faults, allowing users and application programs to complete their tasks despite the failure of hardware or software components.

Mobility transparency allows the movement of resources and clients within a system without affecting the operation of users or programs.

Performance transparency allows the system to be reconfigured to improve performance as loads vary.

Scaling transparency allows the system and applications to expand in scale without change to the system structure or the application algorithms.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

21

22 of 120

Quality of service

  • Reliability,
  • Security and
  • Performance and
  • Adaptability

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

22

23 of 120

Remote Invocation Methods

How processes (or entities at a higher level of abstraction such as objects or services) communicate in a distributed system,

Request-reply protocols represent a pattern on top of message passing and support the two-way exchange of messages as encountered in client-server computing.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

23

24 of 120

  • Request- Reply Protocols

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

24

25 of 120

  • Acknowledgements are redundant, since requests are followed by replies.

• Establishing a connection involves two extra pairs of messages in addition to the pair required for a request and a reply.

• Flow control is redundant for the majority of invocations, which pass only small arguments and results.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

25

26 of 120

Communication Primitives

  • doOperation
  • getRequest
  • sendReply

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

26

27 of 120

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

27

28 of 120

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

28

29 of 120

The first field indicates whether the message is a Request or a Reply message.

The second field, requestId, contains a message identifier.

A doOperation in the client generates a requestId for each request message, and the server copies these IDs into the corresponding reply messages. This enables doOperation to check that a reply message is the result of the current request, not a delayed earlier call.

The third field is a remote reference.

The fourth field is an identifier for the operation to be invoked. For example, the operations in an interface might be numbered 1, 2, 3, ... , if the client and server use a common language that supports reflection, a representation of the operation itself may be put in this field

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

29

30 of 120

A message identifier consists of two parts:

1. a requestId, which is taken from an increasing sequence of integers by the sending process;

2. an identifier for the sender process, for example, its port and Internet address.

Message Identifiers - Any scheme that involves the management of messages to provide additional properties such as reliable message delivery or request-reply communication

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

30

31 of 120

Failure Model of the request-reply protocol

  • If the primitives implemented over UDP datagrams, then they suffer from communication failures
  • They suffer from omission failures.
  • Messages are not guaranteed to be delivered in sender order

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

31

32 of 120

Timeouts

There are various options as to what doOperation can do after a timeout.

The simplest option is to return immediately from doOperation with an indication to the client that the doOperation has failed.

Discarding Duplicate Request Messages

when the request message is retransmitted, the server may receive it more than once. For example, the server may receive the first request message but take longer than the client’s timeout to execute the command and return the reply

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

32

33 of 120

Lost reply messages • If the server has already sent the reply when it receives a duplicate request it will need to execute the operation again to obtain the result, unless it has stored the result of the original execution. Some servers can execute their

operations more than once and obtain the same results each time. An idempotent operation is an operation that can be performed repeatedly with the same effect as if it had been performed exactly once

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

33

34 of 120

History

For servers that require retransmission of replies without re-execution of operations, a history may be used. The term ‘history’ is used to refer to a structure that contains a record of (reply) messages that have been transmitted.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

34

35 of 120

  • Styles of exchange Protocols

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

35

36 of 120

In the R protocol, a single Request message is sent by the client to the server. The R protocol may be used when there is no value to be returned from the remote operation and the client requires no confirmation that the operation has been executed.

The RR protocol is useful for most client-server exchanges because it is based on the request-reply protocol. Special acknowledgement messages are not required, because a server’s reply message is regarded as an acknowledgement of the client’s request message

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

36

37 of 120

The RRA protocol is based on the exchange of three messages: request-reply-

acknowledge reply. The Acknowledge reply message contains the requestId from the

reply message being acknowledged.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

37

38 of 120

If the TCP protocol is used, it ensures that request and reply messages are delivered reliably, so there is no need for the request-reply protocol to deal with retransmission of messages and filtering of duplicates or with histories.

Use of TCP streams to implement the request-reply protocol

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

38

39 of 120

HTTP: An example for request-reply protocol

as data – for example the text of an HTML page, an image or the class of an applet;

as a program – for example, servlets [java.sun.com III], or PHP or Python programs that run on the web server.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

39

40 of 120

  • Content Negotiation
    • clients’ requests can include information as to what data
    • representations they can accept (for example, language or media type), enabling the
    • server to choose the representation that is the most appropriate for the user

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

40

41 of 120

  • Authentication

Credentials and challenges are used to support password-style authentication.

On the first attempt to access a password-protected area, the server reply contains a challenge applicable to the resource.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

41

42 of 120

Client- Server Interaction

  • The client requests and the server accepts a connection at the default server port or at a port specified in the URL.

• The client sends a request message to the server.

• The server sends a reply message to the client.

• The connection is closed

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

42

43 of 120

  • HTTP Request Message

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

43

44 of 120

  • Data resources are supplied as MIME-like structures in arguments and results.
  • A MIME type specifies a type and a subtype, for example, text/plain, text/html, image/gif or image/jpeg.
  • Clients can also specify the MIME types that they are willing to accept.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

44

45 of 120

HTTP Methods

  • GET: Requests the resource whose URL is given as its argument. If the URL refers to data, then the web server replies by returning the data identified by that URL.
  • If the URL refers to a program, then the web server runs the program and returns its output to the client.
  • GET can be used to send the contents of a form to a program as an argument.
  • The GET operation can be made conditional on the date a resource was last modified.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

45

46 of 120

  • HEAD: This request is identical to GET, but it does not return any data.
  • POST: Specifies the URL of a resource (for example a program) that can deal with the data supplied in the body of the request
    • providing a block of data to a data-handling process such as a servlet – for example, submitting a web form to buy something from a web site;
    • posting a message to a mailing list or updating details of members of the list;
    • extending a database with an append operation.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

46

47 of 120

PUT: Requests that the data supplied in the request is stored with the given URL as

its identifier, either as a modification of an existing resource or as a new resource.

DELETE: The server deletes the resource identified by the given URL. Servers may not always allow this operation, in which case the reply indicates failure.

OPTIONS: The server supplies the client with a list of methods it allows to be applied to the given URL (for example GET, HEAD, PUT) and its special requirements.

TRACE: The server sends back the request message. Used for diagnostic purposes.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

47

48 of 120

  • Message Contents

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

48

49 of 120

Remote Procedure Call (RPC)

The goal of the RPC to make the distributed systems look similar to achieve high level of distribution transparency.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

49

50 of 120

Design Issues for RPC

  • The style of programming promoted by RPC – programming with interfaces;
  • The call semantics associated with RPC;
  • The key issue of transparency and how it relates to remote procedure calls

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

50

51 of 120

Programming with Interfaces

  • Most modern programming languages provide a means of organizing a program as a set of modules that can communicate with one another.
  • Communication between modules can be by means of procedure calls between modules or by direct access to the variables in another module.
  • To control the possible interactions between modules, an explicit interface is defined for each module.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

51

52 of 120

Interfaces in distributed Systems

  • In a distributed program, the modules can run in separate processes.
  • In the client-server model, in particular, each server provides a set of procedures that are available for use by clients.
  • For example, a file server would provide procedures for reading and writing files.
  • The term service interface is used to refer to the specification of the procedures offered by a server, defining the types of the arguments of each of the procedures.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

52

53 of 120

Advantages of programming with interfaces

  • Programmers are concerned only with the abstraction offered by the service interface and need not be aware of implementation details.
  • Extrapolating to (potentially heterogeneous) distributed systems, programmers also do not need to know the programming language or underlying platform used to implement the service.
  • This approach provides natural support for software evolution in that implementations can change as long as long as the interface (the external view) remains the same.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

53

54 of 120

Definition of service Interfaces

  • It is not possible for a client module running in one process to access the variables in a module in another process. Therefore the service interface cannot specify direct access to variables.
  • The parameter-passing mechanisms used in local procedure calls – for example, call by value and call by reference, are not suitable when the caller and procedure are in different processes.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

54

55 of 120

Input parameters are passed to the remote server by sending the values of the arguments in the request message and then supplying them as arguments to the operation to be executed in the server.

Output parameters are returned in the reply message and are used as the result of the call or to replace the values of the corresponding variables in the calling environment.

  • Another difference between local and remote modules is that addresses in one process are not valid in another remote one. Therefore, addresses cannot be passed as arguments or returned as results of calls to remote modules

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

55

56 of 120

Interface Definition Language

  • RPC mechanism can be useful when all the parts of distributed applications can be written in same language( interfaces,input and output parameters)
  • Interface definition languages (IDLs) are designed to allow procedures implemented in different languages to invoke one another. An IDL provides a notation for defining interfaces in which each of the parameters of an operation may be described as for input or output in addition to having its type specified.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

56

57 of 120

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

57

58 of 120

PersonList – Interface name.

specifies the methods available for RMI in a remote object that implements that interface.

  • The method addPerson specifies its argument as in, meaning that it is an input argument,
  • The method getPerson that retrieves an instance of Person by name specifies its second argument as out, meaning that it is an output argument

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

58

59 of 120

Call Semantics

doOperation can be implemented in different ways to provide different delivery guarantees.

Retry request message: Controls whether to retransmit the request message until either a reply is received or the server is assumed to have failed.

Duplicate filtering: Controls when retransmissions are used and whether to filter out

duplicate requests at the server.

Retransmission of results: Controls whether to keep a history of result messages to enable lost results to be retransmitted without re-executing the operations at the server.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

59

60 of 120

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

60

61 of 120

MayBe Semantics

With maybe semantics, the remote procedure call may be executed once or not at all.

Maybe semantics arises when no fault-tolerance measures are applied and can suffer from the following types of failure:

omission failures if the request or result message is lost;

crash failures when the server containing the remote operation fails.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

61

62 of 120

At-Least Once Semantics

With at-least-once semantics, the invoker receives either a result, in which case the invoker knows that the procedure was executed at least once, or an exception informing it that no result was received.

At-least-once semantics can be achieved by the retransmission of request messages, which masks the omission failures of the request or result message.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

62

63 of 120

At-least-once semantics can suffer from the following types of failure:

crash failures when the server containing the remote procedure fails;

arbitrary failures in cases when the request message is retransmitted, the remote

server may receive it and execute the procedure more than once, possibly causing

wrong values to be stored or returned.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

63

64 of 120

At most-once semantics

With at-most-once semantics, the caller receives either a result, in which case the caller knows that the procedure was executed exactly once, or an exception informing it that no result was received, in which case the procedure will have been executed either once or not at all.

At-most-once semantics can be achieved by using all of the fault-tolerance measures

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

64

65 of 120

Transparency

Remote procedure calls are developed as like local procedure calls works with no distinction

in syntax between a local and a remote procedure call.

Although request messages are retransmitted after a timeout, this is transparent to the caller to make the semantics of remote procedure calls like that of local procedureCalls.

Remote procedure calls are more vulnerable to failure than local ones, since they involve a network, another computer and another process.

The latency of a remote procedure call is several orders of magnitude greater than

that of a local one.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

65

66 of 120

  • Remote procedure calls also require a different style of parameter passing.
  • The choice as to whether RPC should be transparent is also available to the designers of IDLs.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

66

67 of 120

Implementation of RPC

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

67

68 of 120

  • The client that accesses a service includes one stub procedure for each procedure in the
  • service interface.
  • The stub procedure behaves like a local procedure to the client, but instead of executing the call, it marshals the procedure identifier and the arguments into a request message, which it sends via its communication module to the server.
  • When the reply message arrives, it unmarshals the results.
  • The server process contains a dispatcher together with one server stub procedure and one service procedure for each procedure in the service interface.
  • The dispatcher selects one of the server stub procedures according to the procedure identifier in the request message.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

68

69 of 120

  • The server stub procedure then unmarshals the arguments in the request message, calls the corresponding service procedure and marshals the return values for the reply message.
  • The service procedures implement the procedures in the service interface.
  • The client and server stub procedures and the dispatcher can be generated automatically by an interface compiler from the interface definition of the service.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

69

70 of 120

Case Study: RPC

  • Sun RPC is sometimes called ONC (Open Network Computing)
  • RPC Implementors have the choice of using remote procedure calls over either UDP or TCP.
  • When Sun RPC is used with UDP, request and reply messages are restricted in length – theoretically to 64 kilobytes, but more often in practice to 8 or 9 kilobytes.
  • It uses at- least-once call semantics.
  • Broadcast RPC is an option.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

70

71 of 120

Interface Definition Language

The Sun XDR language, which was originally designed for specifying external data representations, was extended to become an interface definition language.

It may be used to define a service interface for Sun RPC by specifying a set of procedure definitions together with supporting type definitions.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

71

72 of 120

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

72

73 of 120

  • Most languages allow interface names to be specified, but Sun RPC does not – instead of this, a program number and a version number are supplied. The program numbers can be obtained from a central authority to allow every program to have its own unique number.
  • A procedure definition specifies a procedure signature and a procedure number. The procedure number is used as a procedure identifier in request messages.
  • Only a single input parameter is allowed.
  • The output parameters of a procedure are returned via a single result.
  • The procedure signature consists of the result type, the name of the procedure and the type of the input parameter. The type of both the result and the input parameter may specify either a single value or a structure containing several values

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

73

74 of 120

  • The program number is 9999 and the version number is 2.
  • The READ procedure (line 2) takes as its input parameter a structure with three components specifying a file identifier, a position in the file and the number of
  • bytes required.
  • Its result is a structure containing the number of bytes returned and the file data.
  • The WRITE procedure (line 1) has no result.
  • The WRITE and READ procedures are given numbers 1 and 2.
  • The number 0 is reserved for a null procedure, which is generated automatically and is intended to be used to test whether a server is available.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

74

75 of 120

The interface compiler rpcgen can be used to generate the following from an interface definition:

• client stub procedures;

• server main procedure, dispatcher and server stub procedures;

• XDR marshalling and unmarshalling procedures for use by the dispatcher and

client and server stub procedures

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

75

76 of 120

Binding

  • Sun RPC runs a local binding service called the port mapper at a well-known port number on each computer. Each instance of a port mapper records the program number, version number and port number in use by each service running locally.
  • When a server starts up it registers its program number, version number and port number with the local port mapper.
  • When a client starts up, it finds out the server’s port by making a remote request to the port mapper at the server’s host, specifying the program number and version number.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

76

77 of 120

Authentication

Sun RPC request and reply messages provide additional fields enabling authentication information to be passed between client and server.

The request message contains the credentials of the user running the client program.

For example, in the UNIX style of authentication the credentials include the uid and gid of the user

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

77

78 of 120

Several different authentication protocols can be supported. These include:

• none;

• UNIX style, as described above;

• a style in which a shared key is established for signing the RPC messages;

• Kerberos

A field in the RPC header indicates which style is being used.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

78

79 of 120

Remote Method Invocation

Remote method invocation (RMI) is closely related to RPC.

In RMI, a calling object can invoke a method in a potentially remote object.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

79

80 of 120

Commonalities between RMI and RPC

  • They both support programming with interfaces, with the resultant benefits that

stem from this approach.

They are both typically constructed on top of request-reply protocols and can offer

a range of call semantics such as at-least-once and at-most-once.

They both offer a similar level of transparency that is, local and remote calls employ the same syntax but remote interfaces typically expose the distributed nature of the underlying call, for example by supporting remote exceptions.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

80

81 of 120

Differences between RMI and RPC

  • The programmer is able to use the full expressive power of object-oriented programming in the development of distributed systems software, including the use of objects, classes and inheritance, and can also employ related object oriented design methodologies and associated tools.
  • Building on the concept of object identity in object-oriented systems, all objects in an RMI-based system have unique object references

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

81

82 of 120

Design Issues for RMI

The Object Model

  • An object-oriented program, for example in Java or C++, consists of a collection of interacting objects, each of which consists of a set of data and a set of methods.
  • Objects can encapsulate their data and the code of their methods. Some languages, for example Java and C++, allow programmers to define objects whose instance variables can be accessed directly.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

82

83 of 120

Object references: Objects can be accessed via object references. For example, in Java, a variable that appears to hold an object actually holds a reference to that object. To invoke a method in an object, the object reference and method name are given, together with any necessary arguments. The object whose method is invoked is sometimes called the target and sometimes the receiver.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

83

84 of 120

Interfaces: An interface provides a definition of the signatures of a set of methods (that is, the types of their arguments, return values and exceptions) without specifying their implementation. An object will provide a particular interface if its class contains code that implements the methods of that interface. In Java, a class may implement several interfaces, and the methods of an interface may be implemented by any class.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

84

85 of 120

Actions : Action in an object-oriented program is initiated by an object invoking a method in another object.

An invocation of a method can have three effects:

1. The state of the receiver may be changed.

2. A new object may be instantiated, for example, by using a constructor in Java or C++.

3. Further invocations on methods in other objects may take place ��

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

85

86 of 120

Exceptions: Programs can encounter many sorts of errors and unexpected conditions of varying seriousness. During the execution of a method, many different problems may be discovered: for example, inconsistent values in the object’s variables, or failures in attempts to read or write to files or network sockets. A block of code may be defined to throw an exception whenever particular unexpected conditions or errors arise. � �

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

86

87 of 120

Garbage collection: It is necessary to provide a means of freeing the space occupied by objects when they are no longer needed. A language such as Java, that can detect automatically when an object is no longer accessible recovers the space and makes it available for allocation to other objects. This process is called garbage collection.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

87

88 of 120

Distributed objects

The state of an object consists of the values of its instance variables. In the object-based paradigm the state of a program is partitioned into separate parts, each of which is associated with an object.

Distributed object systems may adopt the client-server architecture. In this case, objects are managed by servers and their clients invoke their methods using remote method invocation. In RMI, the client’s request to invoke a method of an object is sent in a message to the server managing the object.��

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

88

89 of 120

  • Distributed objects can assume other architectural models. For example, objects can be replicated in order to obtain the usual benefits of fault tolerance and enhanced performance.
  • Another advantage of treating the shared state of a distributed program as a collection of objects is that an object may be accessed via RMI, or it may be copied into a local cache and accessed directly, provided that the class implementation is available locally.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

89

90 of 120

The Distributed object Model

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

90

91 of 120

Method invocations between objects in different processes, whether in the same computer or not, are known as remote method invocations.

The objects B and F are remote objects.

All objects can receive local invocations, although they can receive them only from other objects that hold references to them.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

91

92 of 120

Remote object references: Other objects can invoke the methods of a remote object if they have access to its remote object reference. For example, a remote object reference for B in Figure 5.12 must be available to A.

Remote interfaces: Every remote object has a remote interface that specifies which of its methods can be invoked remotely. For example, the objects B and F in Figure 5.12 must have remote interfaces.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

92

93 of 120

Remote Object References

A remote object reference is an identifier that can be used throughout a distributed system to refer to a particular unique remote object. Remote object references are analogous to local ones in that:

1. The remote object to receive a remote method invocation is specified by the

invoker as a remote object reference.

2. Remote object references may be passed as arguments and results of remote

method invocations.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

93

94 of 120

Remote Interfaces

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

94

95 of 120

The class of a remote object implements the methods of its remote interface, for example as public instance methods in Java. Objects in other processes can invoke only the methods that belong to its remote interface.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

95

96 of 120

Actions in a distributed Object System

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

96

97 of 120

Distributed applications may provide remote objects with methods for instantiating objects that can be accessed by RMI, thus effectively providing the effect of remote instantiation of objects. For example, if the object L contains a method for creating remote objects, then the remote invocations from C and K could lead to the instantiation of the objects M and N, respectively.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

97

98 of 120

Garbage collection in a distributed-object system: If a language, for example Java, supports garbage collection, then any associated RMI system should allow garbage collection of remote objects. Distributed garbage collection is generally achieved by cooperation between the existing local garbage collector and an added module that carries out a form of distributed garbage collection, usually based on reference counting.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

98

99 of 120

Exceptions: Any remote invocation may fail for reasons related to the invoked object being in a different process or computer from the invoker. For example, the process containing the remote object may have crashed or may be too busy to reply, or the invocation or result message may be lost.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

99

100 of 120

Implementation of RMI

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

100

101 of 120

Communication module • The two cooperating communication modules carry out the request-reply protocol, which transmits request and reply messages between the client and server.

The operationId and all the marshalling and unmarshalling are the concern of the RMI software, discussed below. The communication modules are together responsible for providing a specified invocation semantics, for example at-most-once.��

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

101

102 of 120

Remote reference module • A remote reference module is responsible for translating between local and remote object references and for creating remote object references. To support its responsibilities, the remote reference module in each process has a remote object table that records the correspondence between local object references in that process and remote object references (which are system-wide).

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

102

103 of 120

Servants • A servant is an instance of a class that provides the body of a remote object. It is the servant that eventually handles the remote requests passed on by the corresponding skeleton. Servants live within a server process.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

103

104 of 120

The RMI software • This consists of a layer of software between the application-level objects and the communication and remote reference modules.

Proxy: The role of a proxy is to make remote method invocation transparent to clients by behaving like a local object to the invoker; but instead of executing an invocation, it forwards it in a message to a remote object. It hides the details of the remote object reference, the marshalling of arguments, unmarshalling of results and sending and receiving of messages from the client. ��

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

104

105 of 120

Dispatcher: A server has one dispatcher and one skeleton for each class representing a remote object. In our example, the server has a dispatcher and a skeleton for the class of remote object B. The dispatcher receives request messages from the communication module. It uses the operationId to select the appropriate method in the skeleton, passing on the request message

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

105

106 of 120

Skeleton: The class of a remote object has a skeleton, which implements the methods in the remote interface. They are implemented quite differently from the methods in the servant that incarnates a remote object. A skeleton method unmarshals the arguments in the request message and invokes the corresponding method in the servant.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

106

107 of 120

Generation of the classes for proxies, dispatchers and skeletons • The classes for the proxy, dispatcher and skeleton used in RMI are generated automatically by an interface compiler. For example, in the Orbix implementation of CORBA, interfaces of remote objects are defined in CORBA IDL, and the interface compiler can be used to generate the classes for proxies, dispatchers and skeletons in C++ or in Java

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

107

108 of 120

Dynamic Invocation

  • Dynamic invocation gives the client access to a generic representation of a remote invocation like the doOperation method which is available as part of the infrastructure for RMI.
  • The dynamic invocation interface is not as convenient to use as a proxy, but it is useful in applications where some of the interfaces of the remote objects cannot be predicted at design time. An example of such an application is the shared whiteboard that we use to illustrate Java RMI ��

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

108

109 of 120

Dynamic Skeletons

Server and Client Programs

The server program contains the classes for the dispatchers and skeletons, together with the implementations of the classes of all of the servants that it supports. In addition, the server program contains an initialization section (for example, in a main method in Java or C++). The initialization section is responsible for creating and initializing at least one of the servants to be hosted by the server.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

109

110 of 120

The client program will contain the classes of the proxies for all of the remote objects that it will invoke. It can use a binder to look up remote object references.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

110

111 of 120

Factory Methods

The term factory method is sometimes used to refer to a method that creates servants, and a factory object is an object with factory methods.

Binder

A binder in a distributed system is a separate service that maintains a table containing mappings from textual names to remote object references. It is used by servers to register their remote objects by name and by clients to look them up. ��

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

111

112 of 120

Server threads • Whenever an object executes a remote invocation, that execution may lead to further invocations of methods in other remote objects, which may take some time to return. To avoid the execution of one remote invocation delaying the execution of another, servers generally allocate a separate thread for the execution of each remote invocation.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

112

113 of 120

Activation of remote objects

A remote object is described as active when it is available for invocation within a running process, whereas it is called passive if is not currently active but can be made active. A passive object consists of two parts:

1. the implementation of its methods;

2. its state in the marshalled form.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

113

114 of 120

An activator is responsible for:

registering passive objects that are available for activation, which involves recording the names of servers against the URLs or file names of the corresponding passive objects;

starting named server processes and activating remote objects in them;

keeping track of the locations of the servers for remote objects that it has already

activated

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

114

115 of 120

Persistent Object Stores

  • An object that is guaranteed to live between activations of processes is called a persistent object.
  • a persistent object store will manage very large numbers of persistent objects, which are stored on disk or in a database until they are needed. They will be activated when their methods are invoked by other objects.
  • Persistent object stores generally allow collections of related persistent objects to have human-readable names such as pathnames or URLs.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

115

116 of 120

There are two approaches to deciding whether an object is persistent or not:

The persistent object store maintains some persistent roots, and any object that is

reachable from a persistent root is defined to be persistent.

The persistent object store provides some classes on which persistence is based –

persistent objects belong to their subclasses..

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

116

117 of 120

Object Location

A location service helps clients to locate remote objects from their remote object references. It uses a database that maps remote object references to their probable current locations

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

117

118 of 120

Distributed Garbage Collection

The aim of a distributed garbage collector is to ensure that if a local or remote reference to an object is still held anywhere in a set of distributed objects, the object itself will continue to exist, but as soon as no object any longer holds a reference to it, the object will be collected and the memory it uses recovered.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

118

119 of 120

The distributed garbage collector works in cooperation with the local garbage collectors as follows:

Each server process maintains a set of the names of the processes that hold remote object references for each of its remote objects;

When a client C first receives a remote reference to a particular remote object, B, it makes an addRef(B) invocation to the server of that remote object and then creates a proxy; the server adds C to B.holders. ��

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

119

120 of 120

When a client C’s garbage collector notices that a proxy for remote object B is no longer reachable, it makes a removeRef(B) invocation to the corresponding server and then deletes the proxy; the server removes C from B.holders.

When B.holders is empty, the server’s local garbage collector will reclaim the space occupied by B unless there are any local holders.

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

/skit.org.in

/skit.org.in

/skit.org.in

Sri Krishna Institute of Technology

(Approved by AICTE, Accredited by NAAC, Affiliated to VTU, Karnataka)

10/28/2024

120