Inter-process communication method and device

By mapping target memory files in the host and container separately, and transmitting target file descriptors using domain sockets, the problem of poor communication performance between container and host processes is solved, and high-performance memory sharing and communication is achieved.

CN120066815APending Publication Date: 2025-05-30SHENZHEN HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411985188.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-27
Publication Date
2025-05-30

AI Technical Summary

Technical Problem

The prior art is difficult to realize high-performance communication between processes in containers and processes in hosts, because the shared memory of the host and the shared memory of the containers are independent of each other and cannot directly access each other's memory.

Method used

Memory mapping and communication between processes in the container and processes in the host are achieved by mapping target memory files separately in the host and container, and transmitting target file descriptors using domain sockets.

Benefits of technology

High-performance communication between processes in containers and processes in hosts is implemented, avoiding the poor performance and complexity of traditional network socket communications, and does not require restarting the container or using specific kernel modules.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120066815A_ABST
    Figure CN120066815A_ABST
Patent Text Reader

Abstract

The invention discloses an inter-process communication method and device, and relates to the technical field of computers. In the method, a first process in a host machine maps a shared memory file to a virtual address space of the first process, and sends a file description of the memory file to a second process in a first container through a domain socket, and then the second process maps the memory file to a virtual address space of the second process according to a file descriptor. The first virtual address space and the second virtual address space are mapped to the target memory, so that the target memory file is mapped to the target memory by the first process and the second process, and the first process and the second process can access the memory space, mapped to the target memory, of the target memory file; therefore, the second process in the first container and the first process in the host machine can perform high-performance communication through the target memory.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular, to an inter-process communication method and apparatus. Background Art

[0002] Inter-process communication (IPC) refers to communication between different processes. Currently, since the virtual address spaces of each process are independent of each other and cannot access each other's memory, different processes within the same host usually communicate through shared memory. However, since the shared memory of the host and the shared memory of the container are independent of each other, that is, the host cannot see the shared memory of the container, and the container cannot see the shared memory of the host, processes in the container and processes in the host cannot communicate through shared memory.

[0003] Therefore, how to implement communication between processes in the container and processes in the host has become a technical problem that urgently needs to be solved. Summary of the Invention

[0004] This application provides an inter-process communication method and apparatus, which can implement communication between processes in the container and processes in the host.

[0005] In a first aspect, an inter-process communication method is provided. The method includes: a first process in the host maps a target memory file to a first virtual address space of the first process and obtains a target file descriptor of the target memory file; the first process in the host sends the target file descriptor to a second process in a first container through a first domain socket; the second process in the first container maps the target memory file indicated by the received target file descriptor to a second virtual address space of the second process; the second process in the first container and the first process in the host communicate through the target memory, where the target memory is the memory mapped by the first virtual address space and the second virtual address space.

[0006] In the above solution, since the first process in the host maps the target memory file to the first virtual address space of the first process, and the second process in the first container maps the target memory file to the second virtual address space of the second process, and both the first virtual address space and the second virtual address space are mapped to the target memory, therefore, both the first process in the host and the second process in the first container map the target memory file to the target memory, so that the second process in the first container and the first process in the host can both directly access the memory space where the target memory file is mapped on the target memory, and further enables the second process in the first container and the first process in the host to communicate through the target memory. In addition, since the read and write performance of the memory is relatively high, therefore, this solution also realizes high-performance communication between the processes in the container and the processes in the host.

[0007] In a possible implementation, the first process in the host sends the target file descriptor to the second process in the first container through the first domain socket, including: the first process in the host creates the first domain socket under the directory of the main process of the first container; wherein, the directory of the main process of the first container is located in the kernel file system of the host; the first process in the host sends the target file descriptor to the second process in the first container through the first domain socket.

[0008] In the implementation, by creating the first domain socket under the directory of the main process of the first container, each process (such as the second process) in the first container that needs to communicate with the process in the host can detect the first domain socket, and further realizes that only by creating one domain socket, it can transmit the target file descriptor to each process in the first container that needs to communicate with the process in the host through the domain socket.

[0009] In another possible implementation, the first process in the host sends the target file descriptor to the second process in the first container through the first domain socket, including: the first process in the host creates the server side of the first domain socket and binds the server side of the first domain socket to the file of the first domain socket; the second process in the first container, in response to detecting the file of the first domain socket, creates the client side of the first domain socket and binds the client side of the first domain socket to the file of the first domain socket; the client side of the first domain socket sends a fetch request to the server side of the first domain socket, and the fetch request is used to request to obtain the file descriptor; the server side of the first domain socket, in response to receiving the fetch request, sends the target file descriptor to the client side of the first domain socket.

[0010] In another possible implementation, the first process in the host creates the server side of the domain socket, including: the first process in the host creates a target thread, and the target thread is the server side of the first domain socket.

[0011] In this implementation, the first process in the host creates a separate target thread as the server, so that the acquisition requests sent by the client of the first socket can be monitored through the separate target thread. In this way, it helps to avoid the domain socket communication from occupying the entire first process, and thus helps to avoid affecting other tasks being executed by the first process.

[0012] In another possible implementation, the method further includes: the first process in the host sends a target file descriptor to the third process in the second container through a second domain socket; the third process in the second container maps the target memory file indicated by the target file descriptor to the third virtual address space of the third process according to the received target file description; the third process in the second container communicates with the second process in the first container through the target memory, and the target memory is the memory mapped by the third virtual address space.

[0013] In this implementation, the process in the host sends a target file description to the third process in the second container, so that different containers can communicate through the target memory file, thereby achieving high-performance communication between different containers through the memory where the target memory file is located.

[0014] In a second aspect, a process intercommunication device is provided, and the device includes: functional units for performing the functions of any one of the methods provided in the first aspect, and the actions performed by each functional unit are implemented by hardware or by hardware executing corresponding software. For example, the process intercommunication device includes a first communication module and a second communication module; the first communication module is used to map the target memory file to the first virtual address space of the first process in the host and obtain the target file descriptor of the target memory file; the first communication module is further used to send the target file descriptor to the second process in the first container through the first domain socket; the second communication module is used to map the target memory file indicated by the target file descriptor to the second virtual address space of the second process in the first container according to the received target file descriptor; wherein, the second process in the first container communicates with the first process in the host through the target memory, and the target memory is the memory mapped by the first virtual address space and the second virtual address space.

[0015] In a third aspect, a processor is provided, and the processor can be used to execute any one of the methods provided in the first aspect above.

[0016] In a fourth aspect, a chip is provided, including: a processor and a power supply circuit; the power supply circuit can be used to supply power to the chip; the processor can be used to execute any one of the methods provided in the first aspect above.

[0017] In a fifth aspect, a computing device is provided, including: a processor, a memory, and a computer program / instructions stored on the memory; the processor executes the computer program / instructions to cause the computing device to execute any one of the methods provided in the first aspect above.

