CN114327944A - Method, device, equipment and storage medium for sharing memory by multiple systems - Google Patents

Method, device, equipment and storage medium for sharing memory by multiple systems Download PDF

Info

Publication number
CN114327944A
CN114327944A CN202111598360.2A CN202111598360A CN114327944A CN 114327944 A CN114327944 A CN 114327944A CN 202111598360 A CN202111598360 A CN 202111598360A CN 114327944 A CN114327944 A CN 114327944A
Authority
CN
China
Prior art keywords
virtual memory
memory device
shared memory
virtual
systems
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202111598360.2A
Other languages
Chinese (zh)
Other versions
CN114327944B (en
Inventor
殷灿菊
徐春强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Kedong Guangzhou Software Technology Co Ltd
Original Assignee
Kedong Guangzhou Software Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Kedong Guangzhou Software Technology Co Ltd filed Critical Kedong Guangzhou Software Technology Co Ltd
Priority to CN202111598360.2A priority Critical patent/CN114327944B/en
Publication of CN114327944A publication Critical patent/CN114327944A/en
Application granted granted Critical
Publication of CN114327944B publication Critical patent/CN114327944B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Multi Processors (AREA)
  • Memory System Of A Hierarchy Structure (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a method, a device, equipment and a storage medium for sharing memory by multiple systems, wherein each system in the multiple systems runs on the same processor, and the method comprises the following steps: adding a first virtual memory device into the respective device tree file of each system, wherein the first virtual memory device is the shared memory of each system; when each system is started, registering the first virtual memory device in the respective system according to the respective device tree file; and each system performs data interaction between systems through the first virtual memory device. The technical scheme of the embodiment of the invention is irrelevant to a microkernel operating system, has simple configuration and use, and is easy to transplant and expand.

Description

Method, device, equipment and storage medium for sharing memory by multiple systems
Technical Field
The present invention relates to the field of operating systems, and in particular, to a method, an apparatus, a device, and a storage medium for sharing a memory among multiple systems.
Background
The existing memory sharing scheme among multiple systems is realized based on shared memory pages, for example, the type1 virtualized systems acrn and xen respectively share the memory based on the internal pages and the authorization table, and the type2 virtualized system kvm-qemu realizes memory sharing based on shared files. Therefore, the prior art realizes the memory sharing between systems based on the virtualization hyper.
The method is not suitable for memory sharing among multiple systems based on an AMP (amplifier) architecture, which is deployed on a hardware processor, and the existing memory sharing technology is associated with memory management of an operating system, particularly has large coupling with a microkernel operating system, is complex in configuration and use, and is not easy to transplant and expand.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method, an apparatus, a device, and a storage medium for sharing a memory among multiple systems. Each system in the multiple systems can be a real-time system or a non-real-time system, all the systems run on the same processor, virtual memory devices corresponding to the same shared memory are defined in the device tree file of each system, so that the virtual memory devices are registered when the system is restarted, and data interaction between the systems on the shared memory is realized through the virtual memory devices by each system in the multiple systems. The technical scheme of the embodiment of the invention is irrelevant to a microkernel operating system, has simple configuration and use, and is easy to transplant and expand.
In a first aspect, an embodiment of the present invention provides a method for sharing a memory among multiple systems, where each system in the multiple systems operates on a same processor, and the method includes: adding a first virtual memory device in the device tree file of each system, wherein the first virtual memory device is a virtualization device of the shared memory of the multiple systems in each system; when each system is started, registering the first virtual memory device in each system according to each device tree file; and each system performs data interaction among the systems through the first virtual memory device.
In this way, by defining the virtual memory devices corresponding to the same shared memory in the device tree file of each system and registering the virtual memory devices when the system is restarted, each system in the multiple systems realizes data interaction on the shared memory through the virtual memory devices. The technical scheme of the embodiment of the invention is irrelevant to a microkernel operating system, and is simple to configure and use.
In one possible implementation manner of the first aspect, registering the first virtual memory device in the respective system includes: each system acquires information of the first virtual memory device from the respective device tree file; each system calls a respective virtual memory device driver according to the information of the first virtual memory device, isolates the shared memory from the respective system, and initializes the first virtual memory device; and after the initialization is completed, generating a device file of the first virtual memory device in each system.
Therefore, each system isolates the shared memory from the respective system by calling the respective virtual memory device driver, initializes the shared memory, generates the device file of the respective first virtual memory device, decouples the virtual memory device registration of the shared memory from the microkernel operating system, and is simple and convenient to register.
In one possible implementation manner of the first aspect, the virtual memory device driver of each system provides a method for each system to acquire information of the shared memory and a method for opening the first virtual memory device by the name of the first virtual memory device.
Therefore, the method for opening the first virtual memory device and the information of the shared memory are provided through the respective virtual memory device driver of each system, so that the operating level of each system is decoupled from the microkernel operating system, and the use is simple and convenient.
In a possible implementation manner of the first aspect, each system performs intersystem data interaction through the first virtual memory device, including: each system opens the first virtual memory device by using the name of the first virtual memory device; each system acquires information of the shared memory, including the address and the size of the shared memory; writing data into the address of the shared memory by a first system in each system; the second system in each system reads data from an address of the shared memory.
Therefore, the method for opening the first virtual memory device and the information of the shared memory are provided through the respective virtual memory device driver of each system, so that the operating level of each system is decoupled from the microkernel operating system, and the use is simple and convenient.
In a possible implementation manner of the first aspect, when the shared memory address or size is changed, the method further includes: modifying the address or/and the size of the shared memory of the first virtual memory device of each system; and when the first virtual memory device is restarted, each system registers the modified first virtual memory device into the respective system.
Therefore, when each system restarts the first virtual memory device, the modified first virtual memory device is registered in the respective system, so that the adjustment of the shared memory is realized, the shared memory is decoupled from the microkernel operating system, and the adjustment is simple and convenient.
In a possible embodiment of the first aspect, the plurality of systems comprises a number of non-real time systems and a number of real time systems.
Therefore, the method of the embodiments of the present invention may also interact data between systems of the shared memory of the heterogeneous system.
In one possible implementation of the first aspect, the first virtual memory devices of each system have the same name.
Therefore, the first virtual memory devices of each system have the same name, so that the system is simple and convenient to use and friendly in interface.
In a second aspect, an embodiment of the present invention provides an apparatus for sharing a memory among multiple systems, where each system in the multiple systems operates on a same processor, and the apparatus includes: a configuration module, configured to add a first virtual memory device to the device tree file of each system, where the first virtual memory device is a virtualized device in each system of the shared memory of the multiple systems; a registration module, configured to register the first virtual memory device in each system according to a respective device tree file when each system is started; and the interaction module is used for performing data interaction between the systems through the first virtual memory device by each system.
In this way, by defining the virtual memory devices corresponding to the same shared memory in the device tree file of each system and registering the virtual memory devices when the system is restarted, each system in the multiple systems realizes data interaction on the shared memory through the virtual memory devices. The technical scheme of the embodiment of the invention is irrelevant to a microkernel operating system, and is simple to configure and use.
In a possible implementation manner of the second aspect, the registration module is specifically configured to include: each system acquires information of the first virtual memory device from the respective device tree file; each system calls a respective virtual memory device driver according to the information of the first virtual memory device, isolates the shared memory from the respective system, and initializes the first virtual memory device; and after the initialization is completed, generating a device file of the first virtual memory device in each system.
Therefore, each system isolates the shared memory from the respective system by calling the respective virtual memory device driver, initializes the shared memory, generates the device file of the respective first virtual memory device, decouples the virtual memory device registration of the shared memory from the microkernel operating system, and is simple and convenient to register.
In one possible implementation manner of the second aspect, the virtual memory device driver of each system provides a method for each system to acquire information of the shared memory and a method for opening the first virtual memory device by the name of the first virtual memory device.
Therefore, the method for opening the first virtual memory device and the information of the shared memory are provided through the respective virtual memory device driver of each system, so that the operating level of each system is decoupled from the microkernel operating system, and the use is simple and convenient.
In one possible implementation of the second aspect, the interaction module comprises: the opening module is used for opening the first virtual memory device of each system by utilizing the name of the first virtual memory device; the module is opened. The method is also used for each system to acquire the information of the shared memory, including the address and the size of the shared memory; a write-in module, configured to write data to an address of the shared memory by a first system in each system; and the reading module is used for reading data from the address of the shared memory by the second system in each system.
Therefore, the method for opening the first virtual memory device and the information of the shared memory are provided through the respective virtual memory device driver of each system, so that the operating level of each system is decoupled from the microkernel operating system, and the use is simple and convenient.
In a possible implementation manner of the second aspect, when the shared memory address or size is changed, the configuration module is further configured to modify the address or/and size of the shared memory of the first virtual memory device of each system; the registration module is further configured to register, when each system restarts the first virtual memory device, the modified first virtual memory device in the respective system.
Therefore, when each system restarts the first virtual memory device, the modified first virtual memory device is registered in the respective system, so that the adjustment of the shared memory is realized, the shared memory is decoupled from the microkernel operating system, and the adjustment is simple and convenient.
In a possible embodiment of the second aspect, the plurality of systems comprises a plurality of non-real time systems and a plurality of real time systems.
Therefore, the method of the embodiments of the present invention may also interact data between systems of the shared memory of the heterogeneous system.
In one possible implementation of the second aspect, the first virtual memory devices of each system have the same name.
Therefore, the first virtual memory devices of each system have the same name, so that the system is simple and convenient to use and friendly in interface.
In a third aspect, embodiments of the invention provide a computing device comprising,
a bus;
a communication interface connected to the bus;
at least one processor coupled to the bus; and
at least one memory coupled to the bus and storing program instructions that, when executed by the at least one processor, cause the at least one processor to perform any of the embodiments of the first aspect of the present invention.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which program instructions are stored, where the program instructions, when executed by a computer, cause the computer to execute any one of the embodiments of the first aspect.
Drawings
FIG. 1 is a schematic diagram of a scenario in accordance with various embodiments of the present invention;
fig. 2A is a schematic flowchart illustrating an embodiment of a method for configuring a multi-system shared memory according to the present invention;
FIG. 2B is a diagram illustrating a physical memory structure of a multi-system including a shared memory according to the present invention;
FIG. 3 is a flowchart illustrating an embodiment of a data interaction method for a multi-system shared memory according to the present invention;
FIG. 4 is a flowchart illustrating an embodiment of a method for adjusting a shared memory of multiple systems according to the present invention;
FIG. 5 is a schematic structural diagram of an apparatus for sharing a memory among multiple systems according to the present invention;
fig. 6 is a schematic structural diagram of a computing device according to various embodiments of the present invention.
Detailed Description
In the following description, reference is made to "some embodiments" which describe a subset of all possible embodiments, but it is understood that "some embodiments" may be the same subset or different subsets of all possible embodiments, and may be combined with each other without conflict.
In the following description, references to the terms "first \ second \ third, etc." or module a, module B, module C, etc. are used solely to distinguish between similar objects or different embodiments and are not intended to imply a particular ordering with respect to the objects, it being understood that where permissible any particular ordering or sequence may be interchanged to enable embodiments of the invention described herein to be practiced otherwise than as shown or described herein.
In the following description, reference to reference numerals indicating steps, such as S110, S120 … …, etc., does not necessarily indicate that the steps are performed in this order, and the order of the preceding and following steps may be interchanged or performed simultaneously, where permissible.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. The terminology used herein is for the purpose of describing embodiments of the invention only and is not intended to be limiting of the invention.
The embodiments of the invention provide a method, a device, equipment and a storage medium for sharing a memory by multiple systems. Each system in the multiple systems can be a real-time system or a non-real-time system or a heterogeneous system combining the real-time system and the non-real-time system, all the systems run on the same processor, virtual memory devices corresponding to the same shared memory are defined in a device tree file of each system, so that the virtual memory devices are registered through a virtual machine memory device driver program when the systems are restarted, a method for accessing the virtual memory devices is obtained, and each system in the multiple systems realizes data interaction on the shared memory through the virtual memory devices. The technical scheme of the embodiment of the method is irrelevant to a microkernel operating system, simple in configuration and use and easy to transplant and expand.
Embodiments of the present invention are described below in conjunction with the following figures.
A scenario of embodiments of the present invention will first be described with reference to fig. 1.
Fig. 1 shows a scenario environment of multi-system Operation according to an embodiment of the present invention, and illustratively, the multi-system constituent heterogeneous system shown in fig. 1 operates on one processor, and the processor includes 4 processor cores (Core0, Core1, Core2, and Core3), wherein the Core0 and the Core1 support non-real-Time operating systems Window and Linux that operate through a Linux + KVM (Kernel-based Virtual Machine) Virtual Machine operating environment, and the Core2 and the Core3 support a real-Time operating system rtos (real Time Operation system) that operates through a real-Time Virtual Machine, and illustratively, the real-Time Virtual system includes a real-Time Virtual Machine of an Intewell (industrial internet operating system).
In the heterogeneous systems according to the embodiments of the present invention, a Linux system is used to represent the non-real-time system and an RTOS system is used to represent the real-time system, and these two systems are taken as examples for explanation. In a practical environment, the non-real-time system may comprise a plurality of Linux or Windows systems, and the real-time system may comprise a plurality of RTOS systems.
Embodiments of a method for sharing memory among multiple systems according to the present invention are described below with reference to fig. 2A to 4. The method comprises the following steps: an embodiment of a configuration method, an embodiment of an interaction method and an embodiment of a capacity expansion method of a multi-system shared memory are provided.
[ example of configuration method ]
In the embodiment of the configuration method of the multi-system shared memory, virtual memory devices of the shared memory are respectively configured in device tree files of a Linux system and an RTOS system through an IDE (integrated drive interface) of a heterogeneous system, and the virtual memory devices are registered when the Linux system and the RTOS system are restarted.
Fig. 2A shows a flow of an embodiment of a method for configuring a multi-system shared memory according to the present invention, which includes steps S110, S120A, and S120B.
S110: and respectively creating virtual memory devices in the device tree files of the Linux system and the RTOS by utilizing the heterogeneous system IDE.
Fig. 2B shows a structure of a physical memory including a shared memory, for example, where the shared memory is named mem1, mem2, and …, and the corresponding virtual memory devices are device1, device2 (not shown in fig. 2B), and …. In this example, the shared memory mem1 is taken as an example for explanation.
For example, a virtual memory device1 corresponding to the shared memory mem1 is configured in the device tree file device1 of the Linux system, and the information of the virtual memory device1 includes a physical memory address of mem 1.
Illustratively, the device tree file device2 of the RTOS system also includes a virtual memory device1 corresponding to the shared memory mem1, and the information of the virtual memory device1 includes the physical memory address of mem 1.
The same name device1 is used in the virtual memory devices of the Linux system and the RTOS, which is convenient to express as the same shared memory in the actual use process. In other embodiments, different names may be used
S120A: and when the Linux system is started, the virtual memory device is registered in the Linux system according to the device tree file of the Linux system.
For example, when the Linux system is started, according to the device tree1, the device driver corresponding to each node in the file is called, and the devices corresponding to each node are respectively registered in the Linux system.
Specifically, taking the virtual memory device1 as an example, when the Linux system is started, a Linux system virtual memory device driver is called according to information of the virtual memory device1 on the device tree file devicetree1, the reserved memory block mem1 is isolated from a virtual machine of the Linux system, the virtual memory device1 is registered, and after the registration is completed, a device1 device file is generated in a dev directory of the Linux system.
After the registration is completed, the Linux system virtual memory device driver further provides a method for acquiring information such as an address and a size of a shared memory corresponding to the virtual memory device1, and a method for opening the virtual memory device1 by the device name device 1.
S120B: and when the RTOS system is started, registering the virtual memory device into the RTOS system according to the device tree file of the RTOS system.
For example, when the RTOS system is started, according to the device tree2, the device driver corresponding to each node on the file is called, and the devices corresponding to each node are respectively registered in the RTOS system.
Specifically, taking the virtual memory device1 as an example, when the RTOS system is started, according to the information of the virtual memory device1 on the device tree file devicetree2, a virtual memory device driver of the RTOS system is called, the reserved memory block mem1 is isolated from the virtual machine of the Linux system, and the virtual memory device1 is registered, and after the registration is completed, a device1 device file is generated in the RTOS system.
After the registration is completed, the virtual memory device driver of the RTOS system further provides a method for acquiring information such as an address and a size of a shared memory corresponding to the virtual memory device1, and a method for opening the virtual memory device1 by the device name device 1.
In summary, in an embodiment of a method for configuring a shared memory of multiple systems, a virtual memory device corresponding to the same shared memory is defined in a device tree file of each system, and when each system is restarted, the virtual memory device is registered through a virtual machine memory device driver, so that each system in the multiple systems realizes data interaction on the shared memory through the virtual memory device. The technical scheme of the embodiment of the method is irrelevant to the operating system, is decoupled from the microkernel operating system, and is simple and convenient to configure.
[ data interaction method embodiment ]
An embodiment of a data interaction method for a multi-system shared memory operates in the Linux system and the RTOS system shown in fig. 1, and the Linux system and the RTOS system respectively open virtual memory devices corresponding to the shared memory, acquire shared memory information, and perform data interaction on the shared memory through the virtual memory devices.
Fig. 3 shows a flow of an embodiment of a method for data interaction between multiple systems sharing a memory according to the present invention, which includes steps S210A to S240.
S210A: and the Linux system opens the virtual memory device file.
In this example, the description continues with the example of the shared memory mem1 and the virtual memory device1 corresponding thereto in fig. 2B.
Illustratively, the Linux system opens the virtual memory device file/dev/device 1 using an open function of Linux, which is provided for a virtual memory device driver of the Linux system.
S210B: the RTOS system opens the virtual memory device file.
Illustratively, the RTOS system also opens the virtual memory device file device1 using an open function of the RTOS, which is provided for a virtual memory device driver of the RTOS system.
S220A: the Linux system obtains information of the virtual memory device.
Illustratively, the Linux system obtains information of the virtual memory device1, including a physical address and a size of the shared memory mem1, using an ioctl (I/O control) method of Linux, which is provided for a virtual memory device driver of the Linux system.
S220B: the RTOS system obtains information of the virtual memory device.
Illustratively, the RTOS system obtains the information of the virtual memory device1, including the physical address and size of the shared memory mem1, using an ioctl method of the RTOS, which is provided for a virtual memory device driver of the RTOS system.
S230: the first system in the multiple systems writes the data1 to the physical address of the shared memory.
Wherein, in some embodiments, mutual exclusion problem when writing data is solved by writing signal quantity and atomic operation.
In some embodiments, the system shared memory that receives data in the multiple systems is notified of the existing data writes through the service interrupt.
The first system may be a Linux system or an RTOS system.
S240: the second system in the multi-system reads the data1 from the physical address of the shared memory.
Wherein, in some embodiments, mutual exclusion problem when reading data is solved through reading semaphore and atomic operation.
In some embodiments, it is known that data is shared in the shared memory through service interruption.
The first system may be a Linux system or an RTOS system.
It should be noted that, in this example, steps S210A to S240 may implement that the Linux system shares data with the RTOS system through the shared memory, or the RTOS system shares data with the Linux system through the shared memory. In an actual scene, data interaction between systems can be realized through shared memory between Linux systems or RTOS systems.
In summary, in an embodiment of the data interaction method for the shared memory of multiple systems, each system obtains information of the corresponding shared memory by opening a virtual memory device corresponding to the shared memory, and data interaction on the shared memory is realized through the virtual memory device. The technical scheme of the embodiment of the method is irrelevant to the operating system, is decoupled from the microkernel operating system, and is simple and convenient to use.
[ example of adjustment method ]
In the embodiment of the method for adjusting the multi-system shared memory, the information of the shared memory in the virtual memory device is reconfigured in the device trees of the Linux system and the RTOS system through the IDE of the heterogeneous system, the virtual memory device is restarted in the Linux system and the RTOS system, the modified virtual memory device is registered, and the data interaction between the systems can be carried out through the modified virtual memory device.
Fig. 4 shows a flow of an embodiment of the method for adjusting a multi-system shared memory according to the present invention, which includes steps S310, S320A, and S320B.
S310: and respectively adjusting the information of the shared memory corresponding to the virtual memory devices in the device tree files of the Linux system and the RTOS by using the IDE of the heterogeneous system.
In this example, the description continues with the example of the shared memory mem1 and the virtual memory device1 corresponding thereto in fig. 2B. When the memory is actually used, a plurality of shared memories can be modified according to needs.
Illustratively, the location and size of the virtual memory device1 corresponding to the shared memory mem1 in the device tree files of the Linux system and the RTOS, respectively, are modified. The location and size of the modified shared memory mem1 does not conflict with the location and size of the physical memory reserved by other devices.
S320A: and restarting the virtual memory device by the linux system, and registering the modified virtual memory device into the linux system.
Exemplarily, when the Linux system restarts the virtual memory device1, a virtual memory device driver of the Linux system is called, the newly modified memory block mem1 is isolated from the virtual machine of the Linux system, and the virtual memory device1 is re-registered, and after the registration is completed, a new device file device1 is generated under the dev directory of the Linux system.
S320B: and restarting the virtual memory device by the RTOS system, and registering the modified virtual memory device into the device management of the RTOS system.
Illustratively, when the RTOS system restarts the virtual memory device1, a virtual memory device driver of the RTOS system is called, the newly modified memory block mem1 is isolated from the virtual machine of the RTOS system, and the virtual memory device1 is re-registered, and after the registration is completed, a new device1 device file is generated in the RTOS system.
After all the systems of the heterogeneous system register the modified virtual memory device again, the data interaction between the systems is carried out by using the method in the embodiment of the data interaction method for sharing the memory by the multiple systems.
In summary, in an embodiment of a method for adjusting a shared memory of multiple systems, a virtual memory device corresponding to the same shared memory is modified in a device tree file of each system, the virtual machine memory device is restarted in each system, and the virtual memory device is re-registered, so that each system in the multiple systems realizes data interaction on the shared memory through the modified virtual memory device. The technical scheme of the embodiment of the method is irrelevant to the operating system, is decoupled from the microkernel operating system, and is simple and convenient to transplant and expand.
An embodiment of an apparatus for sharing a memory among multiple systems according to the present invention is described below with reference to fig. 5.
[ DEVICE EMBODIMENT FOR SHARING MEMORY BY MULTI-SYSTEM ]
An apparatus embodiment for sharing memory among multiple systems operates on method embodiments for sharing memory among multiple systems. The description continues with the example of the shared memory in fig. 2B.
Fig. 5 shows a structure of an embodiment of an apparatus for sharing memory among multiple systems, including: a configuration module 510, a registration module 520A, a registration module 520B, an open module 530A, an open module 530B, a write module 540, and a read module 550.
The configuration module 510 is deployed on an IDE of the heterogeneous system, the registration module 520A and the opening module 530A are deployed in the Linux system, the registration module 520B and the opening module 530B are deployed in the RTOS system, and the writing module 540 and the reading module 550 are deployed on each system of the heterogeneous system.
The configuration module 510 is used for creating a virtual memory device in the device tree files of the Linux system and the RTOS by the IDE configuration of the heterogeneous system, and the method and advantages thereof refer to step S110 of an embodiment of the configuration method for the multi-system shared memory.
The configuration module 510 is further configured to adjust, by the IDE of the heterogeneous system, information of the shared memory corresponding to the virtual memory devices in the device tree files of the Linux system and the RTOS, respectively, and the method and advantages refer to step S310 of an embodiment of the method for adjusting a multi-system shared memory.
The registering module 520A is configured to register the virtual memory device in the Linux system according to the device tree file when the Linux system of the heterogeneous system is started, and the method and advantages refer to step S120A of an embodiment of a method for configuring a multi-system shared memory.
The registering module 520A is further configured to restart the virtual memory device by the Linux system of the heterogeneous system, and re-register the modified virtual memory device in the Linux system, where the method and advantages refer to step S320A of an embodiment of a method for adjusting a multi-system shared memory.
The registering module 520B is configured to register the virtual memory device in the RTOS system according to the device tree file when the RTOS system of the heterogeneous system is started, and the method and advantages refer to step S120B of an embodiment of a method for configuring a multi-system shared memory.
The registering module 520B is further configured to restart the virtual memory device by the RTOS system of the heterogeneous system, and re-register the modified virtual memory device in the RTOS system, where the method and advantages refer to step S320B of an embodiment of the method for adjusting the multi-system shared memory.
The opening module 530A is configured to open the virtual memory device and obtain information of the virtual memory device by the Linux system. The method and advantages refer to steps S210A and S220A of an embodiment of a method for adjusting a shared memory for multiple systems.
The opening module 530B is configured to open the virtual memory device and obtain information of the virtual memory device by the RTOS system. The method and advantages refer to steps S210B and S220B of an embodiment of a method for adjusting a shared memory for multiple systems.
The write module 540 is used for writing data to the physical address of the shared memory by each system. The method and advantages refer to step S230 of an embodiment of a method for adjusting a shared memory of multiple systems.
The reading module 550 is used for reading data from a physical address of the shared memory by each system. The method and advantages refer to step S240 of an embodiment of a method for adjusting a shared memory of multiple systems.
[ calculating device ]
The invention also provides a computing device, which is described in detail in the following fig. 6.
The computing device 600 includes a processor 610, a memory 620, a communication interface 630, and a bus 640.
It is to be appreciated that the communication interface 630 in the computing device 600 illustrated in this figure may be used to communicate with other devices.
Wherein the processor 610 may be coupled to the memory 620. The memory 620 may be used for storing the program codes and data. Therefore, the memory 620 may be a storage unit inside the processor 610, may be an external storage unit independent of the processor 610, or may be a component including a storage unit inside the processor 610 and an external storage unit independent of the processor 610.
Optionally, computing device 600 may also include a bus 640. The memory 620 and the communication interface 630 may be connected to the processor 610 through a bus 640. The bus 640 may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus 640 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one line is shown, but this does not represent only one bus or one type of bus.
It should be understood that, in the embodiment of the present invention, the processor 610 may adopt a Central Processing Unit (CPU). The processor may also be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. Or the processor 610 may employ one or more integrated circuits for executing related programs to implement the technical solutions provided by the embodiments of the present invention.
The memory 620 may include both read-only memory and random access memory, and provides instructions and data to the processor 610. A portion of the processor 610 may also include non-volatile random access memory. For example, the processor 610 may also store information of the device type.
When the computing device 600 is run, the processor 610 executes the computer-executable instructions in the memory 620 to perform the operational steps of the method embodiments.
It should be understood that the computing device 600 according to the embodiment of the present invention may correspond to a corresponding main body for executing the method according to the embodiments of the present invention, and the above and other operations and/or functions of each module in the computing device 600 are respectively for implementing corresponding flows of each method of the embodiment, and are not described herein again for brevity.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the embodiments provided in the present invention, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. The storage medium includes various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
[ computer-readable storage Medium ]
Embodiments of the present invention also provide a computer-readable storage medium having stored thereon a computer program for performing, when executed by a processor, the operational steps of the method embodiments.
Computer storage media for embodiments of the invention may employ any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium include an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in more detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention.

Claims (10)

1. A method for sharing memory among multiple systems, wherein each system in the multiple systems runs on a same processor, the method comprising:
adding a first virtual memory device in the device tree file of each system, wherein the first virtual memory device is a virtualization device of the shared memory of the multiple systems in each system;
when each system is started, registering the first virtual memory device in each system according to each device tree file;
and each system performs data interaction among the systems through the first virtual memory device.
2. The method of claim 1, wherein registering the first virtual memory device with the respective system comprises:
each system acquires the information of the first virtual memory device from the respective device tree file;
each system calls a respective virtual memory device driver according to the information of the first virtual memory device, isolates the shared memory from the respective system, and initializes the shared memory;
and after the initialization is completed, generating a device file of the first virtual memory device in each system.
3. The method according to claim 2, wherein the virtual memory device driver of each system provides the each system with a method of obtaining the information of the shared memory and a method of opening the first virtual memory device by the first virtual memory device name.
4. The method of claim 3, wherein the inter-system data interaction between the systems via the first virtual memory device comprises:
each system opens the first virtual memory device by using the name of the first virtual memory device;
each system acquires the information of the shared memory, including the address and the size of the shared memory;
a first system in each system writes data into the address of the shared memory;
and the second system in each system reads data from the address of the shared memory.
5. The method of claim 1, further comprising, when the shared memory address or size is changed:
modifying the address or/and size of the shared memory of the first virtual memory device of each system;
and when the first virtual memory device is restarted, each system registers the modified first virtual memory device into the respective system.
6. The method of any one of claims 1 to 4, wherein the plurality of systems includes a plurality of non-real time systems and a plurality of real time systems.
7. The method of any of claims 1 to 4, wherein the first virtual memory devices of each system have the same name.
8. An apparatus for sharing memory among multiple systems, wherein each system in the multiple systems runs on a same processor, comprising:
a configuration module, configured to add a first virtual memory device to the device tree file of each system, where the first virtual memory device is a virtualized device in each system of the shared memory of the multiple systems;
a registration module, configured to register the first virtual memory device in each system according to a respective device tree file when each system is started;
and the interaction module is used for performing data interaction between the systems through the first virtual memory device by each system.
9. A computing device, comprising:
a bus;
a communication interface connected to the bus;
at least one processor coupled to the bus; and
at least one memory coupled to the bus and storing program instructions that, when executed by the at least one processor, cause the at least one processor to perform the method of any of claims 1 to 7.
10. A computer-readable storage medium having stored thereon program instructions, which, when executed by a computer, cause the computer to perform the method of any of claims 1 to 7.
CN202111598360.2A 2021-12-24 2021-12-24 Method, device, equipment and storage medium for sharing memory by multiple systems Active CN114327944B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111598360.2A CN114327944B (en) 2021-12-24 2021-12-24 Method, device, equipment and storage medium for sharing memory by multiple systems

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111598360.2A CN114327944B (en) 2021-12-24 2021-12-24 Method, device, equipment and storage medium for sharing memory by multiple systems

Publications (2)

Publication Number Publication Date
CN114327944A true CN114327944A (en) 2022-04-12
CN114327944B CN114327944B (en) 2022-11-11

Family

ID=81012463

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111598360.2A Active CN114327944B (en) 2021-12-24 2021-12-24 Method, device, equipment and storage medium for sharing memory by multiple systems

Country Status (1)

Country Link
CN (1) CN114327944B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114879593A (en) * 2022-05-07 2022-08-09 科东(广州)软件科技有限公司 Method, device and equipment for real-time system to operate PLC (programmable logic controller) and storage medium
CN115309617A (en) * 2022-08-08 2022-11-08 科东(广州)软件科技有限公司 Desktop display method of background operating system information, heterogeneous system and storage medium
CN115344226A (en) * 2022-10-20 2022-11-15 亿咖通(北京)科技有限公司 Screen projection method, device, equipment and medium under virtualization management
CN117573292A (en) * 2024-01-15 2024-02-20 麒麟软件有限公司 Method for Xen running general RTOS virtual machine
CN117591489A (en) * 2024-01-16 2024-02-23 麒麟软件有限公司 Virtual file sharing system based on multi-system isolation

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101667144A (en) * 2009-09-29 2010-03-10 北京航空航天大学 Virtual machine communication method based on shared memory
CN103942178A (en) * 2014-03-03 2014-07-23 浙江大学 Communication method between real-time operating system and non-real-time operating system on multi-core processor
CN106844008A (en) * 2017-01-03 2017-06-13 华为技术有限公司 A kind of method of data manipulation, equipment and system
CN107077377A (en) * 2016-12-29 2017-08-18 深圳前海达闼云端智能科技有限公司 A kind of device virtualization method, device, system and electronic equipment, computer program product
CN107491354A (en) * 2017-07-03 2017-12-19 北京东土科技股份有限公司 A kind of inter-virtual machine communication method and device based on shared drive
CN108829529A (en) * 2018-06-14 2018-11-16 中国平安人寿保险股份有限公司 Virutal machine memory sharing method, device, computer equipment and storage medium
CN110402568A (en) * 2018-02-24 2019-11-01 华为技术有限公司 A kind of method and device of communication
CN112565113A (en) * 2020-12-23 2021-03-26 科东(广州)软件科技有限公司 Network card sharing system, method, device, equipment and medium among multiple virtual machines
CN113821309A (en) * 2021-11-16 2021-12-21 科东(广州)软件科技有限公司 Communication method, device, equipment and storage medium between microkernel virtual machines

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101667144A (en) * 2009-09-29 2010-03-10 北京航空航天大学 Virtual machine communication method based on shared memory
CN103942178A (en) * 2014-03-03 2014-07-23 浙江大学 Communication method between real-time operating system and non-real-time operating system on multi-core processor
CN107077377A (en) * 2016-12-29 2017-08-18 深圳前海达闼云端智能科技有限公司 A kind of device virtualization method, device, system and electronic equipment, computer program product
CN106844008A (en) * 2017-01-03 2017-06-13 华为技术有限公司 A kind of method of data manipulation, equipment and system
CN107491354A (en) * 2017-07-03 2017-12-19 北京东土科技股份有限公司 A kind of inter-virtual machine communication method and device based on shared drive
CN110402568A (en) * 2018-02-24 2019-11-01 华为技术有限公司 A kind of method and device of communication
CN108829529A (en) * 2018-06-14 2018-11-16 中国平安人寿保险股份有限公司 Virutal machine memory sharing method, device, computer equipment and storage medium
CN112565113A (en) * 2020-12-23 2021-03-26 科东(广州)软件科技有限公司 Network card sharing system, method, device, equipment and medium among multiple virtual machines
CN113821309A (en) * 2021-11-16 2021-12-21 科东(广州)软件科技有限公司 Communication method, device, equipment and storage medium between microkernel virtual machines

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114879593A (en) * 2022-05-07 2022-08-09 科东(广州)软件科技有限公司 Method, device and equipment for real-time system to operate PLC (programmable logic controller) and storage medium
CN115309617A (en) * 2022-08-08 2022-11-08 科东(广州)软件科技有限公司 Desktop display method of background operating system information, heterogeneous system and storage medium
CN115344226A (en) * 2022-10-20 2022-11-15 亿咖通(北京)科技有限公司 Screen projection method, device, equipment and medium under virtualization management
CN117573292A (en) * 2024-01-15 2024-02-20 麒麟软件有限公司 Method for Xen running general RTOS virtual machine
CN117573292B (en) * 2024-01-15 2024-04-09 麒麟软件有限公司 Method for Xen running general RTOS virtual machine
CN117591489A (en) * 2024-01-16 2024-02-23 麒麟软件有限公司 Virtual file sharing system based on multi-system isolation
CN117591489B (en) * 2024-01-16 2024-06-07 麒麟软件有限公司 Virtual file sharing system based on multi-system isolation

Also Published As

Publication number Publication date
CN114327944B (en) 2022-11-11

Similar Documents

Publication Publication Date Title
CN114327944B (en) Method, device, equipment and storage medium for sharing memory by multiple systems
CN109791536B (en) Configurable logic platform
US11099894B2 (en) Intermediate host integrated circuit between virtual machine instance and customer programmable logic
WO2019201011A1 (en) System startup method and apparatus, electronic device and storage medium
US10860332B2 (en) Multicore framework for use in pre-boot environment of a system-on-chip
US20150121055A1 (en) Flexible bootstrap code architecture
RU2611018C2 (en) Common method of constructing a virtual pci-device and a virtual mmio-device
US9733948B2 (en) Information processing device, information processing method, and recording medium storing control program
CN110716845B (en) Log information reading method of Android system
US10120798B1 (en) Dynamic FPGA re-configuration using a virtual FPGA controller
WO2017142762A1 (en) Translating atomic read-modify-write accesses
US10282190B2 (en) System and method for updating a UEFI image in an information handling system
CN114327777A (en) Method and device for determining global page directory, electronic equipment and storage medium
CN114691300A (en) Hot migration method of virtual machine instance
US20160321116A1 (en) Translating operating system processes
CN114238236A (en) Shared file access method, electronic device and computer readable storage medium
Wenzel et al. Getting started with CAPI SNAP: Hardware development for software engineers
US10970206B2 (en) Flash data compression decompression method and apparatus
US11544092B2 (en) Model specific register (MSR) instrumentation
CN114791854B (en) Scheduling method, device, equipment and storage medium of user-state virtual machine task
CN116360925A (en) Paravirtualization implementation method, device, equipment and medium
US11526358B2 (en) Deterministic execution replay for multicore systems
US20190129619A1 (en) Transparent capi exploitation for legacy application
US11907176B2 (en) Container-based virtualization for testing database system
US20060242351A1 (en) Method and apparatus for loading instructions into high memory

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant