IPC Inter-process communication

Source: Internet
Author: User
Tags stub

First, for the IPC, RPC, LPC to make a summary, to provide a context for the later content. I. About the relationship between IPC, RPC, LPC.

IPC is a set of methods for the exchange of data among multiple threads in one or more processes.

Word, in theory, all cross-threading interactions can be called IPC Communications.

IPC is divided into two categories:

LPC: Local procedure call.
RPC: Remote procedure call.
Ii. IPC (inter-process communication)

In computing, inter-process communication (IPC) are a set of methods for the exchange of data among multiple threads in one or more processes. Processes May is running on one or more computers connected by a network. IPC methods is divided into methods for message passing, synchronization, shared memory, and remote procedure calls (RPC) . The method of IPC used may vary based on the bandwidth and latency of communication between the threads, and the type of D ATA being communicated.
In Computers, interprocess communication (IPC) is a series of methods used to exchange data between multiple threads in a process or between processes. These processes may be running on the same computer or in several different computers connected over the network. IPC technology is divided into: messaging, synchronization, shared memory, and remote Procedure call (RPC). The choice of methods for interprocess communication may depend on the bandwidth and latency of the communication between threads, and the type of data being passed.

Advantages and disadvantages of IPC:

Reasons to use IPC Disadvantages of the IPC
Information sharing (information sharing, memory sharing)
Computational speedup (calculation speed)
Modularity (Modular)
Convenience (convenient)
Privilege Separation (Permission separation)


IPC may also is referred to as inter-thread communication and inter-application communication.
IPC may also be used for inter-thread Communication (ITC) and Inter-program communication (IAC?).

The main IPC methods:

Document (file)
Signal Volume (semaphores)
Sockets (Sockets)
Messages Queue (Message Queues)
Pipelines (Pipes: Famous pipes, nameless pipes)
Shared memory
Signals and interrupts (interrupts & signals)

Third, LPC (Local Procedure Call)

Iv. RPC (Remote Procedure Call)
      in Computer science, a remote procedure call (RPC) was an inter-process communication that allows a comp Uter program to cause a subroutine or procedure to execute in another address space (commonly on another computer on a Sha Red network) without the programmer explicitly coding the details for this remote interaction. That is, the programmer writes essentially the same code whether the subroutine are local to the executing program, or Remo Te. When the software in question uses object-oriented principles, RPC is called remote invocation or remote method invocation .
RPC Technology Implementation:
An RPC was initiated by the client, which sends a request message to a known remote server to execute a specified procedure With supplied parameters. The remote server sends a response to the client, and the application continues its process. While the server was processing the call, the client was blocked (it waits until the server has finished processing before r Esuming execution), unless the client sends an asynchronous request to the server, such as a xhttp call. There is many variations and subtleties in various implementations, resulting in a variety of different (incompatible) RP C protocols.
An RPC, initialized by the client and sending a request message to the remote server, requires the server to run a specified procedure and use the parameters provided by the client. The remote server sends a response message to the client, and the program continues to run its process. When the server is processing a call action, the client is blocked (waiting until the server finishes processing before the reply is run), unless the client sends an asynchronous request to the server, such as a xhttp form of invocation. In different RPC implementations, there are various differences and details that eventually form different RPC protocols.
An important difference between remote procedure calls and local calls are that remote calls can fail because of unpredicta BLE network problems. Also, callers generally must deal with such failures without knowing whether the remote procedure was actually invoked. Idempotent procedures (those that has no additional effects if called more than once) is easily handled, but enough diff Iculties remain that code to call remote procedures are often confined to carefully written low-level subsystems.
An important difference between RPC and LPC is that RPC may fail due to unpredictable network problems. Also, callers often have to deal with these failures, although it is not known whether the remote process is actually executed. The process of idempotent (even if called multiple times without additional impact) is very easy to handle, but the harder part is that writing code to invoke remote processes is often limited by carefully designed low-level subsystems.
V. The difference between IPC and RPC


RPC is the process by which a process invokes another process (function), which is a process that passes messages to another process.
RPC is an IPC method, and IPC includes more than just RPC.
RPC is used primarily for client requests to invoke a procedure (method) on the service side and returns the result as a message.


The biggest difference between the
       The biggest difference is this IPC can be presented in any form. It can is in the form of the shared memory, it can is in the form of a byte stream, it can is in the form of messages. IPC is some-to-send information from one process to another. RPC is specifically a-a-on-one thread-to-call a-function that'll be executed by another thread, typically in another Process or even on another machine. RPC is technically a form of IPC. (One-to-processes can communicate with each of the other are by have one process call a procedure in another process.)

Vi. RPC protocol Sequence of events during an RPC (event order for an RPC call procedure)

1, the client calls the client stub. The call was a local procedure call, with parameters pushed on to the stack in the normal.

The client calls the client stub. This call is the LPC local procedure call and uses the normal method to push the parameters into the stack.

2. The client stub packs the parameters into a message and makes a system call to send the message. Packing the parameters is called marshalling.

The client pile packs parameters into a message and uses a system call to pass the message. The packing parameter is called a split-load process.

3, the client ' s local operating system sends the message from the client machine to the server machine.

The client's operating system sends the message from the client machine to the service-side machine.

4. The local operating system on the server machine passes the incoming packets to the server stub.

The operating system of the service-side machine passes the packets sent in to the stub on the server.

5. The server stub unpacks the parameters from the message. Unpacking the parameters is called unmarshalling.

The server stub unpacked the parameters from the message. Unpacking parameters are called unpacking processing.

6. Finally, the server stub calls the server procedure. The reply traces the same steps in the reverse direction.

Finally, the server stub invokes the service-side process. The reply process follows the opposite steps.

Remote Procedure Invocation protocol (Procedure call Protocol)

It is a protocol that requests services from a remote computer program over the network without needing to know the underlying network technology. Mainly used in distributed systems.

RPC is the Client/server model.

Seven, saliva

This article is written in a hurry, some places themselves have not learned very deeply. Sort of a pit, fill it slowly.

In addition, most of the content from the English Wikipedia, translation level general, inevitably wrong, welcome to correct, thank you. Pit ~

To dig a hole again:

IPC Inter-process communication

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.