[0018] In a sixth aspect, a computing device cluster is provided, including: at least one computing device, and each computing device in the at least one computing device includes a processor, a memory, and a computer program / instructions stored on the memory; the processor of each computing device executes the computer program / instructions to cause the computing device cluster to implement any one of the methods provided in the first aspect above.

[0019] In a seventh aspect, a computer program product is provided, the computer program product includes computer program / instructions, and when the computer program / instructions are executed by a computing device, any one of the methods provided in the first aspect above is implemented.

[0020] In an eighth aspect, a computer-readable storage medium is provided, on which computer program / instructions are stored, and when the computer program / instructions are executed by a computing device, any one of the methods provided in the first aspect above is implemented.

[0021] Among them, for the technical effects brought by any implementation manner in the second aspect to the eighth aspect, reference can be made to the technical effects brought by different implementation manners in the first aspect above, which will not be elaborated here. Description of the Drawings

[0022] Figure 1 A schematic diagram of a related technology provided by an embodiment of the present application;

[0023] Figure 2 A schematic diagram of a system architecture provided by an embodiment of the present application;

[0024] Figure 3 A schematic diagram of a system architecture provided by an embodiment of the present application;

[0025] Figure 4 A schematic diagram of a system architecture provided by an embodiment of the present application;

[0026] Figure 5 A flowchart of an inter-process communication method provided by an embodiment of the present application;

[0027] Figure 6 A schematic diagram of an inter-process communication provided by an embodiment of the present application;

[0028] Figure 7 A schematic diagram of an inter-process communication device provided by an embodiment of the present application;

[0029] Figure 8Schematic diagram of a computing device provided by an embodiment of the present application;

[0030] Figure 9 Schematic diagram of a computing device cluster provided by an embodiment of the present application;

[0031] Figure 10 Schematic diagram of the connection of a computing device provided by an embodiment of the present application. Detailed implementation manners

[0032] For ease of understanding, first, an explanation of the understanding of some terms related to the embodiments of the present application will be given.

[0033] In the embodiments of the present application, the terms used are only for describing specific embodiments and are not intended to limit the present application. As used in the specification and appended claims of the present application, the singular forms "a", "an", "the", "above-mentioned", "said", and "this" are intended to include forms such as "one or more", unless there is a clear contrary indication in the context. It should also be understood that in the following embodiments of the present application, "at least one" and "one or more" mean one or more than two (including two).

[0034] References to "one embodiment" or "some embodiments" etc. described in this specification mean that specific features, structures, or characteristics described in connection with that embodiment are included in one or more embodiments of the present application. Thus, statements such as "in one embodiment", "in some embodiments", "in other some embodiments", "in still other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "include", "comprise", "have" and their variants all mean "including but not limited to", unless otherwise specifically emphasized in other ways. The term "connection" includes direct connection and indirect connection, unless otherwise stated. "First" and "second" are only used for descriptive purposes and cannot be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features.

[0035] In the embodiments of the present application, words such as "exemplarily" or "for example" are used to represent examples, illustrations, or explanations. Any embodiment or design described as "exemplarily" or "for example" in the embodiments of the present application should not be construed as being more preferred or having more advantages than other embodiments or designs. Rather, the use of words such as "exemplarily" or "for example" is intended to present relevant concepts in a specific manner.

[0036] First, an exemplary introduction to the relevant terms related to the embodiments of the present application will be given.

[0037] Socket: It is an endpoint for applications on different hosts in a network to communicate. A socket can send and receive data through the network protocol stack and is an interface between the application and the network protocol stack. Among them, a socket that communicates through the network protocol stack can also be called a network socket.

[0038] Domain Socket: It is used to implement inter-process communication on the same host and can also be called an IPC socket. When processes on the same host communicate through a domain socket, they do not need to perform a series of operations such as warning the network protocol stack, and only need to copy the application layer data from one process to another.

[0039] Container: It is a virtualization technology in a computer operating system and can be used to encapsulate and isolate the running environments of different applications. By packaging an application and its dependent environment into a lightweight and portable container, the container can achieve process-level resource isolation and limitation while sharing the operating system kernel of the host, thus providing a consistent running environment.

[0040] Shared Memory (SHM): It is an inter-process communication mechanism that allows multiple processes to access the same memory area. Since processes can directly access the same memory, the data for interaction does not need to be copied between processes.

[0041] Temporary File System (TMPFS): It is a memory-based file system, also known as a memory file system, which reads and writes to the file system through memory. Among them, TMPFS can include / dev / shm / , etc.

[0042] Exemplarily, TMPFS can provide a Portable Operating System Interface of Unix (POSIX) shared memory and a System V (SYS V) shared memory, both of which are kernels.

[0043] File Descriptor (FD): It is a non-negative integer used to identify and access files, devices, or other I / O resources opened in the operating system. The essence of a file descriptor is an index value used to quickly locate and operate the corresponding file, device, or other I / O resources.

[0044] Next, the technical solutions provided by the embodiments of the present application will be introduced in detail with reference to the accompanying drawings.

[0045] Inter-process communication (IPC) refers to the communication between different processes. Currently, since the virtual address spaces of each process are independent of each other and cannot access each other's memory, different processes within the same host usually communicate through shared memory. However, since the shared memory of the host and the shared memory of the container are independent of each other, that is, the host cannot see the shared memory of the container, and the container cannot see the shared memory of the host, processes in the container and processes in the host cannot communicate through shared memory. To enable communication between processes in the container and processes in the host, various solutions have been provided in related technologies.

[0046] In the first solution provided by related technologies, the container is restarted so that when the container starts, the host's directory is mounted into the container, thereby enabling communication between processes in the container and processes in the host through the host's directory, such as file sharing, data exchange, etc. However, restarting the container not only changes the existing running environment of the container but also causes the services running in the container to be interrupted and restarted. Moreover, this solution cannot be applied to containers running highly available services.

[0047] In the second solution provided by related technologies, as Figure 1 shown, a process in the host establishes a network socket, and a process in the container establishes a network socket. Then, by establishing a network socket connection between the process in the container and the process in the host, for example, establishing a Transmission Control Protocol / Internet Protocol (TCP / IP) socket connection, the process in the container and the process in the host can communicate through the network data channel of the network socket, such as realizing data interaction and transfer. However, communicating through network sockets requires passing through the network protocol stack. Since the communication overhead through the network protocol stack is relatively large, the communication performance between the process in the container and the process in the host is relatively low. In addition, communicating through network sockets also involves issues such as network security and firewall configuration, increasing the complexity and maintenance cost of communication. Moreover, communicating through network sockets requires modifying the architecture according to the scenario, resulting in a relatively large change in the architecture. In this way, not only is the modification of the architecture quite complex, increasing the complexity of communication, but it also leads to chaos in the architecture in different scenarios. In addition, communicating through network domain sockets will seriously affect the communication performance between the process in the host and the process in the container, resulting in poor communication performance between the process in the host and the process in the container.

