Communication method and device
By allocating independent communication memory to each communication process and configuring access rights, the data inconsistency problem caused by shared memory failure is solved, fault isolation is achieved, and the communication availability and reliability of computing devices are improved.
Patent Information
- Application Number
- CN202310139646.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-14
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2043-02-14
AI Technical Summary
In computing devices, shared memory failures lead to data inconsistencies, affecting the communication of all processes and reducing the availability of communication memory.
The memory management component allocates independent communication memory to each communication process and configures access permissions so that each process can only access the memory of the communication process it participates in, achieving fault isolation.
It effectively reduces the scope of fault impact, ensures high availability of communication memory, prevents data inconsistency problems, and improves communication reliability and continuity.
Smart Images

Figure CN116361026B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a communication method and device. Background Art
[0002] Different processes in a computing device can communicate through shared memory. For example, when process 1 needs to transfer data to process 2, process 1 writes the data to the shared memory of the computing device. Process 2 then reads the data from the shared memory, completing the data transfer between processes 1 and 2.
[0003] Currently, computing devices are usually configured with a shared memory for common use by all processes that need to communicate through the shared memory.
[0004] However, when any process using the shared memory exits due to a failure, data inconsistency may occur in the shared memory, causing the shared memory to be unavailable and affecting the communication of all processes. Summary of the Invention
[0005] This application provides a communication method and apparatus. This application implements fault isolation between different communication processes, effectively reducing the scope of the fault's impact. The technical solutions provided by this application are as follows:
[0006] In a first aspect, the present application provides a communication method. The method is applied to a computing device. The computing device runs a memory management component, a first process, and at least one second process that communicates with the first process. The method comprises: the memory management component allocates communication memory from the computing device's memory and configures the first process and the at least one second process with access rights to the communication memory, the communication memory being used to store communication data between the first process and the at least one second process; the memory management component notifies the first process and the at least one second process of the communication memory allocation result; and the first process and the at least one second process communicate by reading and / or writing data in the communication memory.
[0007] Because the memory management component allocates communication memory to the communication process and configures access permissions for the communication memory, the communication memory allocated to any communication process can only be accessed by the processes participating in that communication process. In this way, data transmitted in any communication process is stored only in the communication memory allocated to it, and data transmitted in different communication processes are stored in different communication memories. When a process in any communication process fails, the failure may only cause the communication memory used by that process to become unavailable, and may only affect the communication processes in which the process participates, without affecting the communication memory used by communication processes in which the process does not participate. Therefore, through this communication method, fault isolation between different communication processes is achieved, effectively reducing the scope of the failure and ensuring the high availability of the communication memory.
[0008] Optionally, before the memory management component allocates the communication memory from the memory of the computing device, the method further includes: the first process sending a memory request to the memory management component, the memory request requesting the memory management component to allocate memory for the first process and at least one second process to store communication data between the first process and the at least one second process. The memory management component then allocates the communication memory from the memory of the computing device, including: the memory management component allocating the communication memory from the memory of the computing device based on the memory request.
[0009] In one implementation, at least one of a first process and at least one second process can participate in multiple communication processes simultaneously. The multiple communication processes have different memory locations for storing communication data. The first process is the process that can participate in the fewest communication processes simultaneously among the first process and the at least one second process. Because the first process participates in fewer communication processes simultaneously, if the first process sends a memory request, the total number of communication processes affected by a failure of the first process is significantly reduced, further reducing the scope of the failure's impact.
[0010] Optionally, after the memory management component notifies the first process and at least one second process of the communication memory allocation result, the method further includes: the memory management component monitoring the actual usage of the communication memory; and when the actual usage meets a preset condition, the memory management component adjusting the size of the communication memory. In this way, while ensuring the availability of the communication memory, the resource utilization of the computing device's memory is guaranteed, resource waste is reduced, and fine-grained management of the communication memory size is achieved.
[0011] Among them, when the actual usage meets the preset conditions, the size of the communication memory is adjusted, including one or more of the following: when the actual usage is continuously less than the first threshold within a specified period of time, the size of the communication memory is reduced; when the actual usage reaches the second threshold, the size of the communication memory is increased.
[0012] Optionally, after the memory management component notifies the first process and at least one second process of the communication memory allocation result, the method further includes: the memory management component adjusts the access rights of the communication memory and notifies the process whose access rights have changed of the adjustment result.
[0013] In one implementation, before the memory management component adjusts the access rights of the communication memory, the method further includes: the first process sending an access rights change request to the memory management component, where the access rights change request is used to request adjustment of the access rights of the communication memory. For example, when a process communicating with the first process changes relative to at least one second process, the first process may send an access rights change request to the memory management component. The memory management component then adjusts the access rights of the communication memory, including: the memory management component adjusting the access rights of the communication memory based on the access rights change request.
[0014] If a process with access to the communication memory fails in the memory management component, data inconsistencies may occur in the communication memory, which could lead to errors in the communication process using the communication memory. To prevent this error, the memory management component can notify all processes with access to the communication memory to stop using the communication memory after determining that any process with access to the communication memory has failed, preventing the processes using the communication memory from obtaining erroneous data.
[0015] Optionally, after determining that any process with access rights to the communication memory has failed, the memory management component may also reallocate the communication memory for the communication process and notify all processes with access rights to the communication memory to use the reallocated communication memory, so that the first process and at least one second process communicate with each other by reading and / or writing data in the reallocated communication memory based on the notification.
[0016] This allows for rapid switching of communication processes to newly allocated communication memory, quickly restoring the availability of communication using communication memory and shortening downtime, thereby ensuring the continuity and reliability of inter-process communication. Furthermore, when a process fails, by stopping the originally allocated communication process and reassigning it, this transaction-based process reduces maintenance costs for the communication process.
[0017] In one implementation, after the memory management component notifies the first process and at least one second process of the communication memory allocation result, the method further includes: the memory management component reclaiming the communication memory. In this case, the memory occupied by the communication memory can be used for other purposes to ensure memory resource utilization.
[0018] Optionally, before the memory management component reclaims the communication memory, the method further includes: the memory management component receiving a memory reclaim request sent by the first process. Then, the memory management component reclaims the communication memory, including: the memory management component reclaiming the communication memory based on the memory reclaim request.
[0019] In a second aspect, the present application provides a communication device. The device is applied to a computing device. The device includes: a memory management module, a first process module, and at least one second process module that communicates with the first process module. The memory management module is configured to allocate communication memory from the computing device's memory and configure the first process module and at least one second process module with access rights to the communication memory, where the communication memory is used to store communication data between the first process module and the at least one second process module. The memory management module is further configured to notify the first process module and the at least one second process module of the allocation result of the communication memory. The first process module and the at least one second process module are configured to communicate by reading and / or writing data in the communication memory.
[0020] Optionally, the first process module is further used to send a memory request to the memory management module, and the memory request requests the memory management module to allocate memory for the first process module and at least one second process module to store communication data between the first process module and at least one second process module.
[0021] The memory management module is specifically used to allocate communication memory from the memory of the computing device based on the memory request.
[0022] Optionally, at least one of the first process module and the at least one second process module can participate in multiple communication processes at the same time, and the multiple communication processes use different memories to store communication data. The first process module is the process module among the first process module and the at least one second process module that can participate in the least communication processes at the same time.
[0023] Optionally, the memory management module is further configured to monitor the actual usage of the communication memory, and adjust the size of the communication memory when the actual usage meets a preset condition.
[0024] Optionally, when the actual usage meets preset conditions, the size of the communication memory is adjusted, including one or more of the following: when the actual usage is continuously less than a first threshold within a specified period of time, the size of the communication memory is reduced; when the actual usage reaches a second threshold, the size of the communication memory is increased.
[0025] Optionally, the memory management module is further configured to adjust access rights of the communication memory and notify the process whose access rights have changed of the adjustment result.
[0026] Optionally, the first process module is further configured to send an access rights change request to the memory management module, where the access rights change request is used to request adjustment of access rights to the communication memory.
[0027] The memory management module is specifically used to adjust the access rights of the communication memory based on the access rights change request.
[0028] Optionally, the first process module is specifically configured to send an access permission change request to the memory management module when a process communicating with the first process module changes relative to at least one second process module.
[0029] Optionally, the memory management module is further configured to notify all processes having access rights to the communication memory to stop using the communication memory after any process having access rights to the communication memory fails.
[0030] Optionally, the memory management module is further configured to reallocate the communication memory after any process having access rights to the communication memory fails, and notify all processes having access rights to the communication memory to use the reallocated communication memory.
[0031] The first process module and at least one second process module are further configured to communicate by reading and / or writing data in the reallocated communication memory based on the notification.
[0032] Optionally, the memory management module is also used to reclaim communication memory.
[0033] Optionally, the memory management module is further configured to receive a memory reclaim request sent by the first process module. The memory management module is then specifically configured to reclaim the communication memory based on the memory reclaim request.
[0034] In a third aspect, the present application provides a computing device comprising a memory and a processor, wherein the memory stores program instructions, and the processor runs the program instructions to execute the method provided in the first aspect of the present application and any possible implementation thereof.
[0035] In a fourth aspect, the present application provides a computer cluster comprising multiple computing devices, the multiple computing devices comprising multiple processors and multiple memories, the multiple memories storing program instructions, and the multiple processors executing the program instructions, so that the computer cluster executes the method provided in the first aspect of the present application and any possible implementation thereof.
[0036] In a fifth aspect, the present application provides a computer-readable storage medium, which is a non-volatile computer-readable storage medium. The computer-readable storage medium includes program instructions. When the program instructions are executed on a computing device, the computing device executes the method provided in the first aspect of the present application and any possible implementation thereof.
[0037] In a sixth aspect, the present application provides a computer program product comprising instructions, which, when run on a computer, enables the computer to execute the method provided in the first aspect of the present application and any possible implementation thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 is a structural diagram of a computing device provided in an embodiment of the present application;
[0039] Figure 2 This is a flow chart of a communication method provided by an embodiment of the present application;
[0040] Figure 3 This is a schematic diagram of a memory for a communication process provided by an embodiment of the present application divided into multiple communication memory blocks;
[0041] Figure 4 This is a schematic diagram of a plurality of worker processes communicating with a dataserver process provided by an embodiment of the present application;
[0042] Figure 5 This is a schematic diagram of communication between processes 1 to 5 through communication memory provided by an embodiment of the present application;
[0043] Figure 6 This is a schematic diagram of a communication process between processes 1 to 5 provided by an embodiment of the present application, in which process 1 fails;
[0044] Figure 7 is a schematic diagram of a communication device provided in an embodiment of the present application;
[0045] Figure 8 This is a schematic diagram of the structure of a computing device cluster provided in an embodiment of the present application. DETAILED DESCRIPTION
[0046] In order to make the objectives, technical solutions and advantages of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.
[0047] Different processes on a computing device can communicate through shared memory. For example, when process 1 needs to transfer data to process 2, process 1 writes the data to the computing device's shared memory. Process 2 then reads the data from this memory, completing the data transfer between processes 1 and 2. Shared memory is the physical memory of a computing device, allowing multiple processes to access the same logical memory. Processes with access to shared memory can link this shared memory into their own address space to access addresses within it. Modifications made by any process to shared memory affect all processes with access to this shared memory.
[0048] Currently, computing devices are typically configured with a shared memory for use by all processes that need to communicate via the shared memory. Here, all processes include all processes that communicate with a second process by reading and / or writing data in the shared memory, without distinguishing whether different processes are participants in the same communication process. For example, a computing device is configured with shared memory A, and the computing device runs processes 1, 2, 3, and 4. Processes 1, 2, 3, and 4 all communicate with a second process by reading and / or writing data in shared memory A. Here, processes 1 and 2 need to communicate, processes 3 and 4 need to communicate, process 1 does not need to communicate with processes 3 or 4, and process 2 does not need to communicate with processes 3 or 4.
[0049] Since the shared memory of a computing device can be used simultaneously by all processes that communicate through shared memory, any change to the shared memory by any process will affect all processes that have access to the memory, and the process of operating shared memory cannot guarantee atomic operations. Therefore, when any process using the shared memory exits due to a failure, data inconsistency will occur in the shared memory, making the shared memory unavailable and affecting the communication of all processes.
[0050] An embodiment of the present application provides a communication method. The method is applied to a computing device. The computing device runs a memory management component, a first process, and at least one second process communicating with the first process. The first process and the at least one second process communicating with the first process belong to the same communication process. The first process and the at least one second process belonging to the same communication process means that the transmission of data in the communication process is indispensable to the first process and the at least one second process; otherwise, the data transmission in the communication process cannot be completed. The method includes: the memory management component allocates communication memory from the computing device's memory and configures the first process and the at least one second process with access rights to the communication memory. The memory management component then notifies the first process and the at least one second process of the communication memory allocation result. After obtaining the allocation result, the first process and the at least one second process can communicate by reading and / or writing data in the communication memory. The communication area is a shared memory used by the first process and the at least one second process for communication, and is used to store communication data between the first process and the at least one second process.
[0051] In this communication method, the memory management component allocates communication memory to the communication process and configures access permissions for the communication memory, so that the communication memory allocated to any communication process can only be accessed by the processes participating in that communication process. In this way, data transmitted during any communication process is stored only in the communication memory allocated to it, and data transmitted during different communication processes is stored in different communication memories. When a process in any communication process fails, the failure may only cause the communication memory used by that process to become unavailable, potentially affecting only the communication processes in which the process participates, and will not affect the communication memory used by communication processes in which the process does not participate. Therefore, this communication method achieves fault isolation between different communication processes, effectively reducing the scope of the failure's impact and ensuring the high availability of the communication memory.
[0052] An implementation environment involved in a communication method provided in an embodiment of the present application includes: a computing device. A memory management component and multiple other components are deployed in the computing device. The memory management component is used to manage memory. The operation of the multiple other components can be achieved by running processes, and processes can communicate with each other and with the memory management component. The memory management component is used to implement some or all of the functions of the memory management component in the communication method provided in an embodiment of the present application. Any process among the multiple processes is used to implement some or all of the functions of the first process in the communication method provided in an embodiment of the present application.
[0053] Optionally, the computing device may be a server, a computer, a personal computer, a laptop computer, a mobile phone, a smart phone, a tablet computer, a cloud host, a portable mobile terminal, a multimedia player, an e-book reader, a wearable device, a smart home appliance, an artificial intelligence device, a smart wearable device, a smart vehicle-mounted device, or an Internet of Things device, etc. For example, the computing device may be a cloud server in a cloud computing service center, which is used to provide cloud services to users.
[0054] Figure 1 This is a schematic diagram of the structure of a computing device provided in an embodiment of the present application. Figure 1 As shown, the computing device 100 includes a processor 101, a memory 102, a communication interface 103, and a bus 104. The processor 101, the memory 102, and the communication interface 103 are connected to each other via the bus 104.
[0055] The processor 101 may include a general-purpose processor and / or a dedicated hardware chip. The general-purpose processor may include: a central processing unit (CPU), a microprocessor or a graphics processing unit (GPU). The CPU is, for example, a single-core processor (single-CPU) or a multi-core processor (multi-CPU). The dedicated hardware chip is a hardware module for high-performance processing. The dedicated hardware chip includes at least one of a digital signal processor, an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or a network processor (NP). The processor 101 may also be an integrated circuit chip with signal processing capabilities. During implementation, some or all of the functions of the communication method of the present application may be completed by the hardware integrated logic circuit in the processor 101 or instructions in the form of software.
[0056] Memory 102 is used to store computer programs, which include an operating system 102a and executable code (i.e., program instructions) 102b. Memory 102 may be, for example, a read-only memory or other type of static storage device capable of storing static information and instructions, a random access memory or other type of dynamic storage device capable of storing information and instructions, an electrically erasable programmable read-only memory, a read-only optical disc or other optical disc storage, an optical disc storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), a magnetic disk storage medium, or other magnetic storage device, or any other medium capable of carrying or storing desired executable code in the form of instructions or data structures and accessible by a computer, but not limited to these. For example, memory 102 is used to store an outbound port queue, etc. Memory 102 may be independent and connected to processor 101 via bus 104. Alternatively, memory 102 and processor 101 may be integrated. The memory 102 can store executable code. When the executable code stored in the memory 102 is executed by the processor 101, the processor 101 is used to perform some or all of the functions of the communication method provided in the embodiments of the present application. For the implementation of the process executed by the processor 101, please refer to the relevant description of the aforementioned embodiments. The memory 102 may also include software modules and data required for other running processes, such as the operating system.
[0057] The communication interface 103 uses a transceiver module, such as, but not limited to, a transceiver, to communicate with other devices or communication networks. For example, the communication interface 103 can be any one or a combination of the following devices: a network interface (such as an Ethernet interface), a wireless network card, or other device with network access capabilities.
[0058] Bus 104 is any type of communication bus used to interconnect the internal components of a computing device (e.g., memory 102, processor 101, communication interface 103). For example, a system bus is provided. The embodiments of this application illustrate the interconnection of the aforementioned components within a computing device via bus 104. Alternatively, the aforementioned components within computing device 100 may be communicatively connected to each other using other connection methods besides bus 104. For example, the aforementioned components within computing device 100 may be interconnected via an internal logical interface.
[0059] It should be noted that the above-mentioned multiple devices can be respectively arranged on independent chips, or at least partially or completely arranged on the same chip. Whether each device is independently arranged on different chips or integrated on one or more chips often depends on the needs of product design. The embodiments of the present application do not limit the specific implementation form of the above-mentioned devices. The descriptions of the processes corresponding to the above-mentioned figures have different focuses. For parts that are not described in detail in a certain process, please refer to the relevant descriptions of other processes.
[0060] In the above embodiments, all or part of the embodiments may be implemented using software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the embodiments may be implemented in the form of a computer program product. The computer program product providing a program development platform includes one or more computer instructions that, when loaded and executed on a computing device, fully or partially implement the functions of the communication method provided in the embodiments of the present application.
[0061] Furthermore, computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium stores computer program instructions that provide a program development platform.
[0062] It should be understood that the above content is an illustrative description of the application scenarios of the communication method provided in the embodiment of the present application, and does not constitute a limitation on the application scenarios of the communication method. A person skilled in the art will know that as business needs change, its application scenarios can be adjusted according to application needs, and the embodiments of the present application do not list them one by one.
[0063] The following describes the implementation process of the communication method provided in the embodiment of the present application. The method is applied to a computing device. The computing device runs a memory management component, a first process, and at least one second process communicating with the first process. The first process and the at least one second process communicating with the first process belong to the same communication process. Figure 2 As shown, the communication method includes the following steps:
[0064] Step 201: A first process sends a memory request to a memory management component, requesting the memory management component to allocate memory for the first process and the at least one second process to store communication data between the first process and the at least one second process.
[0065] After determining that a first process needs to use shared memory to communicate with at least one second process, it can send a memory request to the memory management component to request that the memory management component allocate memory for the first process and the at least one second process, so that the first process and the at least one second process can use the allocated memory to store communication data. The memory allocated by the memory management component is the communication memory used by the first process and the at least one second process for communication. The memory management component is used to manage all communication memories in the computing device. For example, the memory management component uses slab technology to manage all communication memories in the computing device.
[0066] A memory request may indicate a process with permission to access the memory to be allocated. In one implementation, the memory request may indicate the communication data to be stored in the memory to be allocated, the communication process to which the communication data belongs, and the participating processes of the communication process. The participating processes of the communication process are recorded as processes with permission to access the memory to be allocated. For example, a memory request sent by a first process may request memory allocation for communication process 1, and the participating processes of communication process 1 are the first process and the at least one second process.
[0067] Optionally, the memory request may further indicate the size of the memory to be allocated, so that the memory management component allocates the memory of the specified size. For example, the memory request may indicate that the size of the memory to be allocated is 10 megabytes (MB). Alternatively, the memory request may carry a description of the communication process between the first process and the at least one second process, so that the memory management component determines the amount of communication data involved in the communication process based on the description, and determines the size of the memory to be allocated based on the amount of data. In one implementation, the description of the communication process may indicate the service that generates the communication process. For example, the description of the communication process may indicate that the service that generates the communication process is a web service provided by a web page.
[0068] Optionally, at least one of the first process and the at least one second process can participate in multiple communication processes simultaneously, and the multiple communication processes have different memory locations for storing communication data. In this case, the first process may be the process that can participate in the fewest communication processes simultaneously among the first process and the at least one second process. Because the first process participates in fewer communication processes simultaneously, if the first process sends a memory request, the total number of communication processes affected by a failure of the first process is significantly reduced, thereby further reducing the scope of the failure's impact.
[0069] For example, when a computing device implements a web service through communication processes, the implementation process of the web service includes: processing web page requests from a front-end (e.g., a client) and retrieving data from a back-end (e.g., a database) based on the web page requests. These two processes are implemented by a worker process and a data server process, respectively. Processing the client's web page request includes: the worker process processing the request to establish a connection with the client and parsing Hypertext Transfer Protocol (HTTP) messages sent by the client. Retrieving data from the database based on the web page request includes: the data server process retrieving data from the database based on the web page request and providing the retrieved data to the worker process. During this data retrieval process, to improve communication performance between the data server and worker processes, the data server and worker processes may communicate using communication memory. The data server process providing the retrieved data to the worker process via communication memory includes: after the data server process retrieves the data based on the web page request, it writes the retrieved data to the communication memory, and then the word server process reads the retrieved data from the communication memory.
[0070] A computing device may run multiple worker processes and one dataserver process, and each of these multiple workers can communicate with the dataserver process. In this case, since multiple worker processes can communicate with the dataserver process, when multiple worker processes simultaneously communicate with the dataserver process, the dataserver process participates in multiple communication processes simultaneously, and each worker process participates in one or more communication processes simultaneously. Considering that the computing device only runs one dataserver process and can simultaneously receive web page requests from multiple clients, it can be determined that the total number of communication processes simultaneously participated in by the dataserver process is necessarily greater than the total number of communication processes simultaneously participated in by the worker processes. Therefore, for communication processes between the worker and dataserver processes, the worker process participates in the fewest number of communication processes simultaneously. In this case, since the dataserver process participates in many communication processes simultaneously, if the dataserver process sends a memory request, a failure of the dataserver process may affect all communication processes in which it participates. Since the worker process participates in fewer communication processes simultaneously, if the worker process sends a memory request, the total number of communication processes affected by the worker process failure is significantly reduced. Therefore, when the process sending the memory request is the process that can participate in the least number of communication processes simultaneously among the first process and the at least one second process, the impact range of the fault can be further reduced.
[0071] In addition, the first process can also be the process with more complex business processing logic among the first process and the at least one second process. When the first process is the process with more complex business processing logic, the communication memory is allocated by the process that has the least impact on the data in the communication memory. When a failure occurs in the process with simpler business processing logic, the probability of the data in the communication memory being destroyed is small. Usually, it is only necessary to restart the process with simpler business processing logic to continue the communication process without triggering the allocation of communication memory through memory application. For example, continuing the above example of the worker process and the dataserver process, the business processing logic of the dataserver process is relatively simple, and its reliability is higher. Its failure will not affect the data in the communication area from being destroyed. It is only necessary to restart the dataserver process to continue the communication process without triggering the allocation of communication memory through memory application.
[0072] Step 202: The memory management component allocates communication memory from the memory of the computing device based on the memory request, and configures the first process and the at least one second process to have access rights to the communication memory.
[0073] After receiving the memory request sent by the first process, the memory management component can determine the memory area used as communication memory from the memory of the computing device, modify the usage status of the memory area, and configure the first process and the at least one second process to have access rights to the memory area, so as to allocate the memory area as communication memory for the first process and the at least one second process. Figure 3 As shown, the memory management component allocates communication memory to multiple communication processes respectively, which is equivalent to dividing the memory of the computing device used for the communication process into multiple (such as n) communication memories, each communication memory is used by one communication process.
[0074] Continuing with the example of step 201, Figure 4 As shown, since the communication processes between multiple worker processes and the dataserver process are independent of each other, after allocating communication memory to each worker process, each worker process and the dataserver process will each occupy a dedicated communication memory. Furthermore, by configuring access permissions for each communication memory, a failure in any worker process will not affect the communication memory used by other worker processes. Therefore, by allocating communication memory separately to multiple worker processes, fault isolation is achieved between the multiple communication processes involved, effectively reducing the impact of failures and ensuring high availability of communication memory. Figure 4 A diagram showing how the memory management component allocates communication memory to three communication processes. Worker process 1 and the dataserver process belong to the same communication process, which exclusively uses communication memory 1. Worker process 2 and the dataserver process belong to the same communication process, which exclusively uses communication memory 2. Worker process 3 and the dataserver process belong to the same communication process, which exclusively uses communication memory 3.
[0075] It should be noted that the aforementioned memory request is only one example of triggering the memory management component to allocate communication memory, and is not intended to limit the implementation method for triggering the memory management component to allocate communication memory. For example, the memory management component may monitor the communication process of processes in the computing device and, upon determining that a process requires memory for communication, proactively allocate communication memory to the process so that the process can use the communication memory to implement the communication process.
[0076] Step 203: The memory management component notifies the first process and the at least one second process of the communication memory allocation result.
[0077] After allocating communication memory to the first process and the at least one second process, the memory management component may notify the first process and the at least one second process of the communication memory allocation result. For example, the memory management component may notify the first process and the at least one second process of the address of the communication memory and the access rights of the first process and the at least one second process to the communication memory, so that the first process and the at least one second process can communicate using the communication memory.
[0078] Step 204: The first process communicates with at least one second process by reading and / or writing data in the communication memory.
[0079] When a first process communicates with at least one second process by reading and / or writing data in a communication memory, this means that when one of the first process and at least one second process transmits data to the other of the first process and at least one second process, the data to be transmitted may be written to the communication memory, and then the first process and the other of the at least one second process complete the transmission process by reading the data from the communication memory. For example, when a first process transmits data to a second process 1, the first process may write the data to be transmitted to the communication memory, and then the second process 1 may read the data from the communication memory, thereby completing the process of transmitting the data from the first process to the second process 1.
[0080] Step 205: The memory management component monitors the actual usage of the communication memory, and adjusts the size of the communication memory when the actual usage meets a preset condition.
[0081] After the memory management component allocates communication memory to the first process and the at least one second process, it can monitor the actual usage of the communication memory and dynamically adjust the size of the communication memory based on the actual usage of the communication memory by the first process and the at least one second process. This can ensure the resource utilization of the memory of the computing device and reduce resource waste while ensuring the availability of the communication memory.
[0082] In one implementation, adjusting the size of the communications memory may include one or more of the following: reducing the size of the communications memory when the actual usage of the communications memory is continuously less than a first threshold for a specified duration; and increasing the size of the communications memory when the actual usage of the communications memory reaches a second threshold. The specified duration, the first threshold, and the second threshold can be set based on application requirements and are not specifically limited herein.
[0083] If the actual usage of the communication memory remains below a first threshold for a specified duration, it indicates that the current size of the communication memory does not match the memory demand of the communication process, and this mismatch manifests as oversupply. In this case, the size of the communication memory can be reduced so that the adjusted size matches the memory demand of the communication process. Furthermore, by reducing the size of the communication memory, the reduced memory can be used for other purposes, thereby ensuring memory resource utilization and reducing resource waste. For example, assuming the initial size of the communication memory is 10MB and the first threshold is 80% of this initial size, if the actual usage of the communication memory remains below 80% of this initial size for a specified duration, it is determined that the current size of the communication memory does not match the memory demand of the communication process, and this mismatch manifests as oversupply. In this case, the size of the communication memory can be reduced to 8MB, allowing the remaining 2MB to be used for other purposes, thereby ensuring memory resource utilization.
[0084] When the actual usage of the communication memory reaches the second threshold, it indicates that the current size of the communication memory is likely unable to meet the communication needs of the communication process. This also indicates that the current size of the communication memory does not match the memory requirements of the communication process, and this mismatch manifests as a shortage of supply. In this case, the size of the communication memory can be increased so that the adjusted size of the communication memory meets the communication needs of the communication process. For example, assuming the initial size of the communication memory is 10MB and the second threshold is 95% of the initial size, when the actual usage of the communication memory reaches 95% of the initial size, it is determined that the current size of the communication memory does not match the memory requirements of the communication process, and this mismatch manifests as a shortage of supply. In this case, the size of the communication memory can be increased to 12MB so that the adjusted size of the communication memory can meet the communication needs of the communication process.
[0085] Step 206: The first process sends an access rights change request to the memory management component. The access rights change request is used to request adjustment of access rights to the communication memory.
[0086] While using the communication memory, the first process may also send an access permission change request to the memory management component, causing the memory management component to change the access permissions of the communication memory. In one implementation, when the process communicating with the first process changes relative to the at least one second process, the first process may send an access permission change request to the memory management component. For example, when the process communicating with the first process becomes part of the at least one second process, the first process may send an access permission change request to the memory management component, causing the memory management component to delete the access permissions of the at least one second process that no longer communicates with the first process. For another example, when the process communicating with the first process adds another process to the one or more processes, the first process may send an access permission change request to the memory management component, causing the memory management component to add the access permissions of the additional process to the access permissions of the communication memory. For another example, when the process communicating with the first process adds another process to the one or more processes, the first process may send an access permission change request to the memory management component, causing the memory management component to delete the access permissions of the at least one second process that no longer communicates with the first process and add the access permissions of the additional process to the access permissions of the communication memory.
[0087] Step 207: The memory management component adjusts the access rights of the communication memory based on the access rights change request, and notifies the process whose access rights have changed of the adjustment result.
[0088] After receiving the access permission change request sent by the first process, the memory management component can perform an operation to adjust the access permission of the communication memory. After completing the access permission adjustment, the memory management component notifies the process whose access permission has changed of the adjustment result. For example, when the memory management component removes a process's access permission to the communication memory, the memory management component notifies the process that it no longer has access permission to the communication memory. When the memory management component increases a process's access permission to the communication memory, the memory management component notifies the process that it has access permission to the communication memory.
[0089] It should be noted that the aforementioned access permission change request is only one example of triggering an adjustment to the access permissions of the communications memory and does not limit the implementation method for triggering the memory management component to adjust the access permissions of the communications memory. For example, the memory management component may monitor the communication process of processes in the computing device and, upon determining that a process participating in the communication process between the first process and the at least one second process has changed, adjust the access permissions of the communications memory based on the change.
[0090] Step 208: After any process with access rights to the communication memory fails, the memory management component notifies all processes with access rights to the communication memory to stop using the communication memory, reallocates the communication memory, and notifies all processes with access rights to the communication memory to use the reallocated communication memory.
[0091] If any process with access to the communication memory fails, data inconsistencies may occur in the communication memory, which could lead to errors in the communication process using the communication memory. To prevent this, upon determining that any process with access to the communication memory has failed, the memory management component can notify all processes with access to the communication memory to stop using the communication memory, preventing processes using the communication memory from obtaining erroneous data. Figure 2 This example is about notifying a first process and at least one second process to stop using communication memory. In one implementation, a computing device includes a component for detecting whether a process has failed. Upon detecting a process failure, the component may notify a memory management component of the failure event, allowing the memory management component to obtain information about the process failure.
[0092] Optionally, after determining that any process with access rights to the communication memory fails, the memory management component may reallocate the communication memory for the communication process and notify all processes with access rights to the communication memory to use the reallocated communication memory. Figure 2 This example shows notifying a first process and at least one second process to use reallocated communication memory. This facilitates rapid switching of the communication process to the reallocated communication memory, quickly restoring the availability of communication using the communication memory, and shortening the downtime, thereby ensuring the continuity and reliability of inter-process communication. Furthermore, when a process fails, by ceasing use of the originally allocated communication process and reallocating the communication process, the maintenance cost of the communication process can be reduced due to the implementation of this process transaction. Furthermore, before a process uses the reallocated communication memory, the affected processes can also perform failover operations in the reallocated communication memory, implementing failover in the reallocated memory, thereby ensuring the continuity and reliability of the communication process.
[0093] In one implementation, a process management component may be running in the communication memory, and the operation of the memory management component notifying the process may be executed by the process management component. Figure 5 As shown in the figure, process 1, process 2, process 3, process 4 and process 5 have access to communication memory 1. Among them, process 1 needs to use communication memory 1 to transmit data with process 4 and process 5, and process 2 needs to use communication memory 1 to transmit data with process 3 and process 4. Figure 6As shown in the figure, when process 1 fails, it affects at least process 4 and process 5. At this time, the process management component needs to notify process 1, process 2, process 3, process 4, and process 5 to stop using communication memory. The memory management component can reallocate communication memory 2 for the communication process and then notify process 2, process 3, process 4, process 5, and the restarted process 1 to use the reallocated communication memory 2. As a result, process 2, process 3, process 4, process 5, and the restarted process 1 use communication memory 2 for communication.
[0094] Step 209: The first process communicates with at least one second process by reading and / or writing data in the reallocated communication memory based on the notification.
[0095] After receiving the notification of using the reallocated communication memory, the first process and the at least one second process can use the reallocated communication memory for communication. For the implementation process of using the reallocated communication memory for communication, please refer to the relevant description in step 204, which will not be repeated here.
[0096] Step 210: After completing the communication process, the first process sends a memory reclaim request to the memory management component.
[0097] Completing the communication process means completing the transmission of all data in the communication process. After the communication process is completed, the first process and the at least one second process no longer need to use the communication memory to transmit data, and the memory management component can reclaim the communication memory so that the memory occupied by the communication memory can be used for other purposes to ensure memory resource utilization. In one implementation, after the communication process is completed, the first process can send a memory reclaim request to the memory management component. Optionally, similar to the principle of sending a memory request by the first process, at least one of the first process and the at least one second process can participate in multiple communication processes at the same time, and the multiple communication processes use different memories for storing communication data. In this way, the first process can be the process that can participate in the least number of communication processes at the same time among the first process and the at least one second process, which can further reduce the scope of the impact of the failure.
[0098] Step 211: The memory management component reclaims the communication memory based on the memory reclaim request.
[0099] Upon receiving a memory reclaim request, the memory management component may reclaim communication memory based on the memory reclaim request. It should be noted that the aforementioned memory reclaim request is only one example of triggering the memory management component to reclaim communication memory and does not limit the triggering implementation method for the memory management component to reclaim communication memory. For example, the memory management component may also monitor the communication process of a process in the computing device and proactively reclaim communication memory upon determining that the communication process has completed.
[0100] In summary, in the communication method provided in the embodiment of the present application, since the memory management component allocates communication memory to the communication process and configures access rights for the communication memory, the communication memory allocated to any communication process can only be accessed by the process participating in the communication process. In this way, the data transmitted in any communication process is only stored in the communication memory allocated to it, and the data transmitted in different communication processes are stored in different communication memories respectively. When a process in any communication process fails, the failure may only cause the communication memory used by the process to be unavailable, and may only affect the communication process in which the process participates, and will not affect the communication memory used by the communication process in which the process does not participate. Therefore, through this communication method, fault isolation between different communication processes is achieved, effectively reducing the impact range of the fault and ensuring the high availability of the communication memory.
[0101] Moreover, when the size of the communication memory is dynamically adjusted according to the actual usage of the communication memory, it is possible to ensure the resource utilization of the memory of the computing device while ensuring the availability of the communication memory, reduce resource waste, and achieve fine-grained management of the communication memory size.
[0102] Furthermore, if any process with access to the communication memory fails, all processes with access to the communication memory are notified to stop using the communication memory, preventing the processes using the communication memory from acquiring erroneous data. At this point, the communication memory is reallocated to the communication process, and all processes with access to the communication memory are notified to use the reallocated communication memory. This allows the communication process to be quickly switched to the reallocated communication memory, quickly restoring the availability of communication using the communication memory, shortening the downtime and thus ensuring the continuity and reliability of inter-process communication. Furthermore, when a process fails, by stopping the originally allocated communication process and reallocating the communication process, the maintenance cost of the communication process can be reduced due to the process transaction implementation.
[0103] It should be noted that the order of the steps of the communication method provided in the embodiments of the present application can be adjusted appropriately, and the steps can be increased or decreased accordingly. Any person skilled in the art who can easily conceive of a modified method within the technical scope disclosed in this application should be included in the scope of protection of this application, and therefore will not be described in detail.
[0104] The communication method described above is an embodiment of the present application. Corresponding to the method, an embodiment of the present application also provides a communication device. The device is applied to a computing device. The device includes: a memory management module, a first process module, and at least one second process module that communicates with the first process module. Figure 7 This is a schematic diagram of the structure of a communication device provided in an embodiment of the present application. Figure 7 The following multiple modules are shown. Figure 7 The communication device shown is capable of performing the above Figure 2 All or part of the operations of the corresponding objects shown. Among them, the memory management module corresponds to the memory management component. The first process module corresponds to the first process. The second process module corresponds to the second process. It should be understood that the device may include more additional modules than the modules shown or omit some of the modules shown therein, and the embodiments of the present application are not limited to this. Optionally, the communication device can be configured on a cloud platform. Figure 7 As shown, the communication device 70 may include: a memory management module 701, a first process module 702 and at least one second process module 703 communicating with the first process module.
[0105] The memory management module 701 is further configured to notify the first process module 702 and the at least one second process module 703 of the communication memory allocation result.
[0106] The first process module 702 and the at least one second process module 703 are configured to communicate by reading and / or writing data in a communication memory.
[0107] Optionally, the first process module 702 is also used to send a memory request to the memory management module 701, and the memory request requests the memory management module 701 to allocate memory for the first process module 702 and the at least one second process module 703 to store the communication data between the first process module 702 and the at least one second process module 703.
[0108] The memory management module 701 is specifically configured to allocate communication memory from the memory of the computing device based on the memory request.
[0109] Optionally, at least one of the first process module 702 and the at least one second process module 703 can participate in multiple communication processes at the same time, and the multiple communication processes use different memories to store communication data. The first process module 702 is the process module that can participate in the least number of communication processes at the same time among the first process module 702 and the at least one second process module 703.
[0110] Optionally, the memory management module 701 is further configured to monitor the actual usage of the communication memory, and adjust the size of the communication memory when the actual usage meets a preset condition.
[0111] Optionally, when the actual usage meets preset conditions, the size of the communication memory is adjusted, including one or more of the following: when the actual usage is continuously less than a first threshold within a specified period of time, the size of the communication memory is reduced; when the actual usage reaches a second threshold, the size of the communication memory is increased.
[0112] Optionally, the memory management module 701 is further configured to adjust access rights of the communication memory and notify the process whose access rights have changed of the adjustment result.
[0113] Optionally, the first process module 702 is further configured to send an access permission change request to the memory management module 701 , where the access permission change request is used to request adjustment of access permissions of the communication memory.
[0114] The memory management module 701 is specifically configured to adjust the access rights of the communication memory based on the access rights change request.
[0115] Optionally, the first process module 702 is further configured to send an access permission change request to the memory management module 701 when a process communicating with the first process module 702 changes relative to the at least one second process module 703 .
[0116] Optionally, the memory management module 701 is further configured to notify all processes having access rights to the communication memory to stop using the communication memory after any process having access rights to the communication memory fails.
[0117] Optionally, the memory management module 701 is further configured to reallocate the communication memory after any process having access rights to the communication memory fails, and notify all processes having access rights to the communication memory to use the reallocated communication memory.
[0118] The first process module 702 and the at least one second process module 703 are further configured to communicate by reading and / or writing data in the reallocated communication memory based on the notification.
[0119] Optionally, the memory management module 701 is also used to reclaim communication memory.
[0120] Optionally, the memory management module 701 is further configured to receive a memory reclaiming request sent by the first process module 702. The memory management module 701 is specifically configured to reclaim the communication memory based on the memory reclaiming request.
[0121] In summary, in the communication device provided in the embodiment of the present application, since the memory management module allocates communication memory for the communication process and configures access rights for the communication memory, the communication memory allocated for any communication process can only be accessed by the process modules participating in the communication process. In this way, the data transmitted in any communication process is only stored in the communication memory allocated for it, and the data transmitted in different communication processes are stored in different communication memories respectively. When a process module in any communication process fails, the failure may only cause the communication memory used by the process module to be unavailable, and may only affect the communication process in which the process module participates, and will not affect the communication memory used by the communication process in which the process module does not participate. Therefore, through this communication device, fault isolation between different communication processes is achieved, effectively reducing the impact range of the fault and ensuring the high availability of the communication memory.
[0122] Moreover, when the size of the communication memory is dynamically adjusted according to the actual usage of the communication memory, it is possible to ensure the resource utilization of the memory of the computing device while ensuring the availability of the communication memory, reduce resource waste, and achieve fine-grained management of the communication memory size.
[0123] Furthermore, if any process module with access to the communication memory fails, all process modules with access to the communication memory are notified to stop using the communication memory, preventing the process modules using that communication memory from acquiring erroneous data. At this point, the communication memory is reallocated to the communication process, and all process modules with access to the communication memory are notified to use the reallocated communication memory. This allows the communication process to be quickly switched to the reallocated communication memory, quickly restoring the availability of communication using the communication memory, shortening the downtime, and thus ensuring the continuity and reliability of communication between process modules. Furthermore, when a process module fails, by stopping the use of the originally assigned communication process module and reallocating a communication process module, the maintenance cost of the communication process can be reduced due to the implementation of this process transaction.
[0124] The memory management module 701, the first process module 702, and the second process module 703 can all be implemented by software or hardware. For example, the implementation of the memory management module 701 will be described below using the memory management module 701 as an example. Similarly, the implementation of the first process module 702 and the second process module 703 can refer to the implementation of the memory management module 701.
[0125] As an example of a software functional unit, the memory management 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. Furthermore, the computing instance may be one or more. For example, the memory management module 701 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed in the same region or in different regions. Furthermore, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including one data center or multiple geographically close data centers. Typically, a region may include multiple AZs.
[0126] Similarly, multiple hosts / virtual machines / containers running the code can be distributed within the same virtual private cloud (VPC) or across multiple VPCs. Typically, a VPC is set up within a region. Cross-region communication between two VPCs within the same region, or between VPCs in different regions, requires a communication gateway within each VPC to interconnect the VPCs.
[0127] As an example of a hardware functional unit, the memory management module 701 may include at least one computing device, such as a server. Alternatively, the memory management module 701 may be implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
[0128] The multiple computing devices included in the memory management module 701 can be distributed in the same region or in different regions. The multiple computing devices included in the memory management module 701 can be distributed in the same AZ or in different AZs. Similarly, the multiple computing devices included in the memory management module 701 can be distributed in the same VPC or in multiple VPCs. The multiple computing devices can be any combination of servers, ASICs, PLDs, CPLDs, FPGAs, GALs, and other computing devices.
[0129] It should be noted that in other embodiments, any of the memory management module 701, the first process module 702, and the second process module 703 can be used to execute any step in the communication method. The steps that the memory management module 701, the first process module 702, and the second process module 703 are responsible for implementing can be specified as needed. The full functionality of the communication device is achieved by having the memory management module 701, the first process module 702, and the second process module 703 each implement different steps in the communication method.
[0130] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules can refer to the corresponding contents in the aforementioned method embodiments and will not be repeated here.
[0131] Embodiments of the present application also provide a computing device cluster. The computing device cluster includes at least one computing device. The computing device can 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 can also be a terminal device such as a desktop computer, a laptop computer, or a smartphone.
[0132] Optionally, the structure of at least one computing device included in the computing device cluster can be found in Figure 1 The computing device 100 shown. The memory 102 of one or more computing devices 100 in the computing device cluster may store the same instructions for executing the communication method.
[0133] In some possible implementations, the memory 102 of one or more computing devices 100 in the computing device cluster may also store partial instructions for executing the communication method. In other words, the combination of one or more computing devices 100 can jointly execute the instructions for executing the communication method.
[0134] It should be noted that the memory 102 in different computing devices 100 in the computing device cluster can store different instructions, each for executing part of the functions of the communication device. In other words, the instructions stored in the memory 102 in different computing devices 100 can implement the functions of one or more of the above modules.
[0135] In some possible implementations, one or more computing devices in a computing device cluster may be connected via a network, which may be a wide area network or a local area network. Figure 8 A possible implementation is shown. Figure 8 As shown, two computing devices 800A and 800B are connected via a network. Specifically, the connection to the network is achieved through a communication interface in each computing device. In this possible implementation, computing devices 800A and 800B include a bus 802, a processor 804, a memory 806, and a communication interface 808.
[0136] It should be understood that Figure 8 The functions of the computing device 800A shown in FIG. 8 may also be implemented by multiple computing devices 800. Similarly, the functions of the computing device 800B may also be implemented by multiple computing devices 800. The deployment method of the modules for implementing the communication method in the computing devices may also be adjusted according to application requirements.
[0137] An embodiment of the present application also provides a computer-readable storage medium, which is a non-volatile computer-readable storage medium. The computer-readable storage medium includes program instructions. When the program instructions are executed on a computing device, the computing device implements the communication method provided in the embodiment of the present application.
[0138] The embodiment of the present application also provides a computer program product containing instructions. When the computer program product is run on a computer, it enables the computer to implement the communication method provided by the embodiment of the present application.
[0139] Those skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware, or by a program to instruct the relevant hardware, and the program may be stored in a computer-readable storage medium, which may be a read-only memory, a disk, or an optical disk, etc.
[0140] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, storage, display, etc.), and signals involved in this application are all authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data must comply with the relevant laws, regulations, and standards of the relevant countries and regions. For example, the raw data and executable code involved in this application were obtained with full authorization.
[0141] In the embodiments of the present application, the terms "first," "second," and "third" are used for descriptive purposes only and should not be understood as indicating or implying relative importance. The term "at least one" refers to one or more, and the term "plurality" refers to two or more, unless otherwise expressly limited.
[0142] In this application, the term "and / or" simply describes an association between related objects, indicating that three possible relationships exist. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the character " / " in this document generally indicates that the related objects are in an "or" relationship.
[0143] The above description is merely an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the concepts and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A communication method, characterized in that: The method is applied to a computing device, wherein the computing device runs a memory management component, a first process, and multiple second processes communicating with the first process, wherein the first process and the multiple second processes belong to the same communication process, and the method includes: The memory management component allocates communication memory from the memory of the computing device based on a memory request sent by the first process, and configures the first process and the plurality of second processes to have access rights to the communication memory, wherein the memory request is sent by the first process, and the communication memory is used to store communication data between the first process and the plurality of second processes; The memory management component notifies the first process and the plurality of second processes of an allocation result of the communication memory; The first process and any one of the plurality of second processes write communication data to be transmitted into the communication memory, and the first process and another one of the plurality of second processes read the communication data from the communication memory; In a case where the number of processes participating in the communication process between the first process and the plurality of second processes decreases relative to the plurality of second processes, the memory management component deletes the access rights of the second processes not participating in the communication process to the communication memory, and notifies the second processes not participating in the communication process that they no longer have the access rights to the communication memory; or, in a case where the number of processes participating in the communication process between the first process and the plurality of second processes is increased based on the plurality of second processes, the memory management component increases the access rights of the other processes to the communication memory, and notifies the other processes that they have the access rights to the communication memory; Among them, the first process and at least one of the multiple second processes can participate in multiple communication processes at the same time, the first process is the process that can participate in the least communication processes at the same time among the first process and the multiple second processes, and / or the complexity of the business processing logic of the first process is higher than the complexity of the business processing logic of the second process, and one communication process corresponds to one communication memory.
2. The method according to claim 1, wherein Before the memory management component allocates communication memory from the memory of the computing device based on the memory request, the method further includes: The first process sends a memory request to the memory management component, and the memory request requests the memory management component to allocate memory for the first process and the plurality of second processes to store communication data between the first process and the plurality of second processes.
3. The method according to claim 1 or 2, wherein: After the memory management component notifies the first process and the plurality of second processes of the allocation result of the communication memory, the method further includes: The memory management component monitors the actual usage of the communication memory; The memory management component adjusts the size of the communication memory when the actual usage meets a preset condition.
4. The method according to claim 3, wherein When the actual usage meets a preset condition, adjusting the size of the communication memory includes one or more of the following: When the actual usage is continuously less than a first threshold value within a specified period of time, reducing the size of the communication memory; When the actual usage reaches a second threshold, the size of the communication memory is increased.
5. The method according to claim 1, wherein Before the memory management component adjusts the access rights of the communication memory, the method further includes: In a case where the number of processes participating in the communication process between the first process and the multiple second processes decreases relative to the multiple second processes, or in a case where the number of processes participating in the communication process between the first process and the multiple second processes increases with other processes on the basis of the multiple second processes, the first process sends an access permission change request to the memory management component, and the access permission change request is used to request the memory management component to adjust the access permission of the communication memory.
6. The method according to any one of claims 1, 2, 4 or 5, wherein: After the memory management component notifies the first process and the plurality of second processes of the allocation result of the communication memory, the method further includes: After any process having access rights to the communication memory fails, the memory management component notifies all processes having access rights to the communication memory to stop using the communication memory.
7. The method according to any one of claims 1, 2, 4 or 5, wherein: After the memory management component notifies the first process and the plurality of second processes of the allocation result of the communication memory, the method further includes: The memory management component reallocates the communication memory after any process having access rights to the communication memory fails, and notifies all processes having access rights to the communication memory to use the reallocated communication memory; The first process communicates with the plurality of second processes by reading and / or writing data in the reallocated communication memory based on the notification.
8. The method according to any one of claims 1, 2, 4 or 5, wherein: After the memory management component notifies the first process and the plurality of second processes of the allocation result of the communication memory, the method further includes: The memory management component reclaims the communication memory.
9. The method according to claim 8, wherein Before the memory management component reclaims the communication memory, the method further includes: The memory management component receives a memory reclaim request sent by the first process; The memory management component reclaiming the communication memory includes: The memory management component reclaims the communication memory based on the memory reclaim request.
10. A communication device, characterized in that: The apparatus is applied to a computing device, and comprises: a memory management module, a first process module, and a plurality of second process modules communicating with the first process module, wherein the first process module and the plurality of second process modules belong to the same communication process; The memory management module is configured to allocate communication memory from the memory of the computing device based on a memory request, and configure the first process module and the plurality of second process modules to have access rights to the communication memory, wherein the memory request is sent by the first process module, and the communication memory is configured to store communication data between the first process module and the plurality of second process modules; The memory management module is further configured to notify the first process module and the plurality of second process modules of the allocation result of the communication memory; The first process module and any one of the plurality of second process modules are used to write the communication data to be transmitted into the communication memory, and the first process module and another one of the plurality of second process modules are used to read the communication data from the communication memory; The memory management module is configured to, when the number of processes participating in the communication process between the first process and the plurality of second processes decreases relative to the plurality of second processes, delete the access rights of the second processes not participating in the communication process to the communication memory, and notify the second processes not participating in the communication process that they no longer have access rights to the communication memory; or, when other processes are added to the number of processes participating in the communication process between the first process and the plurality of second processes on the basis of the plurality of second processes, add the access rights of the other processes to the communication memory, and notify the other processes that they have access rights to the communication memory; Among them, the first process module and at least one process module among the multiple second process modules can participate in multiple communication processes at the same time, the first process module is the process that can participate in the least communication processes at the same time among the first process module and the multiple second process modules, and / or the complexity of the business processing logic of the first process is higher than the complexity of the business processing logic of the second process, and one communication process corresponds to one communication memory.
11. The device according to claim 10, wherein The first process module is also used to send a memory request to the memory management module, and the memory request requests the memory management module to allocate memory for the first process module and the multiple second process modules to store communication data between the first process module and the multiple second process modules.
12. The device according to claim 10 or 11, characterized in that The memory management module is further configured to monitor the actual usage of the communication memory, and adjust the size of the communication memory when the actual usage meets a preset condition.
13. The device according to claim 12, wherein When the actual usage meets a preset condition, adjusting the size of the communication memory includes one or more of the following: When the actual usage is continuously less than a first threshold value within a specified period of time, reducing the size of the communication memory; When the actual usage reaches a second threshold, the size of the communication memory is increased.
14. The device according to claim 11, wherein The first process module is further used to send an access permission change request to the memory management module when the number of processes participating in the communication process between the first process and the multiple second processes decreases relative to the multiple second processes, or when other processes are added to the number of processes participating in the communication process between the first process and the multiple second processes on the basis of the multiple second processes. The access permission change request is used to request the memory management module to adjust the access permissions of the communication memory.
15. The device according to any one of claims 10, 11, 13 or 14, characterized in that The memory management module is further configured to notify all processes having access rights to the communication memory to stop using the communication memory after any process having access rights to the communication memory fails.
16. The device according to any one of claims 10, 11, 13 or 14, characterized in that The memory management module is further configured to reallocate the communication memory after any process having access rights to the communication memory fails, and to notify all processes having access rights to the communication memory to use the reallocated communication memory; The first process module and the plurality of second process modules are further configured to communicate by reading and / or writing data in the reallocated communication memory based on the notification.
17. The device according to any one of claims 10, 11, 13 or 14, characterized in that The memory management module is also used to reclaim the communication memory.
18. The device according to claim 17, wherein The memory management module is further configured to receive a memory reclaim request sent by the first process module; The memory management module is specifically configured to reclaim the communication memory based on the memory reclaim request.
19. A computing device, characterized in that The method comprises a memory and a processor, wherein the memory stores program instructions, and the processor runs the program instructions to execute the method according to any one of claims 1 to 9.
20. A computer-readable storage medium, characterized in that The method comprises program instructions, which, when executed on a computing device, cause the computing device to execute the method according to any one of claims 1 to 9.
21. A computer program product, characterized in that When the computer program product is run on a computer, the computer is enabled to perform the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Process-to-process communication method, device and system
CN103176854A
Shared memory access permission setting method and device, electronic equipment and storage medium
CN111638968A
Cross-process memory sharing method and device, terminal and vehicle
CN115016957A
Establishment of multiple process spanned communication programme in multiple linear equation running environment
CN1289962A