Session 3 - Programming Model of DS-VF
Session 3 - Programming Model of DS-VF
Session 3 - Programming Model of DS-VF
Pedagogy Staff
Nom Grade Faculté/Institut Adresse e-mail
KITOUNI Ilham MCA Nouvelles Technologies Ilham.kitouni@univ-constantine2.dz
Dr KITOUNI Ilham 1
Distributed Application Development and Middleware (DARM) 2023/2024 Semester 1
Content:
Examples
Client-server Architecture
In the world of distributed application development, one of the most commonly used
architectures is the client-server architecture. This architecture consists of two main
components: the client and the server. The client is responsible for sending requests
to the server, while the server is responsible for processing those requests and sending
back the appropriate responses.
The client-server architecture is based on the principle of separation of concerns. The
client is concerned with the presentation layer, which includes the user interface and
user interactions. On the other hand, the server is concerned with the business logic
and data storage. This separation allows for a clear division of responsibilities, making
it easier to develop, maintain, and scale distributed applications.
Dr KITOUNI Ilham 2
Distributed Application Development and Middleware (DARM) 2023/2024 Semester 1
Conclusion
The client-server architecture is a fundamental concept in distributed application
development. It provides a clear separation of concerns, scalability, reliability, security,
and interoperability. By leveraging the advantages of this architecture, developers can
create robust and efficient distributed applications that meet the needs of modern
computing environments.
In the previous section, we explored the client-server architecture, which is one of the
fundamental programming models for building distributed applications. In this section,
we will delve into another widely used programming model known as the message-
passing model.
Message-Passing Model
The message-passing model is a programming paradigm that enables communication
and coordination between different components of a distributed system through
message exchange. In this model, components are typically referred to as processes,
which can be running on different machines or nodes.
In the message-passing model, processes communicate by sending and receiving
messages. Messages can contain data or instructions and are exchanged through
communication channels, which can be implemented using various underlying
protocols such as TCP/IP or UDP.
There are two main communication paradigms within the message-passing model:
synchronous and asynchronous communication.
Synchronous Communication
In synchronous communication, the sender process blocks until the receiver process
acknowledges the receipt of the message. This blocking behavior ensures that the
Dr KITOUNI Ilham 3
Distributed Application Development and Middleware (DARM) 2023/2024 Semester 1
sender process waits for the response from the receiver before proceeding with its
execution. Synchronous communication is often used when a direct response or
immediate synchronization is required between processes.
One common example of synchronous communication is the request-reply pattern,
where a client process sends a request message to a server process and waits for the
server to respond with a reply message. This pattern is commonly used in client-server
systems, where the client needs to wait for a response from the server before
continuing its execution.
Asynchronous Communication
In asynchronous communication, the sender process does not block after sending a
message. Instead, it continues its execution immediately without waiting for a response
from the receiver. Asynchronous communication is typically used when there is no
immediate need for a response or when parallel execution is desired.
One common example of asynchronous communication is the publish-subscribe
pattern, where a publisher process sends messages to multiple subscriber processes
without waiting for individual acknowledgments. Subscribers can receive and process
messages at their own rate, enabling parallelism and scalability.
The message-passing model provides several advantages for distributed application
development:
However, there are also challenges associated with the message-passing model:
Dr KITOUNI Ilham 4
Distributed Application Development and Middleware (DARM) 2023/2024 Semester 1
Now that we have explored the message-passing model, we have gained a deeper
understanding of the different programming models for distributed applications. In the
next section, we will discuss another important programming model: the remote
procedure call (RPC) model.
1. Client: The program that initiates the RPC and invokes remote procedures.
2. Server: The program that receives the RPC requests, executes the requested
procedures, and sends back the results.
3. Interface Definition Language (IDL): A language or specification used to
define the interfaces and data structures of the remote procedures. IDL provides
a way to describe the methods, parameters, and return types of the remote
procedures.
4. Stub: On the client side, a stub is generated based on the IDL specification.
The stub acts as a proxy for the remote procedure, marshaling the parameters,
making the network call, and unmarshaling the results.
5. Skeleton: On the server side, a skeleton is generated based on the IDL
specification. The skeleton receives the RPC request, unmarshals the
parameters, executes the procedure, and marshals the results.
6. Marshaling and unmarshaling: The process of converting the parameters and
results of the remote procedure into a format that can be transmitted over the
network. Marshaling is performed by the stub on the client side, and
unmarshaling is performed by the skeleton on the server side.
Dr KITOUNI Ilham 5
Distributed Application Development and Middleware (DARM) 2023/2024 Semester 1
However, RPC also has some limitations and considerations that developers should
be aware of:
Distributed Objects
In the previous sections, we explored various programming models for distributed
applications, such as the client-server architecture, message-passing model, and
remote procedure call (RPC). Now, let's delve into the concept of distributed objects,
which is another powerful programming model used in distributed systems.
Dr KITOUNI Ilham 6
Distributed Application Development and Middleware (DARM) 2023/2024 Semester 1
Dr KITOUNI Ilham 7
Distributed Application Development and Middleware (DARM) 2023/2024 Semester 1
principles, and best practices should be followed to ensure the success of distributed
application development.
Conclusion
Distributed objects offer a powerful programming model for developing distributed
applications. They provide location transparency, interoperability, concurrency control,
persistence, and security. By utilizing distributed objects, developers can achieve
modularity, scalability, maintenance flexibility, and fault tolerance in their distributed
systems.
Agent-based programming
Agent-based programming is a programming paradigm that focuses on the design and
implementation of autonomous software entities known as agents within a distributed
system. These agents are capable of acting independently and making decisions
based on their local knowledge and interactions with other agents.
Unlike traditional programming models, where the system is divided into clients and
servers, agent-based programming introduces a more decentralized approach. Agents
are considered to be active entities that can communicate and collaborate with other
agents to achieve a common goal.
One of the key advantages of agent-based programming is its ability to handle complex
and dynamic environments. Agents can adapt and react to changes in the system,
making it suitable for applications that require flexibility and responsiveness. This
programming model is particularly useful in areas such as multi-agent systems,
intelligent systems, and distributed artificial intelligence.
1. Autonomy: Agents have the ability to act independently and make decisions
based on their own internal state and knowledge.
2. Proactivity: Agents are proactive and can initiate actions without external
stimuli.
3. Reactivity: Agents can react to changes in the environment or other agents'
actions.
4. Social ability: Agents can communicate and interact with other agents to
exchange information and collaborate.
Dr KITOUNI Ilham 8
Distributed Application Development and Middleware (DARM) 2023/2024 Semester 1
Message Passing
Message passing is a communication model where processes or objects communicate
by sending and receiving messages. In this model, the sender explicitly specifies the
recipient of the message. The message contains information or instructions that the
recipient can process.
Message passing provides a simple and flexible way to exchange data between
distributed components. It allows for direct communication between components,
enabling efficient and fine-grained control over the communication process. However,
it requires explicit handling of message routing, synchronization, and error handling.
Distributed Objects
Distributed objects model treats remote objects as local objects, abstracting the
complexities of distributed communication. In this model, objects from different
locations can interact with each other as if they were located in the same address
space.
Distributed objects offer a high level of abstraction, promoting code reusability and
modular design. They encapsulate both data and behavior, allowing for seamless
integration of remote components. However, this model introduces additional overhead
for object serialization, remote method invocation, and object lifecycle management.
Dr KITOUNI Ilham 9
Distributed Application Development and Middleware (DARM) 2023/2024 Semester 1
Agent-Based Programming
Agent-based programming model focuses on autonomous and intelligent entities
called agents. These agents have their own goals, knowledge, and decision-making
capabilities. They can interact with each other and the environment to achieve their
objectives.
Dr KITOUNI Ilham 10
Distributed Application Development and Middleware (DARM) 2023/2024 Semester 1
Another example is the email system, where clients (such as Outlook or Gmail)
communicate with mail servers to send and receive emails. The client-server
architecture provides a reliable and scalable solution for handling the vast amount of
email traffic worldwide.
Another case study is the Apache Kafka messaging system, which is designed for
handling high-throughput, fault-tolerant, and scalable data streaming applications.
Kafka utilizes a publish-subscribe model where producers send messages to topics,
and consumers subscribe to those topics to receive the messages. This message-
passing model enables real-time data processing and analysis in distributed systems.
Dr KITOUNI Ilham 11
Distributed Application Development and Middleware (DARM) 2023/2024 Semester 1
Another case study is the Google Protocol Buffers (protobuf) framework, which
provides a language-agnostic mechanism for serializing structured data. Protobuf
supports RPC communication between distributed systems, allowing clients to invoke
methods on remote servers using a defined protocol. This model enables efficient data
exchange and interoperability between different programming languages.
Another case study is the Common Object Request Broker Architecture (CORBA),
which is a middleware standard for developing distributed systems. CORBA enables
objects written in different programming languages to communicate with each other
seamlessly. This distributed object model provides a high level of interoperability and
flexibility in distributed application development.
Another case study is the JADE (Java Agent Development Framework), which is a
platform for developing agent-based applications. JADE provides a set of tools and
libraries for creating intelligent agents that can interact with each other using message
passing. This model enables the development of distributed systems with advanced
capabilities, such as intelligent decision-making and adaptive behavior.
References:
Dr KITOUNI Ilham 12