[0048] In the third solution provided by the related technology, by developing a specific kernel module and deploying the specific kernel module on the host, the specific kernel module acts as a block device on the host and is loaded into the kernel of the operating system for dynamic memory allocation (memory allocation, malloc). After that, the container and the host respectively mount the block device and map the block device to the virtual address space of the process, so that the processes in the container and the host communicate through the block device. However, developing a specific kernel module not only has a long development cycle and requires a relatively high technical threshold, but also the specific kernel module will affect the stability and security of the operating system. In addition, an incorrect kernel module may also cause the operating system to crash, increasing the difficulty of system maintenance and debugging. In addition, the update and compatibility of the specific kernel module also need to be considered. In addition, the specific kernel module has a high dependence on the kernel of the operating system, which results in the need to include the specific kernel module every time the operating system is released, and also makes the installation of the operating system complex, resulting in poor usability and technical maintainability of the operating system. Therefore, the implementation difficulty is relatively high.

[0049] Therefore, how to achieve high-performance communication between the processes in the container and the processes in the host has become a technical problem that urgently needs to be solved.

[0050] In view of this, an embodiment of the present application provides an inter-process communication method. In this method, a first process in the host maps a target memory file to a first virtual address space of the first process, and sends a target file descriptor of the obtained target memory file to a second process in a first container. The second process in the first container maps the target memory file indicated by the received target file descriptor to a second virtual address space of the second process. After that, the second process in the first container and the first process in the host communicate through the target memory, and the target memory is the memory mapped by the first virtual address space and the second virtual address space.

[0051] Since the first process in the host maps the target memory file to the first virtual address space of the first process, and the second process in the first container maps the target memory file to the second virtual address space of the second process, and both the first virtual address space and the second virtual address space are mapped to the target memory, therefore, both the first process in the host and the second process in the first container map the target memory file to the target memory, so that both the second process in the first container and the first process in the host can directly access the memory space where the target memory file is mapped in the target memory, and further enables the second process in the first container and the first process in the host to communicate through the target memory. In addition, since the read and write performance of the memory is relatively high, this solution also realizes high-performance communication between the processes in the container and the processes in the host.

[0052] In addition, since there is no need to restart the container, the technical problems existing in the first solution provided by the related art are solved. For example, not only can the existing running environment of the container be avoided from being changed, but also the interruption of the services running in the container and the restart of the services can be avoided. Additionally, since there is no need to communicate through network sockets, the technical problems existing in the second solution provided by the related art are solved. For example, not only can the communication performance be improved, but also the network security and firewall configuration involved in the communication process can be avoided. Moreover, since there is no need to use specific kernel modules, the technical problems existing in the second solution provided by the related art are solved. For example, not only the long development cycle and high technical threshold are avoided, but also the stability and security of the operating system are not affected.

[0053] It should be noted that, regarding the above-mentioned various implementation manners of inter-process communication, they will be introduced in the Figure 5 embodiments shown and will not be elaborated here for the time being.

[0054] Next, the system architecture related to the technical solution provided by the embodiments of the present application will be further introduced with reference to the accompanying drawings.

[0055] The embodiments of the present application provide a computing device applicable to the above-mentioned inter-process communication method, and at least one container is deployed on the computing device.

[0056] It should be noted that, in the embodiments of the present application, at least one may include one or more, and multiple may be two or more.

[0057] It should be noted that the embodiments of the present application do not limit the type of the operating system of the computing device, as long as it supports domain sockets. For example, it may be a Unix operating system or the like.

[0058] In the embodiments of the present application, the computing device further includes a target memory. The computing device may create a kernel file system (such as a proc file system, etc.) and a memory file system (such as a TMPFS, etc.) on the target memory.

[0059] Exemplarily, the target memory may be a random access memory, a dual in-line memory module, a dual inline memory module (DIMM), etc. Among them, the random access memory may be a dynamic random access memory (DRAM), a storage class memory (SCM), or a static random access memory (SRAM).

[0060] It should be noted that the embodiments of the present application do not limit the type of the target memory, and the above is only an exemplary illustration. In addition, the embodiments of the present application do not limit the number of target memories included in the computing device.

[0061] In the embodiments of the present application, a process in a container on a computing device can achieve high-performance communication with a process in a host through the inter-process communication method provided by the embodiments of the present application. Among them, the host includes at least one of a physical machine or a virtual machine.

[0062] Example 1, the host includes a physical machine, that is to say, the host includes the physical machine of the computing device. As Figure 1 shown, the process a running on the processor of the computing device can communicate with the process b in the container through the inter-process communication method provided by the embodiments of the present application. After the computing device is started, a kernel file system, a memory file system, etc. can be established on the target memory.

[0063] Exemplarily, the processor can be a unit with computing capabilities such as a central processing unit (CPU), a graphics processing unit (GPU), a data processing unit (DPU), and a neural-network processing unit (NPU). In addition, the processor can also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), system on chip (SOC), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor can be a microprocessor or any conventional processor, etc.

[0064] It should be noted that the embodiments of the present application do not limit the specific form of the processor, and the above is only an exemplary illustration. In addition, the embodiments of the present application do not limit the number of processors included in the computing device.

[0065] Example 2, the host includes a virtual machine deployed on the computing device. As Figure 3 shown, the process c in the virtual machine can communicate with the process b in the container through the inter-process communication method provided by the embodiments of the present application.

[0066] It should be noted that for other relevant descriptions of Example 2, reference can be made to the descriptions of Example 1 above, and details will not be elaborated here.

[0067] Example 3: The host computer includes a computing device and a virtual machine deployed on the computing device. As Figure 4 shown, both the process a running on the processor of the computing device and the process c in the virtual machine can communicate with the process b in the container through the inter-process communication method provided by the embodiments of the present application. In addition, the process a running on the processor of the computing device and the process c in the virtual machine can also communicate through the inter-process communication method provided by the embodiments of the present application.

[0068] It should be noted that for other relevant descriptions of Example 3, reference can be made to the descriptions of Example 1 and Example 2 above, and details will not be elaborated here.

[0069] Optionally, the computing device can be a terminal device or a network device, etc.

[0070] Among them, the terminal device can include an ultra-mobile personal computer (UMPC), a laptop computer, a netbook, a desktop computer, an all-in-one computer, etc.

[0071] It should be noted that the present application does not limit the device form of the terminal device, and the above is only an exemplary description.

[0072] Among them, the network device can include a server, a bare metal server, etc. The server can be a physical server, or it can also be two or more physical servers sharing different responsibilities and cooperating with each other to implement the various functions of the server. Exemplarily, the server can be a blade server, a high-density server, a rack server, or a tower server, etc.

[0073] It should be noted that the present application does not limit the device form of the network device, and the above is only an exemplary description.

[0074] Optionally, the computing device in the embodiments of the present application can be a device in the infrastructure providing cloud services. Among them, the cloud services provided by the infrastructure can include the inter-process communication method provided by the embodiments of the present application. Exemplarily, the cloud service platform can be a Public Cloud, a Private Cloud, a Hybrid Cloud, etc.

[0075] Exemplarily, the user can communicate with at least one computing device on the cloud service platform through an electronic device to instruct the computing device on the cloud service platform to execute the data query method provided by the present application.

