---
title: "Middleware importance; RPC operation"
subject: "Distributed System"
chapter: 2
key: "semester_7/distributed_system:rpc-middleware-operation"
source: https://www.bctengineer.com/q/semester_7/distributed_system/rpc-middleware-operation
site: BCT Engineering
---

# Middleware importance; RPC operation

Distributed System · Chapter 2: Distributed Objects and File System

- Asked in: 2069 Chaitra, 3+5 marks
- Video: [Remote Procedure call in Distributed System | RPC | Introduction | Lec-18 | Bhanu Priya](https://www.youtube.com/watch?v=1LCmOHod1b4) — Education 4u
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_7/distributed_system/rpc-middleware-operation
- Whole chapter: https://www.bctengineer.com/md/semester_7/distributed_system/chapter-2

## Question

How do you convince that middleware plays the important role in Distributed System? Explain the operation of RPC in client server communication in Distributed System.

## Short answer

Middleware hides heterogeneity, provides distribution transparency and common services. RPC lets a client call a remote procedure: the stub marshals arguments, sends them to the server stub, which unmarshals, calls the procedure, and returns the result.

## Answer

#### Importance of middleware
**Middleware** is a software layer between the application and the operating system/network of each node that hides heterogeneity and gives a uniform programming model (RPC, RMI, message queues, ORB, transactions). Examples: CORBA, Java RMI, DCOM, web services.

Its role:
- hides differences in hardware, OS, network and languages (heterogeneity), via IDL and standard data formats;
- provides distribution transparency (location, access, replication, failure);
- gives common services: naming, security, transactions, events, persistence;
- makes application development easy (programmers write application logic, not network code) and promotes openness and interoperability.

Without middleware each application would have to deal with sockets, data conversion and failures, and could not run on mixed systems. That is why a distributed system is described as having a middleware layer (Tanenbaum) which gives the "single system" view on top of independent computers.

#### Operation of RPC in client-server communication
**Remote Procedure Call (RPC)** lets a program call a procedure that runs in another address space, normally on another computer, with the same syntax as a local call. The network communication is hidden from the programmer.

**Operation**

```text
 Client process              Server process
 +---------------+           +---------------+
 | Client: call  |           | Server        |
 | procedure     |           | procedure     |
 | Client stub   |           | Server stub   |
 | RPC runtime   |<-network->| RPC runtime   |
 +---------------+           +---------------+
```

1. The client calls the **client stub** like a local procedure.
2. The stub **marshals** (packs) parameters into a message (for example using XDR) and passes it to the RPC runtime, which sends it.
3. The server's runtime receives it and gives it to the **server stub**, which **unmarshals** the parameters.
4. The server stub calls the actual procedure.
5. The result goes back the same way (marshalled, sent, unmarshalled) and the client call returns.

**Interface definition:** an interface description (IDL) is compiled to generate the stubs, so both ends agree on data types.

**Request-reply:** the client blocks until the reply arrives (synchronous). A binder (port mapper) locates the server, and timeouts with retransmission handle lost messages; the call semantics are normally at-least-once or at-most-once.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. Why is middleware important in a distributed system?
   A. It is only needed on a single computer
   B. It prevents heterogeneity from being hidden
   C. It replaces the network hardware
   D. Without it each application would handle sockets, data conversion and failures itself
   Answer: D. Middleware hides heterogeneity and gives a uniform programming model and common services. (Key point: Middleware need)

2. What does the client stub do in RPC?
   A. Unmarshals the parameters at the server
   B. Locates the port mapper's disk
   C. Marshals the parameters into a message and passes it to the RPC runtime
   D. Executes the actual procedure
   Answer: C. The client stub packs parameters (e.g. in XDR); the server stub unmarshals them. (Key point: Client stub)

3. What does the server stub do after unmarshalling?
   A. Sends the result directly without marshalling
   B. Calls the actual procedure, then the result returns the same way
   C. Aborts the call
   D. Asks the client to run the procedure
   Answer: B. The server stub invokes the real procedure and marshals the result back. (Key point: Call flow)

4. How does RPC handle lost messages?
   A. Timeouts with retransmission, giving at-least-once or at-most-once semantics
   B. It ignores lost messages
   C. It shuts down the client
   D. It always guarantees exactly-once execution
   Answer: A. The client blocks, and timeouts with retransmission are used; semantics are normally at-least-once or at-most-once. (Key point: Failure handling)

## Related in Distributed System

- [Reliable client-server communication](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Areliable-client-server) — Distributed System, chapter 9
- [RPC and its communication semantics](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Arpc-semantics) — Distributed System, chapter 2, asked 3×
- [True distributed system; middleware organisation](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Atrue-ds-middleware) — Distributed System, chapter 3
- [Middleware role; CORBA and services](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Amiddleware-corba-services) — Distributed System, chapter 4
- [Distributed object, IDL; RPC vs RMI](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Aobject-idl-rpc-rmi) — Distributed System, chapter 2
- [Object communication; RPC vs RMI](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Aobjects-communicate-rpc-rmi) — Distributed System, chapter 2

## Related in other subjects

- [Client-server versus distributed object architecture](https://www.bctengineer.com/question.md?key=semester_5%2Fsoftware_engineering%3Aclient-server-vs-distributed-object) — Software Engineering, chapter 3
- [Client/server architecture and FTP operation](https://www.bctengineer.com/question.md?key=semester_8%2Finternet_and_intranet%3Aclient-server-ftp) — Internet and Intranet, chapter 3
- [Client-side versus server-side scripting](https://www.bctengineer.com/question.md?key=semester_7%2Fweb_technology%3Aclient-vs-server-side-scripting) — Web Technology, chapter 3, asked 3×
- [Server before client; TCP reliability](https://www.bctengineer.com/question.md?key=semester_7%2Fcomputer_networks_and_security%3Atcp-server-before-client-reliability) — Computer Networks and Security, chapter 5, asked 2×
