What is RPC?
RPC, or Remote Procedure Call, is a protocol that allows a computer program to cause a procedure (a subroutine) to execute in another address space (commonly on another computer on a shared network), as if it were a local procedure call, without the programmer needing to explicitly code the details for this remote interaction. Essentially, it's a way for processes to communicate with each other by calling procedures located on other machines.
Key Concepts of RPC
- Transparency: The main idea behind RPC is to make a remote procedure call look as much as possible like a local one. The complexity of the network is hidden from the user.
- Client-Server Model: RPC uses a client-server model where the requesting program is a client, and the service providing the program is the server.
- Stub: A client-side proxy or 'stub' function represents the server-side procedure. When the client invokes the procedure, the stub performs all the steps required to send the procedure's parameters over the network to the server.
How RPC Works
- Call Initiation: The client program calls the client stub procedure, passing parameters in the usual way.
- Parameter Passing: The client stub packs the procedure parameters into a message and makes a system call to send the message. Packing the parameters is known as "marshalling."
- Message Sent: The client's local operating system sends the message to the remote server machine.
- Server Processing: The server's operating system passes the received message to the server stub, which unpacks (unmarshals) the parameters and calls the desired server's procedure using these parameters.
- Response: The server procedure completes and returns to the server stub, which marshals the return values into a message. This message is passed back to the client's stub and operating system, which eventually returns the values to the client program.
RPC in Distributed Systems
- Functionality: RPC is used extensively in distributed systems for inter-process communication, allowing the system to share computational tasks across multiple machines.
- Network Transparency: It abstracts the network's complexity, making the distribution of tasks and services more straightforward for developers.
Variants and Extensions
- Asynchronous RPC: Extends traditional RPC to allow asynchronous operation, where the client doesn’t wait for a response immediately.
- JSON-RPC and XML-RPC: Formats for RPC that use JSON and XML, respectively, to encode the calls and responses, typically over HTTP.
Advantages
- Simplicity: Simplifies the process of executing code on a remote server.
- Abstraction: Provides a high level of abstraction in network programming.
Disadvantages
- Complexity in Error Handling: Error handling can be more complex compared to local procedure calls.
- Network Reliability and Latency: Depends on network reliability and can be impacted by network latency.
Conclusion
RPC is a powerful tool in network programming, especially in the context of distributed systems, where it facilitates the execution of processes on remote machines, providing a seamless and efficient method for remote interaction.
CONTRIBUTOR

Arslan Ahmad
ex-FAANG engineering manager and author or Grokking series.
-
GET YOUR FREE
Coding Questions Catalog
Boost your coding skills with our essential coding questions catalog.
Take a step towards a better tech career now!
Explore Answers
What is online technical assessment?
What are the 5 rules of data normalization?
Best Resources for Mastering Advanced System Design Concepts
Looking to master advanced system design? Explore the best books, courses, blogs, and practice platforms to build scalable systems.
Which Cloudflare interview questions to prepare?
What is the hardest part of becoming a software engineer?
What is the goal of a behavioral interview?
Related Courses
New

Grokking the AI System Design Interview
Learn to design AI systems the way interviewers expect: classic ML products, LLM and RAG architectures, and agentic systems, all through the lens of the system design interview.
4.6
(3,192 learners)
$123

Grokking the Coding Interview: Patterns for Coding Questions
The 24 essential patterns behind every coding interview question. Available in Java, Python, JavaScript, C++, C#, and Go. The most comprehensive coding interview course with 543 lessons. A smarter alternative to grinding LeetCode.
4.6
$197

Grokking Modern AI Fundamentals
Master the fundamentals of AI today to lead the tech revolution of tomorrow.
4.1
$72
One-Stop Portal For Tech Interviews.
Copyright © 2026 Design Gurus, LLC. All rights reserved.