[0076] Optionally, the computing device provided in the embodiments of the present application may be a computing device in a local data center. The data processing services provided by the data center may include the inter-process communication method provided in the embodiments of the present application.

[0077] The embodiments of the present application also provide a target software program. The computing device can implement the inter-process communication method provided by the present application by running the target software program.

[0078] It should be noted that the embodiments of the present application do not limit the name of the target software program.

[0079] In one example, the target software program may be a software program only for implementing the inter-process communication method provided by the present application.

[0080] In another example, the target software program may be a multi-functional software. For example, the target software may be end-side security software in a container scenario, data reading software for obtaining data in a container, etc.

[0081] It should be noted that Figures 2 to 4 The system architecture shown is only for illustrative purposes and does not constitute a limitation on the system architecture for applying the inter-process communication method provided in the embodiments of the present application.

[0082] It should be noted that the system architecture and application scenarios described in the present application are for more clearly explaining the technical solutions of the present application and do not constitute a limitation on the technical solutions provided by the present application. Those of ordinary skill in the art know that with the evolution of the system architecture and the emergence of new application scenarios, the technical solutions provided by the present application are equally applicable to similar technical problems.

[0083] For ease of understanding, the inter-process communication method provided by the present application is introduced exemplarily below in combination with the above system architecture and the accompanying drawings.

[0084] Figure 5 It is a flowchart of an inter-process communication method provided in the embodiments of the present application. Exemplarily, the inter-process communication method may include the following steps 501-step 505. Among them, the "step" in the embodiments of the present application can be abbreviated as "S", and will not be elaborated hereinafter.

[0085] Exemplarily, hereinafter, in combination with Figures 2 to 4 the system architecture shown, the embodiments of the present application are described exemplarily.

[0086] In the embodiments of the present application, by using the system capability of domain sockets to send special control information (e.g., file descriptors) across processes, a process (e.g., the first process) in the host is used as the server, and the file descriptor of the memory file to be shared (e.g., the target file descriptor) is sent to a process in the container (e.g., the second process). The process in the container acts as the client to receive the file descriptor, and based on the file descriptor, maps the memory file indicated by the file descriptor to the virtual address space of the process in the container, so that the process in the container can operate the memory space mapped by the memory file simultaneously with the process in the host when the memory file is originally invisible to the process in the container.

[0087] Among them, the capability of domain sockets is the capability of the kernel of the operating system and has nothing to do with container technology. File descriptors are managed by the kernel of the operating system. Since the container and the host share the kernel of the operating system, after the process in the container receives the file descriptor sent by the process in the host, it can perform memory mapping (memory map, MMAP) without being visible to the memory file indicated by the file descriptor, that is, map the memory file indicated by the file descriptor to the virtual address space of the process in the container.

[0088] S501: The first process in the host maps the target memory file to the first virtual address space of the first process.

[0089] Exemplarily, after the target software program is installed on the host, the host creates at least one memory file through the memory file system (e.g., / dev / shm / ). Among them, this memory file can also be called a shared memory file.

[0090] Exemplarily, the at least one memory file includes a target memory file, and the target memory file can be any one of the at least one memory files. Hereinafter, taking the target memory file as an example, the embodiments of the present application are described exemplarily.

[0091] For the sake of convenience of description, hereinafter, the process (Process, Proc) in the host is called the host process, and it will not be elaborated hereinafter.

[0092] Exemplarily, at least one host process runs in the host, and among them, the at least one host process includes a first process, and the first process can be any one of the at least one host processes.

[0093] In the embodiments of the present application, after the first process in the host is started, the operating system allocates a first virtual address space for the first process, and the first virtual address space is mapped to the target memory. Among them, the first virtual address space is mapped to the target memory space of the target memory.

[0094] Exemplarily, the address of the first virtual address space is the first virtual address, and the address of the target memory space is the target physical address, where there is a mapping relationship between the first virtual address and the target physical address. For example, the mapping relationship between the first virtual address and the target physical address is recorded in the page table. In this way, when accessing the target memory through the first virtual address, the target physical address corresponding to the first virtual address can be found through the page table first, and then the target memory space on the target memory can be accessed through the target physical address.

[0095] In the embodiment of the present application, the first process in the host can perform MMAP on the target memory file, so as to map the target memory file to the first virtual address space of the first process. On this basis, the first process in the host can obtain the virtual address of the target memory file mapped in the first virtual address space, so as to access the target memory space on the target memory through the virtual address of the target memory file mapped in the first virtual address space. Exemplarily,

[0096] Exemplarily, the address of the target memory file mapped in the first virtual address space is the third virtual address, and there is a mapping relationship between the third virtual address and the third physical address. The third physical address is the address of the third memory space on the target memory. Then, the first process can access the third memory space through the third virtual address. Among them, the target memory space includes the third memory space.

[0097] Exemplarily, as Figure 6 shown, the first virtual address space is mapped on the target memory. After the first process maps the target memory file to the first virtual address space, the target memory provides a memory data channel for the first process, so that the first process can access the first memory space on the target memory through this memory data channel.

[0098] S502: The first process in the host obtains the target file descriptor of the target memory file.

[0099] In the embodiment of the present application, the first process in the host can obtain the target file descriptor of the target memory file.

[0100] In one example, when the first process in the host performs MMAP on the target memory file, it can receive the target file descriptor returned by the kernel of the operating system, so as to obtain the target file descriptor of the target memory file.

[0101] In another example, when the first process in the host performs an open operation on the target memory file, it can receive the target file descriptor returned by the kernel of the operating system, so as to obtain the target file descriptor of the target memory file.

[0102] It should be noted that the embodiments of the present application do not limit the manner in which the first process in the host obtains the target file descriptor. The above is only an exemplary illustration.

[0103] It should be noted that the embodiments of the present application do not limit the execution order of S501 and S502. The above is only an exemplary illustration.

[0104] S503: The first process in the host sends the target file descriptor to the second process in the first container through the first domain socket.

[0105] In the embodiments of the present application, after the first process in the host obtains the target file descriptor, it sends the target file descriptor to the second process in the first container through the first domain socket.

[0106] Optionally, S503 may include the following S1 - S5.

[0107] S1: The first process in the host creates a first domain socket in the directory of the main process of the first container. Wherein, the directory of the main process of the first container is located in the kernel file system of the host.

[0108] In the embodiments of the present application, the main process of the container refers to the process created when the container is started. Exemplarily, when starting the container, the program corresponding to the container will be started according to the definition in the image, and the main process of this program will be used as the main process of the container. For example, when starting the first container, the program corresponding to the first container will be started according to the definition in the image, and the main process of this program will be used as the main process of the first container.

[0109] Exemplarily, at least one container is deployed on the computing device, and the at least one container includes the first container. Among them, the processes in the first container need to communicate with the processes in the host. Hereinafter, taking the first container as an example, the embodiments of the present application will be exemplarily described.

