Virtual machine communication method and device, storage medium and electronic equipment
By comparing the channel request identifier and the existing channel identifier in the virtual machine communication request signal, deciding whether to use an existing channel or create a new channel, the problem of low communication efficiency of virtual machine and large burden on the manager is solved, and more efficient communication processing is achieved.
Patent Information
- Application Number
- CN202311540580.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-17
- Publication Date
- 2025-05-20
AI Technical Summary
In the prior art, the efficiency of establishing communication connections between virtual machines is low, and the data processing burden of the manager is relatively high.
By identifying the channel request identifier in the communication request signal, it is compared with the channel identifier of the existing communication channel. If the same channel identifier exists, the existing communication channel is used. Otherwise, a new communication channel is established and the channel request identifier is added to the existing channel identification.
It improves the processing efficiency of virtual machine communication requests, reduces the need for managers to create new communication channels, and reduces the amount of data processing and the burden on managers.
Smart Images

Figure CN120020716A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of information processing technologies, and particularly relates to a virtual machine communication method, apparatus, storage medium, and electronic device. Background Art
[0002] The role of a virtual machine (VM: Virtual Machine) is a software system generated through software simulation, having the functions of a hardware system, and running in a completely isolated environment. The virtual machine is almost the same as the system it simulates, except that the hard disk of the virtual machine is virtually processed in a selected file, so its settings can be modified at will without affecting the system itself. Therefore, it is widely used in various system networks. In actual applications, a system network includes multiple virtual machines and a manager, and each virtual machine can communicate and connect with the manager. When a virtual machine needs to communicate and connect with another virtual machine to transmit data, the virtual machine that outputs data requests the manager to establish a communication connection, and the manager establishes a communication channel according to the request. One end of the communication channel receives the output data and the other end is connected to the virtual machine that receives the data.
[0003] In the existing virtual machine communication method, every time a virtual machine needs to establish a communication connection with another virtual machine, it needs to send a request to the manager, and the manager determines the other virtual machine and establishes a communication channel. As the communication requirements between different virtual machines increase, the number of repetitions of the above process also increases, and the communication efficiency between different virtual machines will be greatly affected, and the burden on the manager will also increase. Summary of the Invention
[0004] The technical problem to be solved by this application is that the efficiency is relatively low when different virtual machines in the prior art establish communication connections, and the data processing burden on the manager is relatively large. For this reason, this application proposes a virtual machine communication method, apparatus, storage medium, and electronic device.
[0005] In a first aspect, the technical solution of this application provides a virtual machine communication method, including:
[0006] In response to a communication request signal, identifying a channel request identifier included in the communication request signal; the communication request signal is sent by a virtual machine;
[0007] Comparing the channel request identifier with the channel identifiers of existing communication channels;
[0008] If the channel request identifier is the same as any one of the channel identifiers, using the existing communication channel corresponding to the same channel identifier as the communication channel corresponding to the communication request signal.
[0009] In some embodiments of the virtual machine communication method, it further includes:
[0010] If the channel request identifier is different from each of the channel identifiers, a target communication channel corresponding to the channel request identifier is established;
[0011] The channel request identifier is added to the channel identifiers of the existing communication channels.
[0012] In some of the described virtual machine communication methods, the process of establishing a target communication channel corresponding to the channel request identifier includes:
[0013] Select the physical memory of a preset space as the target communication channel, and use the channel request identifier as the channel identifier of the target communication channel; the physical memory communicates with the payload storage space, and the payload storage space is used to store valid data;
[0014] The target communication channel is used to read and / or write target type data in the payload storage space, and the target type data has a corresponding relationship with the communication request signal.
[0015] In some of the described virtual machine communication methods, it further includes:
[0016] Identify the target virtual machine information included in the communication request signal;
[0017] In response to a data write signal, a signal for reminding to read data is sent to the target virtual machine corresponding to the target virtual machine information, and the communication channel corresponding to the communication request identifier is connected to the target virtual machine; the data write signal indicates that the virtual machine has completed the operation of writing data into the payload storage space.
[0018] In some of the described virtual machine communication methods, it further includes:
[0019] Obtain the number of virtual machines connected to each communication channel; wherein, a communication channel is connected to a virtual machine means that at least one application process in the virtual machine occupies the communication channel;
[0020] If the number of virtual machines connected to any communication channel is zero, the physical memory selected for the communication channel is released.
[0021] In some of the described virtual machine communication methods, the obtaining of the number of virtual machines connected to each communication channel includes:
[0022] When each communication channel is first established, a counting variable is allocated for the communication channel, the counting variable is associated with its channel identifier and the initial value of the counting variable is one;
[0023] For each additional virtual machine connected to the communication channel, the value of its count variable is incremented by one; for each virtual machine disconnected from the communication channel, the value of its count variable is decremented by one.
[0024] Obtain the real-time value of the count variable of the communication channel as the number of virtual machines connected thereto.
[0025] In some embodiments of the virtual machine communication method, the method further includes:
[0026] In response to a channel destruction request signal, identify the channel identifier of the channel to be destroyed included in the channel destruction request signal; the channel destruction request signal is sent by a virtual machine.
[0027] Delete the channel identifier of the channel to be destroyed and release the physical memory of the channel to be destroyed.
[0028] In some embodiments of the virtual machine communication method, the method further includes:
[0029] Obtain the target virtual machine information connected to the channel to be destroyed;
[0030] Send information indicating that the channel to be destroyed has been destroyed to the target virtual machine corresponding to the target virtual machine information.
[0031] In a second aspect, the technical solution of the present application provides a virtual machine communication device, including:
[0032] A request signal acquisition module, configured to identify a channel request identifier included in the communication request signal in response to the communication request signal; the communication request signal is sent by a virtual machine.
[0033] A comparison module, configured to compare the channel request identifier with the channel identifiers of existing communication channels.
[0034] An execution module, configured to, if the channel request identifier is the same as any one of the channel identifiers, no new communication channel needs to be created.
[0035] In a third aspect, the technical solution of the present application provides a computer-readable storage medium, in which program information is stored, and after a computer reads the program information, it executes the virtual machine communication method according to any one of the first aspects.
[0036] In a fourth aspect, the technical solution of the present application provides an electronic device, the electronic device includes at least one processor and at least one memory, at least one of the memories stores program information, and after at least one of the processors reads the program information, it executes the virtual machine communication method according to any one of the first aspects.
[0037] Adopting the above technical solutions, the following beneficial effects are achieved:
[0038] The virtual machine communication method, device, storage medium, and electronic device provided by this application, after responding to a communication request signal, identify the channel request identifier included in the communication request signal, and compare the channel request identifier with the channel identifiers of existing communication channels. If the channel request identifier is the same as any one of the channel identifiers, it means that the communication channel corresponding to the channel request identifier already exists, and the existing communication channel corresponding to the same channel identifier is used as the communication channel corresponding to the communication request signal, without the need to perform the operation of creating a new communication channel. Through the above technical solution provided by this application, first, it is determined that there is a situation where the same channel identifier already exists, and in this situation, there is no need to perform the step of establishing a communication channel. In practical applications, the processing efficiency of virtual machine communication requests can be improved, and the manager does not need to create a new communication channel for each communication request signal, reducing the amount of data processing and its burden. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 It is a flowchart of the virtual machine communication method in an embodiment of this application;
[0040] Figure 2 It is a schematic framework diagram of the virtual machine system network in an embodiment of this application;
[0041] Figure 3 It is a schematic diagram of the dual storage method of the channel identifier in an embodiment of this application;
[0042] Figure 4 It is a structural block diagram of the virtual machine communication device in an embodiment of this application;
[0043] Figure 5 It is a schematic diagram of the hardware connection relationship of the electronic device for executing the virtual machine communication method in an embodiment of this application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0044] The following further describes the specific embodiments of this application with reference to the drawings.
[0045] It is easy to understand that according to the technical solution of this application, under the condition of not changing the essence of this application, there are various structural ways and implementation ways that can be mutually replaced by those of ordinary skill in the art. Therefore, the following specific embodiments and the drawings are only exemplary descriptions of the technical solution of this application, and should not be regarded as all of this application or as a limitation or restriction on the technical solution of the application.
[0046] In this specification, the directional terms such as up, down, left, right, front, back, front side, back side, top, bottom, etc., which are mentioned or may be mentioned, are defined with respect to the structures shown in the respective drawings. They are relative concepts and may therefore change accordingly depending on their different positions and usage states. Therefore, these or other directional terms should not be construed as restrictive terms.
[0047] An embodiment of the present application provides a virtual machine communication method, which is applied to a manager in a virtual machine system network. The manager can communicate with multiple virtual machines, as Figure 1 shown, including:
[0048] S10: In response to a communication request signal, identify the channel request identifier included in the communication request signal; the communication request signal is sent by a virtual machine.
[0049] In combination with Figure 2 the system network shown, taking three virtual machines VM0, VM1, and VM2 as an example for illustration. Any one of the virtual machines can send a communication request signal to the manager. The communication request signal may include a channel request identifier, and the channel request identifier can be determined according to the user operation on the virtual machine. For example, if the user operates a certain application process, after the application process is triggered, a request signal corresponding to the application process can be generated, and the name of the application process, etc., can be used as the channel request identifier.
[0050] In the manager, memory generation units corresponding to each virtual machine are divided from the actual storage space. In the memory generation units, a first mapping module, a second mapping module, and a third mapping module are respectively divided. The first mapping module is mapped to the virtual machine with read-only permission, the second mapping module is mapped to the virtual machine with read-write permission to determine the one-way data transmission channel from the virtual machine to the manager, and the third mapping module is mapped to the virtual machine with read-write permission to determine the one-way data transmission channel from the manager to the virtual machine. The channels can be used to transmit information such as channel identifiers and physical memory spaces.
[0051] S20: Compare the channel request identifier with the channel identifiers of the existing communication channels.
[0052] As Figure 2 shown, when the virtual machine V0 sends a communication request signal for the first time, if the channel request identifier is channel identifier A, then there is already a communication channel with channel identifier A in the manager at this time. If the channel request identifier is C, then there is no communication channel with channel identifier C in the manager.
[0053] S30: If the channel request identifier is the same as any one of the channel identifiers, use the existing communication channel corresponding to the same channel identifier as the communication channel corresponding to the communication request signal.
[0054] That is, if the channel request identifier is channel identifier A, a communication channel with channel identifier A already exists in the manager at this time, so there is no need to create a new communication channel, and the existing communication channel corresponding to channel identifier A can be directly used.
[0055] In the above solution of this embodiment, after receiving a communication request signal, the channel request identifier included in the communication request signal is identified, and the channel request identifier is compared with the channel identifiers of existing communication channels. If the channel request identifier is the same as any one of the channel identifiers, it means that the communication channel corresponding to the channel request identifier already exists, and the existing communication channel corresponding to the same channel identifier is used as the communication channel corresponding to the communication request signal, and there is no need to perform the operation of creating a new communication channel. Through the above technical solution provided by this application, the situation where the same channel identifier already exists is first judged, and in this situation, there is no need to perform the step of establishing a communication channel. In actual application, the processing efficiency of virtual machine communication requests can be improved, and the manager does not need to create a new communication channel for each communication request signal, reducing the amount of data processing and its burden.
[0056] Further, the virtual machine communication method further includes:
[0057] S40: If the channel request identifier is different from each of the channel identifiers, a target communication channel corresponding to the channel request identifier is established.
[0058] For example, if the channel request identifier is C, there is no communication channel with channel identifier C in the manager, and at this time, a target communication channel corresponding to the channel request identifier C needs to be established.
[0059] S50: Add the channel request identifier to the channel identifiers of the existing communication channels.
[0060] After creating a new communication channel, the channel identifiers of the existing communication channels include A, B, and C.
[0061] In the above solution, when any channel request identifier appears for the first time, there is no corresponding communication channel in the manager. At this time, a new communication channel is created, and the channel identifier of the newly created communication channel is marked as the channel request identifier. Taking Figure 2 the system network shown as an example, after the virtual machine V0 sends a communication request signal for the first time, the manager creates a communication channel with channel identifier A. After that, when the virtual machine V1 or V2 sends a channel request signal with channel identifier A again, the manager does not need to create a new communication channel.
[0062] The above solution of this application can not only effectively improve the efficiency of establishing communication connections between virtual machines and reduce the data processing burden of the manager. Moreover, it can create or adjust the communication connections between different virtual machines at any time during the operation of the virtual machines, with higher flexibility.
[0063] Further, in the virtual machine communication method, the process of establishing a target communication channel corresponding to the channel request identifier includes:
[0064] S401: Select the physical memory in the preset space as the target communication channel, and use the channel request identifier as the channel identifier of the target communication channel; the physical memory communicates with the payload storage space, and the payload storage space is used to store valid data. The target communication channel is used to read and / or write target type data in the payload storage space, and the target type data has a corresponding relationship with the communication request signal.
[0065] Combined with Figure 2 As shown, a payload storage space is allocated in the manager, and valid data is stored in the payload storage space. That is, when different virtual machines need to read and write data, they all perform data read and write operations on the payload storage space. Therefore, when establishing a communication channel, each communication channel needs to be connected to the payload storage space. And each communication channel is established in response to a communication request signal, so the data types that each communication channel can read and write are also corresponding to the communication request signal. With this solution, the existing communication channels are connected to the payload space correspondingly, and the communication connection between virtual machines can be realized without creating new communication channels. As mentioned above, the communication request signal can be determined according to the application process being operated on the virtual machine. Assuming that the application process being operated is an image processing application process, the corresponding data type is the image type.
[0066] Further, the virtual machine communication method in the above solution further includes:
[0067] S60: Identify the target virtual machine information included in the communication request signal.
[0068] For example, if the virtual machine VM0 sends a communication request signal and hopes to transmit data to the virtual machines V1 and V2, the target virtual machine information can represent the virtual machines V1 and V2.
[0069] S70: In response to the data write signal, send a signal reminding the target virtual machine to read data to the target virtual machine corresponding to the target virtual machine information, and connect the target virtual machine to the communication channel corresponding to the communication request identifier; the data write signal indicates that the virtual machine has completed the operation of writing data into the payload storage space.
[0070] The write signal indicates that the virtual machine VM0 has successfully written data to the payload storage space. Subsequently, a signal for reminding to read data can be sent to the virtual machine V1 and the virtual machine V2 through the signal sending unit shown in Figure 2 The communication channels with the channel identifier A are connected to the virtual machine V1 and the virtual machine V2. The virtual machine V1 and the virtual machine V2 can then read the data written by the virtual machine VM0 through the communication channels with the channel identifier A, thereby realizing the function of the virtual machine VM0 transmitting data to the virtual machine V1 and the virtual machine V2. With this solution, the existing communication channels are correspondingly connected to the payload space, and at the same time, the virtual machine and the target virtual machine are also connected to the existing communication channels, enabling the virtual machine to be communicated with and the target virtual machine to be connected to the payload storage space to achieve their communication connection without creating a new communication channel, thus realizing the efficient utilization of resources.
[0071] Preferably, the virtual machine communication method in the above solution further includes:
[0072] S80: Obtain the number of virtual machines connected to each communication channel; wherein, the connection of the communication channel to the virtual machine means that at least one application process in the virtual machine occupies the communication channel.
[0073] The manager can count the number of virtual machines connected to each communication channel. Referring to Figure 3 As shown, there are two application processes in the virtual machine VM0 occupying the communication channel with the communication identifier A, and there is one application process in the virtual machine VM1 occupying the communication channel with the communication identifier A. Then, the communication channel with the communication identifier A is connected to the two virtual machines VM0 and VM1. Correspondingly, the virtual machine VM0 will also record the occupancy count of the communication channel with the communication identifier A as (application process 1, application process 2), and the virtual machine VM1 will also record the occupancy count of the communication channel with the communication identifier A as (application process 11). If the occupancy counts of the communication channel with the communication identifier A in the virtual machine VM0 and the virtual machine VM1 are both zero, the number of virtual machines connected to the corresponding communication channel with the communication identifier A will also become zero. It is equivalent to maintaining two different counting concepts at the manager and virtual machine levels to determine whether the communication channel is occupied.
[0074] S90: If the number of virtual machines connected to any communication channel is zero, release the physical memory selected for this communication channel.
[0075] If there are no longer any virtual machines connected to a certain communication channel, that is, no application process in any virtual machine occupies this communication channel, then there is no longer a need for data communication on this communication channel, and it can be released for use by the remaining communication channels.
[0076] Preferably, in the above solution, the obtaining the number of virtual machines connected to each communication channel includes:
[0077] S801: When each said communication channel is first established, allocate a counting variable for the communication channel. The counting variable is associated with its channel identifier and the initial value of the counting variable is one.
[0078] For example, after virtual machine VM0 requests to establish a communication channel with channel identifier A, the count of channel identifier A is one. At this time, only virtual machine VM0 is connected to the communication channel with channel identifier A.
[0079] S802: When the number of virtual machines connected to the communication channel increases by one, the value of its counting variable is incremented by one; when the number of virtual machines connected to the communication channel decreases by one, the value of its counting variable is decremented by one.
[0080] If subsequently, virtual machines VM1 and VM2 are connected to the communication channel with channel identifier A, then the count of channel identifier A is three.
[0081] S803: Obtain the real-time value of the counting variable of the communication channel as the number of virtual machines connected thereto.
[0082] The real-time value of the counting variable read at any moment is the number of virtual machines at that moment.
[0083] In some other solutions, the method further includes:
[0084] S110: In response to a channel destruction request signal, identify the channel identifier of the channel to be destroyed included in the channel destruction request signal; the channel destruction request signal is sent by a virtual machine.
[0085] S120: Delete the channel identifier of the channel to be destroyed and release the physical memory of the channel to be destroyed.
[0086] After the information to be transmitted between two virtual machines is transmitted, the communication channel is no longer needed and can be used as a communication channel to be destroyed. The virtual machine that requests to establish the communication channel sends a channel destruction request signal to the manager, carrying the request identifier of the channel to be destroyed in the channel destruction request signal. Through this solution, useless communication channels can be released in a timely manner for other virtual machines to use during communication, improving resource utilization.
[0087] Further, after the communication channel to be destroyed completes the destruction operation, the method further includes:
[0088] S130: Obtain the information of the target virtual machine connected to the channel to be destroyed.
[0089] S140: Send information that the channel to be destroyed has been destroyed to the target virtual machine corresponding to the information of the target virtual machine.
[0090] This solution notifies the target virtual machine in a timely manner of the information that the communication channel connected to the target virtual machine has been destroyed, enabling the target virtual machine to disconnect the interface connection on this communication channel in a timely manner and avoiding invalid data transmission and reception.
[0091] Some embodiments of this application also provide a virtual machine communication device, as Figure 4 shown, including:
[0092] A request signal acquisition module 10, configured to identify a channel request identifier included in the communication request signal in response to the communication request signal; the communication request signal is sent by the virtual machine; the communication request signal may include a channel request identifier, and the channel request identifier may be determined according to a user operation on the virtual machine. For example, if a user operates a certain application process, the application process can generate a request signal corresponding to the application process after being triggered, and the name of the application process, etc. can be used as the channel request identifier. In the manager, a memory generation unit corresponding to each virtual machine is divided from the actual storage space, and a first mapping module, a second mapping module, and a third mapping module are respectively divided in the memory generation unit. The first mapping module is mapped to the virtual machine with read-only permission, the second mapping module is mapped to the virtual machine with read-write permission to determine a one-way data transmission channel from the virtual machine to the manager, and the third mapping module is mapped to the virtual machine with read-write permission to determine a one-way data transmission channel from the manager to the virtual machine. The channel can be used to transmit information such as channel identifiers and physical memory spaces.
[0093] A comparison module 20, configured to compare the channel request identifier with the channel identifiers of existing communication channels; if the channel request identifier is channel identifier A, then there is already a communication channel with channel identifier A in the manager at this time. If the channel request identifier is C, then there is no communication channel with channel identifier C in the manager.
[0094] An execution module 30, configured to, if the channel request identifier is the same as any one of the channel identifiers, use the existing communication channel corresponding to the same channel identifier as the communication channel corresponding to the communication request signal. That is, if the channel request identifier is channel identifier A, and there is already a communication channel with channel identifier A in the manager at this time, there is no need to create a new communication channel.
[0095] In the above solution of this embodiment, after responding to a communication request signal, the channel request identifier included in the communication request signal is recognized, and the channel request identifier is compared with the channel identifiers of the existing communication channels. If the channel request identifier is the same as any one of the channel identifiers, it means that the communication channel corresponding to the channel request identifier already exists, and the existing communication channel corresponding to the same channel identifier is used as the communication channel corresponding to the communication request signal, and there is no need to perform the operation of creating a new communication channel. Through the above technical solution provided by this application, the situation where the same channel identifier already exists is first judged, and in this situation, there is no need to perform the step of establishing a communication channel. In actual application, the processing efficiency of virtual machine communication requests can be improved, and the manager does not have to create a new communication channel for each communication request signal, reducing the data processing volume and its burden.
[0096] Further, the virtual machine communication device further includes:
[0097] A channel establishment module, configured to establish a target communication channel corresponding to the channel request identifier if the channel request identifier is not the same as each of the channel identifiers; and add the channel request identifier to the channel identifiers of the existing communication channels. For example, if the channel request identifier is C, there is no communication channel with the channel identifier C in the manager. At this time, it is necessary to establish a target communication channel corresponding to the channel request identifier C. After creating a new communication channel, the channel identifiers of the existing communication channels include A, B, and C. In this solution, when any channel request identifier appears for the first time, there is no corresponding communication channel in the manager. At this time, a new communication channel is created, and the channel identifier of the newly created communication channel is marked as the channel request identifier. The above solution of this application can not only effectively improve the efficiency of establishing communication connections between virtual machines and reduce the data processing burden on the manager. Moreover, it can create or adjust the communication connections between different virtual machines at any time during the operation of the virtual machine, with higher flexibility.
[0098] Further, the channel establishment module is configured to select the physical memory of the preset space as the target communication channel, and use the channel request identifier as the channel identifier of the target communication channel; the physical memory communicates with the payload storage space, and the payload storage space is used to store valid data. The target communication channel is used to read and / or write the target type data in the payload storage space, and the target type data has a corresponding relationship with the communication request signal. A payload storage space is allocated in the manager, and valid data is stored in the payload storage space. That is, when different virtual machines need to read and write data, the data read and write operations are all performed on the payload storage space. Therefore, when establishing a communication channel, each communication channel needs to be connected to the payload storage space. And each communication channel is established in response to a communication request signal, so the data types that each communication channel can read and write are also corresponding to the communication request signal. With this solution, the existing communication channels are connected to the payload space correspondingly, and the communication connection between virtual machines can be realized without creating new communication channels. As mentioned above, the communication request signal can be determined according to the application process being operated on the virtual machine. Suppose the application process being operated is an image processing application process, then the corresponding data type is the image type.
[0099] Further, the apparatus further includes:
[0100] The target connection module is configured to identify the target virtual machine information included in the communication request signal; in response to the data write signal, send a signal to remind the target virtual machine corresponding to the target virtual machine information to read data, and connect the target virtual machine to the communication channel corresponding to the communication request identifier; the data write signal indicates that the virtual machine has completed the operation of writing data into the payload storage space. For example, if the virtual machine VM0 sends a communication request signal and hopes to transfer data to the virtual machines V1 and V2, then the target virtual machine information can represent the virtual machines V1 and V2. The write signal corresponds to the fact that the virtual machine VM0 has successfully written data into the payload storage space, and then sends a signal to remind the virtual machines V1 and V2 to read the data, and connects the virtual machines V1 and V2 to the communication channel with the channel identifier A. The virtual machines V1 and V2 can then read the data written by the virtual machine VM0 through the communication channel with the channel identifier A, thereby realizing the function of the virtual machine VM0 transferring data to the virtual machines V1 and V2. With this solution, the existing communication channels are connected to the payload space correspondingly, and at the same time the virtual machine and the target virtual machine are also connected to the existing communication channel, which can realize the communication connection between the virtual machine to be communicated and the target virtual machine by connecting them to the payload storage space without creating new communication channels, and realize the efficient utilization of resources.
[0101] Preferably, the above solution further includes a memory release module, configured to obtain the number of virtual machines connected to each communication channel, where connecting a virtual machine to the communication channel means that at least one application process in the virtual machine occupies the communication channel; if the number of virtual machines connected to any communication channel is zero, the physical memory selected for the communication channel is released. The manager can count the number of virtual machines connected to each communication channel. If there are no longer any virtual machines connected to a certain communication channel, there is no longer a need for data communication on that communication channel, and it can be released for use by the remaining communication channels.
[0102] Preferably, in the above solution, the memory release module is used to allocate a counting variable for each communication channel when the communication channel is first established. The counting variable is associated with its channel identifier and the initial value of the counting variable is one. For each additional virtual machine connected to the communication channel, the value of its counting variable is incremented by one; for each virtual machine removed from the communication channel, the value of its counting variable is decremented by one. The real-time value of the counting variable of the communication channel is obtained as the number of virtual machines connected thereto. For example, after the virtual machine VM0 requests to establish a communication channel with the channel identifier A, the count of the channel identifier A is one, and at this time only the virtual machine VM0 is connected to the communication channel with the channel identifier A. If subsequently, the virtual machines VM1 and VM2 are connected to the communication channel with the channel identifier A, then the count of the channel identifier A is three. The real-time value of the counting variable read at any time is the number of virtual machines at that time.
[0103] In some other solutions, the device further includes:
[0104] A channel destruction module, configured to respond to a channel destruction request signal, identify the channel identifier of the channel to be destroyed included in the channel destruction request signal; the channel destruction request signal is sent by a virtual machine; delete the channel identifier of the channel to be destroyed, and release the physical memory of the channel to be destroyed. In this solution, after the information to be transmitted between two virtual machines is transmitted, the communication channel is no longer needed and can be used as a communication channel to be destroyed. The virtual machine that requests to establish the communication channel sends a channel destruction request signal to the manager, carrying the request identifier of the channel to be destroyed in the channel destruction request signal. Through this solution, useless communication channels can be released in time for other virtual machines to use when communicating, improving resource utilization.
[0105] Further, the device further includes:
[0106] An information reporting module, configured to obtain target virtual machine information connected to a channel to be destroyed; and send information indicating that the channel to be destroyed has been destroyed to the target virtual machine corresponding to the target virtual machine information. This solution timely notifies the target virtual machine of the information that the communication channel connected to the target virtual machine has been destroyed, enabling the target virtual machine to timely disconnect the interface connection on this communication channel and avoiding invalid data transmission and reception.
[0107] An embodiment of the present application further provides a computer-readable storage medium, in which program information is stored, and after a computer reads the program information, it executes the virtual machine communication method described in any one of the above embodiments.
[0108] An embodiment of the present application further provides an electronic device, as Figure 5 shown. The electronic device includes at least one processor 51 and at least one memory 52. Program information is stored in at least one of the memories 52, and after at least one of the processors 51 reads the program information, it executes the virtual machine communication method described in any one of the above method embodiments. The device may further include: an input device 53 and an output device 54. The processor 51, the memory 52, the input device 53, and the output device 54 can be communicatively connected. The memory 52, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. The processor 51 executes various functional applications and data processing by running the non-volatile software programs, instructions, and modules stored in the memory 52, that is, implements the virtual machine communication method provided in any of the above solutions. The memory 52 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system and application programs required for at least one function; the data storage area can store data created according to the use of the virtual machine communication method, etc. In addition, the memory 52 may include a high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other non-volatile solid-state storage devices. In some embodiments, the memory 52 may optionally include a memory remotely set relative to the processor 51, and these remote memories can be connected to the device executing the virtual machine communication method through a network. Examples of the above network include but are not limited to the Internet, an enterprise internal network, a local area network, a mobile communication network, and combinations thereof. The input device 53 can receive input user clicks and generate signal inputs related to user settings and function controls of the virtual machine communication method. The output device 54 may include a display device such as a display screen. When the one or more modules are stored in the memory 52 and run by the one or more processors 51, the virtual machine communication method in any of the above method embodiments is executed.
[0109] According to needs, the above technical solutions can be combined to achieve the best technical effect.
[0110] The above are only the principles and preferred embodiments of this application. It should be noted that for those of ordinary skill in the art, based on the principles of this application, several other variations can also be made, which should also be regarded as the protection scope of this application.
Claims
1. A virtual machine communication method, characterized in that: include: In response to a communication request signal, identifying a channel request identifier contained in the communication request signal; the communication request signal is sent by the virtual machine; Comparing the channel request identifier with the channel identifier of the existing communication channel; If the channel request identifier is the same as any of the channel identifiers, the existing communication channel corresponding to the same channel identifier is used as the communication channel corresponding to the communication request signal.
2. The virtual machine communication method according to claim 1, characterized in that: Also includes: If the channel request identifier is different from each of the channel identifiers, establishing a target communication channel corresponding to the channel request identifier; The channel request identifier is added to the channel identifier of the existing communication channel.
3. The virtual machine communication method according to claim 2, characterized in that: The process of establishing a target communication channel corresponding to the channel request identifier includes: A physical memory of a preset space is selected as the target communication channel, and the channel request identifier is used as the channel identifier of the target communication channel; the physical memory is interconnected with a payload storage space, and the payload storage space is used to store valid data; The target communication channel is used to perform a read and / or write operation on target type data in the payload storage space, and the target type data has a corresponding relationship with the communication request signal.
4. The virtual machine communication method according to claim 3, characterized in that: Also includes: Identifying target virtual machine information included in the communication request signal; In response to a data write signal, a signal reminding the target virtual machine corresponding to the target virtual machine information to read data is sent to connect the target virtual machine with the communication channel corresponding to the communication request identifier; the data write signal indicates that the virtual machine completes the operation of writing data into the payload storage space.
5. The virtual machine communication method according to any one of claims 2 to 4, characterized in that: Also includes: Obtaining the number of virtual machines connected to each communication channel; wherein the communication channel connected to the virtual machine means that at least one application process in the virtual machine occupies the communication channel; If the number of virtual machines connected to any communication channel is zero, the physical memory selected for the communication channel is released.
6. The virtual machine communication method according to claim 5, characterized in that: The obtaining the number of virtual machines connected to each communication channel includes: When each communication channel is first established, a counting variable is allocated to the communication channel, the counting variable is associated with its channel identifier and an initial value of the counting variable is one; Every time the number of virtual machines connected to the communication channel increases by one, the value of the counting variable increases by one; every time the number of virtual machines connected to the communication channel decreases by one, the value of the counting variable decreases by one; The real-time value of the count variable of the communication channel is obtained as the number of virtual machines connected thereto.
7. The virtual machine communication method according to claim 3 or 4, characterized in that: Also includes: In response to a channel destruction request signal, identifying a channel identifier of a channel to be destroyed contained in the channel destruction request signal; The channel destruction request signal is sent by the virtual machine; The channel identifier of the channel to be destroyed is deleted, and the physical memory of the channel to be destroyed is released.
8. The virtual machine communication method according to claim 7, characterized in that: Also includes: Obtain information about the target virtual machine connected to the channel to be destroyed; Sending information indicating that the channel to be destroyed has been destroyed to the target virtual machine corresponding to the target virtual machine information.
9. A virtual machine communication device, characterized in that: include: A request signal acquisition module is configured to identify a channel request identifier contained in the communication request signal in response to the communication request signal; The communication request signal is sent by the virtual machine; A comparison module, configured to compare the channel request identifier with the channel identifier of the existing communication channel; The execution module is configured to use the existing communication channel corresponding to the same channel identifier as the communication channel corresponding to the communication request signal if the channel request identifier is the same as any one of the channel identifiers.
10. A computer-readable storage medium, characterized in that: The storage medium stores program information, and the computer reads the program information and executes the virtual machine communication method according to any one of claims 1 to 8.
11. An electronic device, characterized in that: The electronic device includes at least one processor and at least one memory, at least one of the memories stores program information, and at least one of the processors reads the program information and executes the virtual machine communication method according to any one of claims 1 to 8.