[0110] In the embodiments of the present application, the first process in the host can obtain the process identifier (PID) of the main process of the first container. Then, according to the PID of the main process, determine the directory of the main process in the memory file system (for example, the / proc file system). For example, the directory of the main process is / proc / <pid> / root / , where, / proc / <pid> / root / symbolic link to the root file system that points to the main process, " / proc / <pid>The " / " in " / root / " <pid>”Used to represent the PID of the main process. Subsequently, the first process in the host creates a first domain socket under the directory of the main process, that is, in " / proc / <pid>Create a first domain socket under the directory of " / root / ". After the first process in the host creates a domain socket under the directory of the main process, a file of the first domain socket is generated under the directory of the main process. For example, if the name of the file of the first domain socket is "my_socket", then the path of the file of the first domain socket is / proc / <pid> / root / my_socket。

[0111] Exemplarily, at least one container identifier is stored in the computing device, and the at least one container identifier is used to indicate at least one container that needs to communicate with a process (e.g., the first process) in the host, wherein one container identifier is used to indicate one container. For example, the at least one container identifier includes the identifier of the first container, and the first process in the host obtains the PID of the main process of the first container based on the identifier of the first container.

[0112] Exemplarily, the at least one container identifier includes the identifier of container 1, the identifier of container 2,..., the identifier of container n. Based on this, the first process obtains the PID of the main process 1 of container 1, the PID of the main process 2 of container 2,..., the PID of the main process n of container n. Among them, the PID of the main process 1 is pid1, the PID of the main process 2 is pid2, and the PID of the main process n is pidn. On this basis, the first process can be in " / proc / <pid1>Create domain socket 1 of container 1 under the " / root / " directory, that is, create domain socket 1 of container 1 under the directory of main process 1, where the path of the file of domain socket 1 is / proc / <pid1> / root / my_socket. Based on the same principle, the first process can obtain the files of the domain socket 2 of container 2, ……, the files of the domain socket n of container n.

[0113] Exemplarily, by creating the first domain socket file in the directory of the main process of the first container, the first kernel file in the operating system (i.e., / proc / <pid> / fd) establishes a corresponding relationship (which can also be called a mapping relationship) with the file of the first domain socket. Among them, " / proc / <pid>" / fd" is used to display the file descriptors of a process, and each file descriptor is a symbolic link pointing to an open file. " / proc / <pid> / fd” in " <pid>”Used to indicate the PID of the main process, " / proc / <pid>In " / fd", "fd" is used to indicate the file descriptor of the main process.

[0114] S2: The first process in the host creates a server of the first domain socket and binds the server of the first domain socket to the file of the first domain socket.

[0115] In the embodiment of the present application, the first process in the host can create a server of the first domain socket and bind the server of the first domain socket to the file of the first domain socket, so as to utilize the system feature that the domain socket can send special control information (such as file descriptors) across processes, wait for the connection of the client of the first domain socket, that is, wait for the acquisition request from the client of the first domain socket, and thus, in response to the acquisition request, send the target file descriptor to the client of the first domain socket.

[0116] Exemplarily, as Figure 6 shown, after the first process creates the server, it can bind the server to the files of domain socket 1 of container 1, domain socket 2 of container 2,..., and domain socket n of container n respectively.

[0117] Optionally, the first process in the host creates a target thread. The target thread is a thread in the first process.

[0118] Exemplarily, the first process in the host can create a target thread and use the target thread as the server of the domain socket.

[0119] In this embodiment, the first process creates a target thread and uses the target thread as the server of the domain socket, so as to monitor the communication connection of the domain socket through the target thread. In this way, it can avoid occupying the first process and further avoid affecting the efficiency and performance of the services processed by the first process.

[0120] S3: The second process in the first container creates a client of the first domain socket in response to detecting the file of the first domain socket and binds the client of the first domain socket to the file of the first domain socket.

[0121] Exemplarily, the first container includes at least one process, and the at least one process includes a second process. The second process is the process in the first container that needs to communicate with the process in the host. Hereinafter, taking the second process as an example, the communication process between the process in the first container and the process in the host will be introduced exemplarily.

[0122] In the embodiment of the present application, the process in the container refers to the process created in the container after the container is started. For example, the second process in the first container refers to the process created in the first container after the first container is started.

[0123] In an embodiment of the present application, after the second process of the first container detects that there is a file of the first domain socket in the directory of the main process of the first container, in response to detecting the file of the first domain socket, the second process creates a client of the first domain socket and binds the file of the first domain socket, so as to bind the client of the first domain socket to the file of the first domain socket.

[0124] Exemplarily, after the second process in the first container creates a client of the first domain socket, it can actively connect to the server of the first domain socket to obtain a target file descriptor from the server of the first domain socket. For example, the client of the first domain socket can actively send an acquisition request for requesting to obtain a file descriptor to the server of the first domain socket.

[0125] Exemplarily, as Figure 6 shown, container 1 is the first container. After the second process creates a client, it binds the client to the file of domain socket 1 of container 1 (i.e., the file of the first domain socket).

[0126] S4: The client of the first domain socket sends an acquisition request to the server of the first domain socket. The acquisition request is used to request to obtain a file descriptor.

[0127] In an embodiment of the present application, when the second process in the first container needs to establish a memory data channel (which can also be called a memory communication pipeline), the client of the first domain socket sends an acquisition request to the server of the first domain socket to request to obtain a file descriptor.

[0128] It should be noted that the present application embodiment does not limit the event that triggers the client of the first domain socket to send an acquisition request. The above is only an exemplary illustration.

[0129] S5: In response to the received acquisition request, the server of the first domain socket sends a target file descriptor to the client of the first domain socket.

[0130] In an embodiment of the present application, after the server of the first domain socket receives the acquisition request, in response to the acquisition request, it returns a target file descriptor to the client of the first domain socket. After that, the client of the first domain socket can receive the target file descriptor sent by the server of the first domain socket according to the file of the first domain socket in the directory of the main process, that is, receive the target file descriptor sent by the server of the first domain socket according to the file of the first domain socket in the container namespace.

[0131] In this implementation, the process in the host machine passes through the main process of the container in the directory of the kernel file system (i.e., / proc / <pid> / root / ), a domain socket file visible to both the process in the host and the process in the container is created, so as to realize the transmission of the target file descriptor through the domain socket, which can not only improve the communication performance, but also avoid the network security and firewall configuration involved in the communication process, and avoid increasing the complexity and maintenance cost of the communication, etc.

[0132] S504: The second process in the first container maps the target memory file indicated by the received target file descriptor to the second virtual address space of the second process according to the target file descriptor.

[0133] In the embodiment of the present application, after the second process in the first container is started, the operating system allocates a second virtual address space for the second process, and the second virtual address space is mapped to the target memory. Exemplarily, the second virtual address space is mapped to the target memory space on the target memory.

[0134] Exemplarily, the address of the second virtual address space is the second virtual address, and the address of the target memory space is the target physical address, where there is a mapping relationship between the second virtual address and the target physical address. For example, the mapping relationship between the second virtual address and the target physical address is recorded in the page table. In this way, when accessing the target memory through the second virtual address, the target physical address corresponding to the second virtual address can be found through the page table first, and then the target memory space on the target memory can be accessed through the target physical address.

[0135] In the embodiment of the present application, after the second process in the first container receives the target file descriptor, it maps the target memory file indicated by the target file descriptor to the second virtual address space of the second process according to the target file descriptor. On this basis, the second process in the first container can obtain the virtual address of the target memory file mapped in the second virtual address space, so as to access the target memory space on the target memory through the virtual address of the target memory file mapped in the second virtual address space.

[0136] Exemplarily, the address of the target memory file mapped in the second virtual address space is the fourth virtual address, the fourth virtual address has a mapping relationship with the fourth physical address, and the third physical address is the address of the fourth memory space on the target memory. Then, the first process can access the fourth memory space through the fourth virtual address. Wherein, the target memory space includes the fourth memory space.

[0137] In one example, the fourth physical address is the same as the third physical address. In other words, the fourth memory space is the same as the third memory space, that is, the fourth memory space and the third memory space are the same memory space.

[0138] In another example, the fourth physical address is different from the third physical address. In other words, the fourth memory space is different from the third memory space, that is, the fourth memory space and the third memory space are different memory spaces. Exemplarily, as Figure 6 shown, the second virtual address space is mapped to the target memory. After the second process maps the target memory file to the second virtual address space, the target memory provides a memory data channel for the second process, enabling the second process to access the second memory space on the target memory through this memory data channel. Among them, the memory data channel provided by the target memory for the first process and the second process is the same data channel.

[0139] In the embodiments of the present application, by mapping the target memory file to the second virtual address space of the second process, the first kernel file (i.e., / proc / <pid> / fd) has established a corresponding relationship (which can also be called a mapping relationship) with the target memory file.

[0140] It should be noted that for the relevant description of the first kernel file, reference can be made to the description in S1 above, which will not be elaborated here.

[0141] S505: The second process in the first container and the first process in the host communicate through the target memory.

[0142] Among them, the target memory is the memory mapped by the first virtual address space and the second virtual address space.

[0143] In the embodiment of the present application, after the target memory file is simultaneously mapped to the first virtual address space of the first process and the second virtual address space of the second process, the first process and the second process can communicate with the target memory, so as to realize that the process in the container and the process on the host can operate on the same piece of memory (i.e., the target memory) at the same time, and further realize that the process in the container and the process on the host communicate by performing the same communication operation as the shared memory.

[0144] In the embodiment of the present application, since the first virtual address space of the first process and the second virtual address space of the second process are both mapped to the target memory space on the target memory, in this way, when the first process and the second process map the target memory file to their respective virtual address spaces, the first process and the second process can map the target memory file to the same memory space on the target memory. On this basis, both the first process and the second process can access the memory space mapped by the target memory file, so that they can communicate through the memory space mapped by the target memory file. For example, the first process writes data 1 to the memory space mapped by the target memory file, and the second process can read data 1 from the memory space mapped by the target memory file.

[0145] In the above solution, since the first process in the host maps the target memory file to the first virtual address space of the first process, and the second process in the first container maps the target memory file to the second virtual address space of the second process, and both the first virtual address space and the second virtual address space are mapped to the target memory, therefore, the first process in the host and the second process in the first container both map the target memory file to the target memory, so that the second process in the first container and the first process in the host can both directly access the memory space mapped by the target memory file on the target memory, and further enable the second process in the first container and the first process in the host to communicate through the target memory. In addition, since the read and write performance of the memory is relatively high, this solution also realizes high-performance communication between the process in the container and the process in the host.

[0146] The inter-process communication method provided by the embodiments of this application utilizes the underlying capabilities provided by the operating system, that is, the ability of domain sockets to send file descriptors across processes. It establishes a domain socket with the process in the host as the server and sends the file descriptor of the memory file to the process in the container as the client for memory mapping and use. By applying the basic capabilities of the underlying operating system, it not only breaks through the limitations of the traditional communication scheme between the container and the host, but also has a simple implementation dependency. Since it is essentially still shared memory communication, high-performance communication between the process in the container and the process in the host is achieved, that is, efficient cross-process communication is achieved.

[0147] Optionally, the inter-process communication may further include the following S6 - S8. Through S6 - S8, the second process in the first container and the third process in the second container can communicate through the inter-process communication method provided by the embodiments of this application.

[0148] S6: The first process in the host sends a target file descriptor to the third process in the second container through a second domain socket.

[0149] S7: The third process in the second container maps the target memory file indicated by the received target file descriptor to the third virtual address space of the third process.

[0150] S8: The third process in the second container and the second process in the first container communicate through the target memory.

[0151] It should be noted that for the relevant descriptions of S6 - S8, reference can be made to the descriptions of S501 - S505 above, and details will not be elaborated here.

[0152] In the above embodiments, by setting the target memory file indicated by the target file descriptor to be mapped to the third virtual address space of the third process in the second container, the second process in the first container and the third process in the second container can both directly access the memory space where the target memory file is mapped on the target memory, and further the second process in the first container and the third process in the second container can communicate through the target memory. In addition, since the read and write performance of the memory is high, this solution also realizes high-performance communication between different processes in different containers.

[0153] In addition, it also enables different processes in different containers and the processes on the host to operate on the same piece of memory simultaneously, so that the processes on the host can communicate with different processes in different containers through the target memory with high performance.

[0154] The above mainly introduced the solution provided by the embodiments of the present application from the perspective of methods. To implement the above functions, the inter-process communication device includes the corresponding hardware structures and / or software modules for executing each function. Those skilled in the art should easily realize that, combining the units and algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed in the way of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.

[0155] According to the above method, the embodiments of the present application can exemplarily divide the functional modules of the inter-process communication device. For example, the inter-process communication device may include each functional module corresponding to each function division, or two or more functions may be integrated into one processing module. The above integrated module can be implemented in the form of hardware or in the form of a software functional module. It should be noted that the division of modules in the embodiments of the present application is illustrative, only a logical function division, and there may be other division methods in actual implementation.

[0156] Exemplarily, Figure 7 shows a possible schematic diagram of the inter-process communication device (i.e., the inter-process communication device 700) involved in the above embodiments. The actions performed by the inter-process communication device 700 can be executed by a computing device or implemented by a computing device executing corresponding software. The inter-process communication device 700 may include: a first communication module 701 and a second communication module 702; the first communication module 701 is used to map a target memory file to the first virtual address space of the first process in the host and obtain the target file descriptor of the target memory file. For example, as Figure 5 shown in S501. The first communication module 701 is further used to send the target file descriptor to the second process in the first container through the first domain socket. For example. As Figure 5 shown in S502. The second communication module 702 is used to map the target memory file indicated by the target file descriptor to the second virtual address space of the second process in the first container according to the received target file descriptor. For example, as Figure 5 shown in S503. Wherein, the second process in the first container communicates with the first process in the host through the target memory, and the target memory is the memory mapped by the first virtual address space and the second virtual address space.

[0157] Optionally, the first communication module 701 is specifically configured to: create a first domain socket in the directory of the main process of the first container; wherein, the directory of the main process of the first container is located in the kernel file system of the host machine; and send a target file descriptor to a second process in the first container through the first domain socket.

[0158] Optionally, the first communication module 701 is specifically configured to: create a server side of the first domain socket and bind the server side of the first domain socket to the file of the first domain socket; the second communication module 702 is further configured to: in response to detecting the file of the first domain socket, create a client side of the first domain socket; wherein, the client side of the first domain socket is used to send a fetch request to the server side of the first domain socket, and the fetch request is used to request to fetch a file descriptor; the server side of the first domain socket is used to, in response to receiving the fetch request, send a target file descriptor to the client side of the first domain socket.

[0159] Optionally, the first communication module 701 is specifically configured to: create a target thread of the first process, and the target thread is the server side of the first domain socket.

[0160] Optionally, the inter-process communication device 700 further includes a third communication module 703; the first communication module 701 is further configured to send a target file descriptor to a third process in a second container through a second domain socket; the third communication module 703 is configured to, according to the received target file description, map a target memory file indicated by the target file descriptor to a third virtual address space of the third process; wherein, the third process in the second container and the second process in the first container communicate through the target memory, and the target memory is the memory mapped by the third virtual address space.

[0161] For the specific descriptions of the above optional manners, reference may be made to the foregoing method embodiments, which will not be elaborated herein. In addition, the explanations and beneficial effects descriptions of any of the above provided inter-process communication devices 700 may refer to the corresponding method embodiments above, which will not be elaborated.

[0162] In this application, the first communication module 701, the second communication module 702, and the third communication module 703 may all be implemented by software or may be implemented by hardware. Exemplarily, next, taking the first communication module 701 as an example, the implementation manner of the first communication module 701 will be introduced. Similarly, the implementation manners of the second communication module 702 and the third communication module 703 may refer to the implementation manner of the first communication module 701.

[0163] As an example of a software functional unit, the first communication module 701 may include code running on a computing instance. The computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Further, the computing instance may be one or more. For example, the first communication module 701 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers for running the code may be distributed in the same region or in different regions. Further, the multiple hosts / virtual machines / containers for running the code may be distributed in the same availability zone (AZ) or in different AZs, and each AZ includes one data center or multiple geographically proximate data centers. Usually, one region may include multiple AZs.

[0164] Similarly, the multiple hosts / virtual machines / containers for running the code may be distributed in the same virtual private cloud (VPC) or in multiple VPCs. Usually, one VPC is set up within one region. For cross-region communication between two VPCs within the same region and between VPCs in different regions, a communication gateway needs to be set up in each VPC, and the interconnection between VPCs is realized through the communication gateway.

[0165] As an example of a hardware functional unit, the first communication module 701 may include at least one computing device, such as a server. Alternatively, the first communication module 701 may also be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be implemented by a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.

[0166] The multiple computing devices included in the first communication module 701 can be distributed in the same region or in different regions. The multiple computing devices included in the first communication module 701 can be distributed in the same availability zone (AZ) or in different AZs. Similarly, the multiple computing devices included in the first communication module 701 can be distributed in the same virtual private cloud (VPC) or in multiple VPCs. Among them, the multiple computing devices can be any combination of computing devices such as servers, application-specific integrated circuits (ASICs), programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), and generic array logic (GALs).

[0167] It should be noted that in other embodiments, the first communication module 701 can be used to execute any step in the inter-process communication method, the second communication module 702 can be used to execute any step in the inter-process communication method, and the third communication module 703 can be used to execute any step in the inter-process communication method. The steps implemented by the first communication module 701, the second communication module 702, and the third communication module 703 can be specified as needed. By implementing different steps in the inter-process communication method through the first communication module 701, the second communication module 702, and the third communication module 703 respectively, all functions of the data storage device can be realized.

[0168] This application also provides a computing device 800. As Figure 8 shown, the computing device 800 includes: a bus 802, a processor 804, a memory 806, and a communication interface 808. The processor 804, the memory 806, and the communication interface 808 communicate with each other through the bus 802. The computing device 800 can be a server or a terminal device. It should be understood that this application does not limit the number of processors and memories in the computing device 800.

[0169] The bus 802 can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of simplicity of representation, Figure 8 only one line is shown here, but it does not mean that there is only one bus or one type of bus. The bus 802 can include a path for transmitting information between various components of the computing device 800 (for example, the memory 806, the processor 804, and the communication interface 808).

[0170] The processor 804 may include any one or more of processors such as a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).

[0171] The memory 806 may include volatile memory, such as random access memory (RAM). The processor 804 may also include non-volatile memory, such as read-only memory (ROM), flash memory, a hard disk drive (HDD), or a solid state drive (SSD).

[0172] The memory 806 stores executable program code, and the processor 804 executes the executable program code to respectively implement the functions of the foregoing first communication module 701, second communication module 702, and third communication module 703, thereby implementing the inter-process communication method. That is, the memory 806 stores instructions for executing the inter-process communication method.

[0173] The communication interface 808 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 800 and other devices or a communication network.

[0174] Exemplarily, the foregoing computing device 800 may be Figures 2 - 4 the computing device shown in

[0175] The embodiment of the present application further provides a computing device cluster. The computing device cluster includes at least one computing device. The computing device may be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device may also be a terminal device such as a desktop computer, a laptop computer, or a smart phone.

[0176] As Figure 9 shown, the computing device cluster 900 includes at least one computing device 800. The memory 806 in one or more of the computing devices 800 in the computing device cluster 900 may store the same instructions for executing the inter-process communication method.

[0177] In some possible implementation manners, the memory 806 of one or more computing devices 800 in the computing device cluster may also store some instructions for executing the inter-process communication method respectively. In other words, the combination of one or more computing devices 800 may jointly execute the instructions for executing the inter-process communication method.

[0178] It should be noted that the memories 806 in different computing devices 800 in the computing device cluster may store different instructions, which are respectively used to execute some functions of the resource scheduling device. That is, the instructions stored in the memories 806 of different computing devices 800 may implement the functions of one or more of the first communication module 701, the second communication module 702, and the third communication module 703.

[0179] In some possible implementation manners, one or more computing devices in the computing device cluster may be connected through a network. Among them, the network may be a wide area network or a local area network, etc. Figure 10 A possible implementation manner is shown. As Figure 10 shown, two computing devices 800A and 800B are connected through a network. Specifically, they are connected to the network through the communication interfaces in each computing device.

[0180] In this type of possible implementation manner, the memory 806 in the computing device 800A stores instructions for executing the functions of the first communication module 701 and the second communication module 702. At the same time, the memory 806 in the computing device 800B stores instructions for executing the function of the third communication module 703.

[0181] Figure 10 The connection manner between the computing device clusters shown may be considered that since the inter-process communication method provided in this application needs to perform a large amount of calculations, it is considered to hand over the function of the third communication module 703 to the computing device 800B for execution.

[0182] It should be understood that Figure 10 the functions of the computing device 800A shown may also be completed by multiple computing devices 800. Similarly, the functions of the computing device 800B may also be completed by multiple computing devices 800.

[0183] The embodiments of this application also provide another computing device cluster. The connection relationship between the computing devices in this computing device cluster may be similarly referred to the connection manner of the computing device cluster shown in Figure 9 and Figure 10 The difference is that the memories 806 of one or more computing devices 800 in this computing device cluster may store the same instructions for executing the inter-process communication method.

[0184] In some possible implementations, parts of the instructions for executing the inter-process communication method may also be stored separately in the memory 806 of one or more computing devices 800 in the computing device cluster. In other words, the combination of one or more computing devices 800 can jointly execute the instructions for executing the inter-process communication method.

[0185] This application also provides a processor, which can be used to execute the above method.

[0186] This application also provides a chip, including: a processor and a power supply circuit; the power supply circuit can be used to supply power to the processor; the processor can be used to execute the above method.

[0187] This application also provides a computing device, which may include a processor, a memory, and computer programs / instructions stored on the memory; the processor executes the computer programs / instructions to enable the computing device to implement the above method.

[0188] This application also provides a computing device cluster, which includes at least one computing device; each computing device in the at least one computing device includes a processor, a memory, and computer programs / instructions stored on the memory, and the processor of each computing device executes the computer programs / instructions stored in the memory of each computing device to enable each computing device to implement the above method.

[0189] This application also provides a computer program product. The computer program product includes computer programs / instructions, and the computer programs / instructions can run on a computing device or be stored in a software or program product in any available medium. When the computer programs / instructions are executed on at least one computing device, at least one computing device can execute the above method.

[0190] This application also provides a computer-readable storage medium, which can be any available medium that a computing device can store or a data storage device such as a data center that includes one or more available media. Computer programs / instructions are stored on the computer-readable storage medium, and when the computer programs / instructions are executed on at least one computing device, at least one computing device can execute the above method.

[0191] Exemplarily, the available medium can be a magnetic medium (for example, a floppy disk, a magnetic disk, a magnetic tape), an optical medium (for example, a digital video disc (DVD)), or a semiconductor medium (for example, a solid state drive (SSD)), etc.

[0192] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the embodiments of the present invention.< / pid> < / pid> < / pid> < / pid> < / pid> < / pid> < / pid> < / pid> < / pid> < / pid> < / pid> < / pid> < / pid>

Claims

1. An inter-process communication method, characterized in that: The method comprises: A first process in the host machine maps a target memory file to a first virtual address space of the first process, and obtains a target file descriptor of the target memory file; The first process in the host machine sends the target file descriptor to the second process in the first container through the first domain socket; The second process in the first container maps the target memory file indicated by the target file descriptor to a second virtual address space of the second process according to the received target file descriptor; The second process in the first container communicates with the first process in the host machine through a target memory, where the target memory is a memory mapped by the first virtual address space and the second virtual address space.

2. The method according to claim 1, characterized in that The first process in the host machine sends the target file descriptor to the second process in the first container through the first domain socket, including: The first process in the host machine creates a first domain socket under the directory of the main process of the first container; wherein the directory of the main process of the first container is located in the kernel file system of the host machine; The first process in the host machine sends the target file descriptor to the second process in the first container through the first domain socket.

3. The method according to claim 2, characterized in that The first process in the host machine sends the target file descriptor to the second process in the first container through the first domain socket, including: The first process in the host machine creates a server of the first domain socket, and binds the server of the first domain socket to a file of the first domain socket; In response to detecting the file of the first domain socket, the second process in the first container creates a client of the first domain socket and binds the client of the first domain socket to the file of the first domain socket; The client of the first domain socket sends a request to the server of the first domain socket, where the request is used to request to obtain a file descriptor; The server of the first domain socket sends the target file descriptor to the client of the first domain socket in response to the received acquisition request.

4. The method according to claim 3, characterized in that The first process in the host machine creates a server of the first domain socket, including: The first process in the host machine creates a target thread, and the target thread is a server end of the first domain socket.

5. The method according to any one of claims 1 to 4, characterized in that The method further comprises: The first process in the host machine sends the target file descriptor to the third process in the second container through the second domain socket; The third process in the second container maps the target memory file indicated by the target file descriptor to a third virtual address space of the third process according to the received target file description; The third process in the second container communicates with the second process in the first container through the target memory, and the target memory is the memory mapped by the third virtual address space.

6. An inter-process communication device, characterized in that: A first communication module, used for mapping a target memory file to a first virtual address space of a first process in a host machine, and obtaining a target file descriptor of the target memory file; The first communication module is further configured to send the target file descriptor to the second process in the first container through the first domain socket; a second communication module, configured to map the target memory file indicated by the target file descriptor to a second virtual address space of a second process in the first container according to the received target file descriptor; The second process in the first container communicates with the first process in the host machine through a target memory, and the target memory is a memory mapped by the first virtual address space and the second virtual address space.

7. The device according to claim 6, characterized in that The first communication module is specifically used for: Creating a first domain socket in a directory of the main process of the first container; wherein the directory of the main process of the first container is located in a kernel file system of the host machine; The target file descriptor is sent to the second process in the first container through the first domain socket.

8. The device according to claim 7, characterized in that The first communication module is specifically used to: create a server end of the first domain socket, and bind the server end of the first domain socket to a file of the first domain socket; The second communication module is further used for: in response to detecting the file of the first domain socket, creating a client of the first domain socket; Among them, the client of the first domain socket is used to send an acquisition request to the server of the first domain socket, and the acquisition request is used to request to obtain a file descriptor; the server of the first domain socket is used to send the target file descriptor to the client of the first domain socket in response to the received acquisition request.

9. The device according to claim 8, characterized in that The first communication module is specifically used for: A target thread of the first process is created, where the target thread is a server end of the first domain socket.

10. The device according to any one of claims 6 to 9, characterized in that: The device also includes a third communication module; The first communication module is further configured to send the target file descriptor to the third process in the second container through the second domain socket; The third communication module is used to map the target memory file indicated by the target file descriptor to a third virtual address space of the third process according to the received target file description; The third process in the second container communicates with the second process in the first container through the target memory, and the target memory is the memory mapped by the third virtual address space.

11. A computing device cluster, characterized in that: The computing device cluster includes at least one computing device; Each of the at least one computing device comprises a processor, a memory, and a computer program / instructions stored on the memory; The processor of each computing device executes the computer program stored in the memory of each computing device, so that each computing device implements the method according to any one of claims 1 to 5.

12. A computer program product, characterized in that The computer program product comprises a computer program / instructions. When the computer program / instructions are executed by a computing device, the computing device implements the method according to any one of claims 1 to 5.

13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program / instruction. When the computer program / instruction is executed by a computing device, the computing device implements the method according to any one of claims 1 to 5.