Data sharing method, device, equipment, medium and product between mobile simulator optimization equipment
By building a hypergraph structure in a mobile simulator for virtual memory access prediction and memory prefetching, combined with virtual barrier instructions, the problem of low data sharing efficiency among virtual devices is solved, efficient data sharing is achieved, and immersive applications are improved. Fluency and performance.
Patent Information
- Application Number
- CN202410929298.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-11
- Publication Date
- 2024-11-12
AI Technical Summary
The data sharing between virtual devices in mobile simulators is inefficient, resulting in application operation lag and frame drops. Especially in immersive applications such as ultra-high-definition video, augmented reality and virtual reality, data transmission delay and overhead are high. .
By building a hypergraph structure on a mobile simulator, predicting access information of shared virtual memory, realizing memory prefetching, updating data to the physical memory of the target device in advance, and using virtual barrier instructions to ensure data consistency, asynchronous or synchronous prefetching Get data to minimize latency and overhead.
It improves data sharing efficiency between virtual devices, significantly improves the fluency of immersive applications in mobile simulators, increases frame rate by 1.7-4.6 times, reduces latency by 35%-62%, and optimizes development and usage experience.
Smart Images

Figure CN118939571A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of data processing technology, and in particular to a method, device, equipment, medium and product for optimizing data sharing between devices using a mobile simulator. Background Art
[0002] Currently, in mobile emulators, traditional data transmission schemes are mainly inspired by PC / server hardware architectures, so maintaining shared virtual memory (SVM) consistency becomes a key challenge to achieve efficient data sharing. In emulators such as QEMU-KVM, virtual devices are designed modularly, similar to physical implementations on personal computers or server devices. To provide better compatibility and stability, these devices can be enabled or disabled individually and usually run independently to prevent errors in one device from affecting other devices. Different virtual devices can even use different I / O virtualization technologies, such as paravirtualized GPUs and pass-through cameras, which are completely unrelated to each other. Even in emulators that are specially optimized for mobile systems, the interaction between virtual devices is very limited. For example, in the Google Android emulator, only limited functional reuse between GPUs and video codecs is observed.
[0003] Therefore, applications on the mobile simulator cannot perceive that data transmission between virtual devices is slow. Due to the system-on-chip architecture design for physical devices (such as mobile phones, computers, etc.), in the physical device architecture, the hardware of each device is tightly coupled together, and the problem of slow data sharing will not occur. Therefore, after the application on this physical device architecture is migrated to the mobile simulator, a large number of operating problems will be caused due to this unexpected problem, resulting in the problem of inefficient data sharing between different virtual devices in the mobile simulator. Summary of the invention
[0004] Based on the above technical problems, an embodiment of the present invention provides a method, apparatus, device, medium and product for optimizing data sharing between devices in a mobile simulator, so as to realize efficient data sharing between different virtual devices in a mobile simulator.
[0005] An embodiment of the present invention provides a method for optimizing data sharing between devices in a mobile simulator, the method comprising:
[0006] The application on the mobile simulator initiates write distribution;
[0007] Controlling, by means of a first device driver on the mobile simulator, a first device on the host machine to start writing application data of the application into a physical memory of the first device;
[0008] Predicting, by means of a hypergraph structure on the mobile simulator, a second device on the host machine that will share the application data and a time when the application data will be shared;
[0009] The first device performs pre-fetching, reads the application data from the physical memory of the first device and stores the application data into the physical memory of the second device, wherein the physical memory of the first device and the physical memory of the second device are regarded as a common shared virtual memory by the mobile simulator;
[0010] When the time for sharing the application data arrives, the second device reads the application data from the physical memory of the second device and starts to use the application data.
[0011] Optionally, the method further comprises:
[0012] Based on the ID of the shared virtual memory, historical statistical information of the data flow corresponding to the shared virtual memory is obtained through the hypergraph structure, wherein the historical statistical information at least includes: the area size of the shared virtual memory and the bus bandwidth between the first device and all other devices;
[0013] The predicting of the second device on the host machine that will share the application data through the hypergraph structure on the mobile simulator includes: predicting the prefetch time of the first device based on the area size of the shared virtual memory and the bus bandwidth between the first device and the second device; and predicting the second device from all other devices;
[0014] When the prefetch time is less than or equal to the relaxation interval, the first device performs prefetching, reads the application data from the physical memory of the first device and stores the application data in the physical memory of the second device, including:
[0015] The first device uses the relaxation interval to asynchronously store the application data in the physical memory of the second device; the relaxation interval is the interval between two adjacent accesses to the shared virtual memory by two devices.
[0016] Optionally, when the prefetch time is greater than the relaxation interval, the first device performs prefetching, and the process of reading the application data from the physical memory of the first device and storing it in the physical memory of the second device includes: a synchronous prefetching stage and an asynchronous prefetching stage;
[0017] The synchronous prefetching stage includes: blocking the first device during the compensation time period before the relaxation interval by driving the first device, so that the first device only prefetches the application data during the compensation time period and stores the application data in the physical memory of the second device; the value of the compensation time period is the difference between the prefetching time and the relaxation interval;
[0018] The asynchronous pre-fetching stage includes: the first device continues to pre-fetch the application data by utilizing the relaxation interval, and asynchronously stores the application data into the physical memory of the second device.
[0019] Optionally, the method further comprises:
[0020] The first device driver sets a virtual barrier instruction, wherein the virtual barrier instruction is used to ensure that the second device is allowed to use the application data only after the first device pre-fetching is completed;
[0021] The reading and starting to use the application data from the physical memory of the second device includes:
[0022] Before the second device starts to read the application data from the physical memory of the second device, detecting, based on the virtual barrier instruction, whether the prefetching of the first device is completed;
[0023] In the case that the first device has not finished prefetching, the second device waits and continuously detects whether the first device has finished prefetching until it detects that the first device has finished prefetching;
[0024] When the prefetching by the first device is finished, the second device reads the application data from the physical memory of the second device and starts to use the application data.
[0025] Optionally, the physical memory of the second device includes a target memory for storing the application data, and the second device waits and continuously detects whether the prefetching of the first device is completed until it is detected that the prefetching of the first device is completed, comprising:
[0026] The management unit of the shared virtual memory locks the target memory based on the virtual barrier instruction until it is detected that the prefetching of the first device ends;
[0027] When the prefetching by the first device ends, the second device reads the application data from the physical memory of the second device and starts to use the application data, including:
[0028] When the prefetching of the first device is completed, the management unit of the shared virtual memory unlocks the target memory based on the virtual barrier instruction, and the second device reads the application data from the target memory and starts to use the application data.
[0029] Optionally, the method further comprises:
[0030] The mobile simulator collects historical usage data of multiple shared virtual memories from a global perspective, and maintains and constructs a two-layer hypergraph structure based on the historical usage data; wherein, in the two-layer hypergraph structure, one layer of the hypergraph structure includes historical data flows between virtual devices in the mobile simulator, and the other layer of the hypergraph structure includes historical data flows between real devices on the host machine;
[0031] The predicting, by using the hypergraph structure on the mobile simulator, the second device on the host machine that will share the application data and the time when the application data will be shared includes:
[0032] The time when the second device and the application data will be shared is predicted by using the double-layer hypergraph structure and an exponential smoothing method.
[0033] A second aspect of an embodiment of the present invention provides a device for data sharing between mobile simulator optimization devices, the device comprising:
[0034] Write distribution module, an application deployed on the mobile simulator, used to initiate write distribution;
[0035] A writing module, used for controlling the first device on the host machine to start writing the application data of the application into the physical memory of the first device through the first device driver on the mobile simulator;
[0036] A device prediction module, used for predicting the second device on the host machine that will share the application data and the time when the application data will be shared through the hypergraph structure on the mobile simulator;
[0037] a pre-fetch module, deployed on the first device, for pre-fetching, reading the application data from the physical memory of the first device and storing the application data in the physical memory of the second device, wherein the physical memory of the first device and the physical memory of the second device are regarded as a common shared virtual memory by the mobile simulator;
[0038] The reading module is deployed on the second device and is used to read and start using the application data from the physical memory of the second device when the time for sharing the application data arrives.
[0039] Optionally, the device further comprises:
[0040] An information acquisition module, configured to acquire historical statistical information of a data stream corresponding to the shared virtual memory through the hypergraph structure based on the ID of the shared virtual memory, wherein the historical statistical information includes at least: a region size of the shared virtual memory and a bus bandwidth between the first device and all other devices;
[0041] The equipment prediction module includes:
[0042] a time prediction module, configured to predict a prefetch time for the first device to perform prefetching based on the area size of the shared virtual memory and the bus bandwidth between the first device and the second device; and predict the second device from all other devices;
[0043] The pre-fetch module comprises:
[0044] The first pre-fetch submodule is deployed on the first device and is used to asynchronously store the application data into the physical memory of the second device by utilizing the relaxation interval when the pre-fetch time is less than or equal to the relaxation interval; the relaxation interval is the interval between two adjacent accesses of the two devices to the shared virtual memory.
[0045] Optionally, the prefetch module comprises: a synchronous prefetch submodule and an asynchronous prefetch submodule; the synchronous prefetch submodule is used to perform a synchronous prefetch phase when the prefetch time is greater than the relaxation interval; the asynchronous prefetch submodule is used to perform an asynchronous prefetch phase when the prefetch time is greater than the relaxation interval; wherein,
[0046] The synchronous prefetching stage includes: blocking the first device during the compensation time period before the relaxation interval by driving the first device, so that the first device only prefetches the application data during the compensation time period and stores the application data in the physical memory of the second device; the value of the compensation time period is the difference between the prefetching time and the relaxation interval;
[0047] The asynchronous pre-fetching stage includes: the first device continues to pre-fetch the application data by utilizing the relaxation interval, and asynchronously stores the application data into the physical memory of the second device.
[0048] Optionally, the device further comprises:
[0049] an instruction setting module, deployed in the first device driver, for setting a virtual barrier instruction, wherein the virtual barrier instruction is used to ensure that the second device is allowed to use the application data only after the first device pre-fetching is completed;
[0050] The reading module comprises:
[0051] a detection submodule, deployed in the second device, for detecting whether the prefetching of the first device is finished based on the virtual barrier instruction before starting to read the application data from the physical memory of the second device;
[0052] A waiting submodule is deployed on the second device, and is used to wait and continuously detect whether the prefetching of the first device is completed when the prefetching of the first device is not completed, until it is detected that the prefetching of the first device is completed;
[0053] The reading submodule is deployed on the second device, and is used to read the application data from the physical memory of the second device and start using the application data when the pre-fetching of the first device is completed.
[0054] Optionally, the physical memory of the second device includes a target memory for storing the application data, and the waiting submodule includes:
[0055] A locking submodule, deployed in the management unit of the shared virtual memory, for locking the target memory based on the virtual barrier instruction until the end of the prefetching of the first device is detected;
[0056] The reading submodule comprises:
[0057] An unlocking submodule is deployed in the management unit of the shared virtual memory, and is used to unlock the target memory based on the virtual barrier instruction when the pre-fetching of the first device ends, and the second device reads the application data from the target memory and starts to use the application data.
[0058] Optionally, the device further comprises:
[0059] A hypergraph construction module, deployed in the mobile simulator, for collecting historical usage data of multiple shared virtual memories from a global perspective, and maintaining and constructing a double-layer hypergraph structure based on the historical usage data; wherein, in the double-layer hypergraph structure, one layer of the hypergraph structure includes historical data flows between virtual devices in the mobile simulator, and the other layer of the hypergraph structure includes historical data flows between real devices on the host machine;
[0060] The equipment prediction module includes:
[0061] The prediction submodule is used to predict the time when the second device and the application data will be shared by using the exponential smoothing method through the double-layer hypergraph structure.
[0062] A third aspect of an embodiment of the present invention provides an electronic device, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the computer program is executed by the processor, the steps of the method for optimizing data sharing between devices using a mobile simulator as described in the first aspect of the embodiment of the present invention are implemented.
[0063] A fourth aspect of an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for optimizing data sharing between devices using a mobile simulator as described in the first aspect of the embodiment of the present invention are implemented.
[0064] A fifth aspect of an embodiment of the present invention provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of the method for optimizing data sharing between devices using a mobile simulator as described in the first aspect of an embodiment of the present invention.
[0065] Through the mobile simulator of the embodiment of the present invention, the method for data sharing between devices is optimized, and the next shared virtual memory access information (i.e., the time of the second device and the application data to be shared) is predicted based on the hypergraph structure on the mobile simulator to ensure the prediction accuracy of the shared virtual memory access; memory pre-fetching is performed by the first device, and the application data to be shared is updated in advance and stored in the physical memory of the second device to minimize the delay and overhead caused by data sharing between devices in the mobile simulator, efficiently supporting shared resource operations across virtual devices, and realizing efficient data sharing between different virtual devices in the mobile simulator. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0067] Figure 1 It is a schematic diagram of the data sharing process of a mobile simulator in the related art;
[0068] Figure 2 is a flow chart of a method for optimizing data sharing between devices using a mobile simulator according to an embodiment of the present invention;
[0069] Figure 3 It is a schematic diagram of a data sharing process based on memory prefetching according to an embodiment of the present invention;
[0070] Figure 4It is a structural block diagram of a data sharing device between mobile simulator optimization devices provided by an embodiment of the present invention;
[0071] Figure 5 It is a schematic diagram of an electronic device shown in an embodiment of the present invention. DETAILED DESCRIPTION
[0072] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0073] The following technical terms appearing in the present invention are explained:
[0074] Mobile simulator: A software tool that simulates the operating environment of a mobile operating system and its applications on a PC or server for application development, testing, and debugging.
[0075] System on Chip (SoC): An integrated circuit that integrates a complete computing system (including CPU, GPU, memory, peripherals, etc.) on a single chip, often used in mobile devices to achieve efficient performance and energy efficiency.
[0076] Shared Virtual Memory (SVM): A memory management technology that provides a unified virtual address space for multiple devices (such as CPUs and GPUs) so that they can share data efficiently, often used to improve system performance and memory utilization.
[0077] Frame rate (FPS): The number of image frames displayed per second, used to measure the performance of the graphics processing system. A higher frame rate generally means a smoother visual experience.
[0078] Interaction delay: The delay time between the user's input operation, the system's response and the display on the client. Lower interaction delay usually means faster response and better user experience.
[0079] Client operating system: In the client-server model, the operating system on the user's device that makes requests to the server and processes the server's responses.
[0080] Host machine: In a virtualized environment, the physical computer or server that hosts a virtual machine instance, providing the compute, storage, and network resources to support the virtualized workload.
[0081] Immersive applications: Applications that use technologies such as virtual reality (VR) and augmented reality (AR) to provide users with an immersive experience. These applications usually require high-performance computing and graphics processing capabilities.
[0082] As mentioned above, applications on the mobile simulator cannot perceive that data transmission between virtual devices is slow, while the physical device architecture does not have the problem of slow data sharing. Therefore, after the applications on the physical device architecture are migrated to the mobile simulator, different virtual devices in the mobile simulator cannot efficiently share data. Furthermore, this leads to the problem that emerging immersive applications such as cloud games and virtual reality cannot run smoothly. Such applications (immersive applications) usually require high-performance computing and graphics processing capabilities, so the data throughput between video codecs, cameras, and image processors has become a major performance bottleneck.
[0083] like Figure 1 As shown, Figure 1 It is a schematic diagram of the data sharing process of the mobile simulator in the related technology. When data sharing is required between device A (such as a camera) and device B (video codec), device B wants the data of device A. Then, after the driver A of device A controls device A to write the data into the memory of device A, device B starts to submit a sharing request to device A, and then creates a common shared virtual memory in the logic of the mobile simulator. In the actual physical device, driver A controls device A to transfer and copy the data written into the memory to the memory of device B. Both devices A and B hold this data. Driver B sends a read request, and the memory of device B updates the data, and then device B reads the data from its own physical memory. It can be seen that after each data sharing request, it will experience a long time of update, which makes it impossible to efficiently share data between different virtual devices in the mobile simulator, resulting in problems such as freezes and frame drops in immersive applications in the mobile simulator.
[0084] Therefore, in order to at least partially solve the above-mentioned problems and one or more of other potential problems, an embodiment of the present invention proposes a method for optimizing data sharing between devices in a mobile simulator. In the method, for the mobile simulator, memory prefetching is used to minimize the delay and overhead caused by data sharing between devices, and the hypergraph structure of the mobile simulator is used to accurately predict the next shared virtual memory access information, so as to minimize the delay and overhead caused by data sharing between devices in the mobile simulator, complete efficient data sharing between different virtual devices in the mobile simulator, and realize a mobile simulator that can smoothly run immersive applications (such as those with ultra-high-definition video playback, augmented reality / virtual reality, etc.).
[0085] Reference Figure 2 , Figure 2FIG. 1 is a flow chart showing a method for optimizing data sharing between devices using a mobile simulator according to an embodiment of the present invention. Figure 2 As shown, the method may include the following steps:
[0086] Step S11: The application on the mobile simulator initiates write distribution.
[0087] In this embodiment, during the operation of the mobile simulator, the application on the mobile simulator starts to run and initiates write distribution, so that the device corresponding to the current function of the application can read data for the application to call.
[0088] In this embodiment, the application can be any application on the mobile simulator, for example, it can be an immersive application (such as ultra-high-definition video, 360-degree video, augmented reality / virtual reality, camera, and live broadcast), etc. This embodiment does not limit this.
[0089] Step S12: controlling the first device on the host machine to start writing the application data of the application into the physical memory of the first device through the first device driver on the mobile simulator.
[0090] In this embodiment, after the application on the mobile simulator initiates write distribution, it is determined that the first device on the host machine needs to use its own physical memory to write relevant application data. At this time, the first device on the host machine can be controlled by the first device driver on the mobile simulator to write the relevant application data of the application into the physical memory of the first device. The host machine is the host machine corresponding to the mobile simulator, and the first device driver is the driver on the mobile simulator corresponding to the first device.
[0091] Step S13: predicting the second device on the host machine that will share the application data and the time when the application data will be shared through the hypergraph structure on the mobile simulator.
[0092] In this embodiment, in order to implement pre-fetching of shared data, it is necessary to first predict the device that will access the shared virtual memory next time, that is, to predict the second device on the host machine that will share the application data after the first device, and the second device is different from the first device.
[0093] Among them, shared virtual memory is an abstract concept. After predicting the next time the second device accesses the shared virtual memory, the physical memory of the first device and the physical memory of the second device are regarded as a common shared virtual memory in the logic of the virtual machine (i.e., the mobile simulator of this embodiment).
[0094] In this embodiment, a hypergraph structure is constructed in advance on the mobile simulator. The hypergraph structure of this embodiment includes multiple historical usage data of shared virtual memory. The historical usage data can be represented by multiple data streams, and each data stream can involve one or more devices. In the hypergraph structure, a data stream can be regarded as an edge, and multiple devices involved in the data stream can be regarded as multiple vertices connected on an edge.
[0095] In this way, this embodiment can predict the second device on the host machine that will share the application data and the time when the application data will be shared through the hypergraph structure constructed on the mobile simulator.
[0096] Step S14: The first device performs pre-fetching, reads the application data from the physical memory of the first device and stores it into the physical memory of the second device, wherein the physical memory of the first device and the physical memory of the second device are regarded as a common shared virtual memory by the mobile simulator.
[0097] In this embodiment, since the physical memory of the first device and the physical memory of the second device are regarded as a common shared virtual memory by the mobile simulator, the prefetching in this embodiment is directly prefetched from the physical memory of the first device to the physical memory of the second device.
[0098] After the first device writes the application data into the physical memory of the first device, the first device may perform memory prefetching: reading the application data from the physical memory of the first device, and directly storing the read application data into the physical memory of the second device. The memory prefetching of this embodiment refers to: by predicting future memory access patterns, loading data into a required location (such as the physical memory of the second device) in advance before the data is needed, so as to reduce memory access latency and improve system performance.
[0099] Step S15: When the time for sharing the application data arrives, the second device reads the application data from the shared virtual memory.
[0100] In this embodiment, after the first device completes pre-fetching and when the time for sharing the application data arrives, the second device can read and start using the application data from the physical memory of the second device, thereby implementing data sharing between different devices in the mobile simulator. The time for sharing the application data is the time when the second device starts to read and start using the application data from the physical memory of the second device.
[0101] In this embodiment, the next shared virtual memory access information is predicted based on the hypergraph structure to avoid greater performance overhead caused by erroneous memory prefetching; and, memory prefetching is performed by the first device, and the application data to be shared is automatically updated in advance and stored in the physical memory of the second device, so that the second device can directly read and use the application data from the physical memory of the second device to realize data sharing between different devices in the mobile simulator, without waiting for the second device to issue a sharing request and then the first device to transmit and share the data. Reading, so as to minimize the delay and overhead caused by data sharing between devices in the mobile simulator, efficiently support shared resource operations across virtual devices, and realize efficient data sharing between different virtual devices in the mobile simulator.
[0102] In combination with the above embodiments, in one implementation, the present invention further provides a method for optimizing data sharing between devices using a mobile simulator. In this method, in addition to the above steps, step S21 may be included, and the "predicting the second device on the host machine that will share the application data through the hypergraph structure on the mobile simulator" in the above step S13 may include step S22, and, in the case where the pre-fetch time is less than or equal to the relaxation interval, the above step S14 may specifically include step S23:
[0103] Step S21: Based on the ID of the shared virtual memory, historical statistical information of the data flow corresponding to the shared virtual memory is obtained through the hypergraph structure.
[0104] In this embodiment, the hypergraph structure constructed in the mobile simulator may include historical data information corresponding to data streams corresponding to multiple shared virtual memories. Therefore, based on the ID of the shared virtual memory currently sharing data, the historical statistical information of the data stream corresponding to the shared virtual memory corresponding to the ID can be obtained through the hypergraph structure. In this embodiment, the historical statistical information obtained may at least include: the area size of the shared virtual memory, the bus bandwidth between the first device and all other devices. In addition, the historical statistical information may also include: historical R / W usage.
[0105] In addition, if the shared virtual memory is newly allocated, the statistical data of the most feasible data flow of the shared virtual memory area can be used to derive the shared virtual memory area size, bus bandwidth and other data from the devices and system services associated with the first shared virtual memory write.
[0106] Step S22: predicting the prefetching time of the first device based on the area size of the shared virtual memory and the bus bandwidth between the first device and the second device; and predicting the second device from all other devices.
[0107] In this embodiment, after obtaining the area size of the shared virtual memory and the bus bandwidth between the first device and all other devices through the hypergraph structure, the bus bandwidth between the first device and the second device can be determined from the bus bandwidth between the first device and all other devices, and then the prefetch time for the first device to perform prefetching can be predicted based on the area size of the shared virtual memory and the bus bandwidth between the first device and the second device. For example, the prefetch time for the first device to perform prefetching can be calculated by dividing the area size of the shared virtual memory by the bus bandwidth between the first device and the second device.
[0108] Furthermore, this embodiment can predict the second device that is about to access the shared virtual memory from all other devices by using historical statistical information of the data flow corresponding to the shared virtual memory obtained through the hypergraph structure.
[0109] Step S23: The first device uses the relaxation interval to asynchronously store the application data into the physical memory of the second device.
[0110] In order to design an efficient consistency protocol, this embodiment conducts in-depth measurements on shared virtual memory in a mobile simulator (mobile system) and finds that the main use of shared virtual memory is in data pipelines, which use shared virtual memory as intermediate storage to simplify data processing between dedicated SoC devices. In addition, since SoC devices have fast unified memory, cross-device control and data flow of shared virtual memory are usually designed to have a specific pattern. To ensure this, today's operating systems use various mechanisms such as buffering and vertical synchronization (VSync), which leads to inevitable delays between consecutive SVM accesses, which are called relaxation intervals.
[0111] In this embodiment, the historical statistical information of the data flow corresponding to the shared virtual memory obtained may also include: a relaxation interval between multiple devices, where the relaxation interval is the interval between two adjacent accesses to the shared virtual memory by two devices, that is, the relaxation interval is the interval between adjacent accesses to the shared virtual memory occurring in the processes of the two devices. Among the relaxation intervals between the multiple devices obtained, the relaxation interval between the first device and the second device may be obtained.
[0112] When the prefetch time is less than or equal to the relaxation interval, the first device can use the relaxation interval to asynchronously store the application data in the physical memory of the second device during the relaxation interval; wherein, the asynchrony of this embodiment means that in addition to storing the application data in the physical memory of the second device, other tasks can also be performed, such as notifying the completion of the SVM operation.
[0113] In this embodiment, memory prefetching utilizes the relaxation interval. When the relaxation interval can cover the prefetching time required for prefetching, the relaxation interval can be used to asynchronously store application data into the physical memory of the second device to complete memory prefetching. In this way, the time consumption of consistency maintenance is hidden under the relaxation interval, thereby significantly improving the SVM access performance.
[0114] In combination with the above embodiments, in one implementation, the present invention further provides a method for optimizing data sharing between devices in a mobile simulator. In the method, when the prefetch time is greater than the relaxation interval, the process of step S14 may include: a synchronous prefetch stage and an asynchronous prefetch stage.
[0115] Among them, the synchronous prefetch stage includes: blocking the compensation time period before the relaxation interval by the first device driver, so that the first device only prefetches the application data during the compensation time period and stores the application data in the physical memory of the second device; the value of the compensation time period is the difference between the prefetch time and the relaxation interval.
[0116] In this embodiment, when it is determined that the prefetch time is greater than the relaxation interval, the process of the first device performing memory prefetching includes two stages: a synchronous prefetching stage and an asynchronous prefetching stage. The synchronous prefetching stage is: the first device driver performs time compensation before the relaxation interval to obtain a compensation time period, the value of which is the difference between the prefetch time and the relaxation interval, and the first device driver blocks in the compensation time period, so that the first device only prefetches application data in the compensation time period: the application data is stored in the physical memory of the second device.
[0117] The asynchronous pre-fetching stage includes: the first device continues to pre-fetch the application data by utilizing the relaxation interval, and asynchronously stores the application data into the physical memory of the second device.
[0118] In this embodiment, after the synchronous prefetching stage is completed, the asynchronous prefetching stage will be performed. In this asynchronous prefetching stage, the relaxation interval can completely cover the remaining prefetching time. At this time, the first device can use the relaxation interval to continue prefetching the application data and asynchronously store the application data in the physical memory of the second device until the first device completes the memory prefetching.
[0119] In this embodiment, different relaxation interval durations correspond to different organizational forms of data access by the mobile simulator driver. Regardless of whether the relaxation interval can cover the prefetch time, this embodiment can completely hide the time consumption of consistency maintenance under the relaxation interval through asynchronous prefetch, or synchronous prefetch and asynchronous prefetch, so as to significantly improve the access performance of shared virtual memory, effectively reduce the overhead generated by applications (immersive applications) on the mobile simulator when exchanging data between devices, and greatly optimize the smoothness of the mobile simulator when running applications.
[0120] In combination with the above embodiments, in one implementation, the present invention further provides a method for optimizing data sharing between devices in a mobile simulator. In this method, in addition to the above steps, step S41 may also be included, and the "reading and starting to use the application data from the physical memory of the second device" in the above step S15 may specifically include steps S42 to S44:
[0121] Step S41: the first device driver sets a virtual barrier instruction.
[0122] Since the operation sequence between devices is known only by the driver of the mobile simulator (client system), but needs to be enforced in the host machine, this leads to frequent synchronization of the virtual machine (i.e., the mobile simulator), which brings non-negligible overhead. Based on this, in this embodiment, when the first device performs memory prefetching, the first device driver can set a virtual barrier instruction, and the virtual barrier instruction mechanism provides the access order of commands between host machine threads. The virtual barrier instruction is used to ensure that the second device is allowed to use the application data only after the first device prefetching is completed.
[0123] The core idea of the virtual barrier instruction is to attach a virtualized instance of the fence to the command sent by the mobile emulator (client), so that the semantics of the execution order can be attached to the host and enforced by the host alone without further client participation. The benefit of this virtualized command fence is that it can provide a unified access ordering abstraction for the mobile emulator driver, so that it does not have to pay attention to the complex details of how to actually perform access ordering in the host.
[0124] In one embodiment, virtual barrier instructions exist in pairs, which include two types of instructions: one is to issue a "signal" after the previous prefetch is completed, and the other is to "wait" until the "signal" is received. They are usually used in pairs to represent a before relationship, but multiple waits for a signal instruction are also allowed.
[0125] For example, when a first device driver wants to ensure that a command in the host (e.g., a first device memory prefetch) occurs before another command (e.g., a second device read and starts using), a virtual barrier instruction is set: the first device driver can request an unused fence index and attach a "signal" instruction containing the fence index to the first memory prefetch instruction. The fence index is saved in the driver data as an SVM metadata field, and when a subsequent read is assigned, a "wait" instruction containing the same index will also be attached. When the command to which the "signal" instruction is attached is executed when it is completed, it will update the corresponding entry in the virtual fence table (and the physical fence table if there is one). On the other hand, the "wait" instruction is executed before the command to which it is attached, which queries the fence table and waits until the "signal" instruction with the same index is completed.
[0126] Step S42: before the second device starts to read the application data from the physical memory of the second device, the second device detects whether the prefetching of the first device is completed based on the virtual barrier instruction.
[0127] In this embodiment, when the time for the second device to share application data arrives, the second device can detect whether the pre-fetching of the first device is completed based on the virtual barrier instruction before starting to read the application data from the physical memory of the second device.
[0128] Step S43: when the first device has not finished prefetching, the second device waits and continues to detect whether the first device has finished prefetching until it detects that the first device has finished prefetching.
[0129] In this embodiment, when the second device detects based on the virtual barrier instruction that the first device has not finished prefetching, the second device waits and continues to detect whether the first device has finished prefetching until the second device detects based on the virtual barrier instruction that the first device has finished prefetching.
[0130] Step S44: when the pre-fetching of the first device is completed, the second device reads the application data from the physical memory of the second device and starts to use the application data.
[0131] In this embodiment, when the second device detects that the prefetching of the first device ends based on the virtual barrier instruction, the second device ends waiting and starts reading and using the application data from the physical memory of the second device to complete data sharing.
[0132] In this embodiment, a low-overhead access ordering mechanism is designed, called a virtual memory barrier, which attaches sequential semantics to object-dispatched operations to use virtual barrier instructions. Among them, the memory barrier is used to ensure that specific memory operations are executed in order to avoid data consistency issues. Since the memory prefetch operation of this embodiment is performed across devices, the virtual memory barrier can lightweight maintain the order of memory access operations in the mobile simulator (client) in the host machine, avoiding the overhead caused by frequent client-host synchronization operations, thereby efficiently supporting shared resource operations across virtual devices.
[0133] In combination with the above embodiments, the present invention further provides a method for optimizing data sharing between devices using a mobile simulator. In the method, "the second device waits and continuously detects whether the prefetching of the first device is completed until the prefetching of the first device is completed" in the above step S43 may specifically include step S51, and the above step S44 may specifically include step S52:
[0134] Step S51: the management unit of the shared virtual memory locks the target memory based on the virtual barrier instruction until it is detected that the prefetching of the first device is completed.
[0135] In this embodiment, the means by which the virtual barrier instruction can take effect in pairs is: the management unit of the shared virtual memory locks the target memory based on the virtual barrier instruction, and the target memory remains locked until the second device detects that the prefetching of the first device ends based on the virtual barrier instruction. In this embodiment, the physical memory of the second device includes the target memory, which is a section of shared virtual memory that stores application data.
[0136] Step S52: when the pre-fetching of the first device is completed, the management unit of the shared virtual memory unlocks the target memory based on the virtual barrier instruction, and the second device reads the application data from the target memory and starts to use the application data.
[0137] In this embodiment, when the second device detects that the prefetching of the first device has ended based on the virtual barrier instruction, the management unit of the shared virtual memory can unlock the target memory based on the virtual barrier instruction, the target memory remains unlocked, and the second device starts to read the application data from the target memory, thereby completing data sharing.
[0138] In this embodiment, the virtual fence of the virtual barrier instruction is converted into a device-specific lock and memory fence for mandatory execution in the host machine, thereby avoiding frequent synchronization operations of the client-host instruction operation sequence.
[0139] In combination with the above embodiments, the present invention further provides a method for optimizing data sharing between devices in a mobile simulator. In the method, in addition to the above steps, step S61 may be further included, and the above step S13 may specifically include step S62:
[0140] Step S61: the mobile simulator collects historical usage data of multiple shared virtual memories from a global perspective, and maintains and constructs a two-layer hypergraph structure based on the historical usage data.
[0141] In this embodiment, the mobile simulator can use its global perspective to collect the historical usage data of each shared virtual memory, and maintain and construct a two-layer hypergraph structure based on the historical usage data of each shared virtual memory, which is used to model the data flow of virtual and physical devices. Among them, in the two-layer hypergraph structure, one layer of the hypergraph structure includes the historical data flow between virtual devices in the mobile simulator, and the other layer of the hypergraph structure includes the historical data flow between real devices on the host machine, that is, the hypergraph structure includes the characteristics of the devices involved in each data flow.
[0142] In this embodiment, the benefit of constructing a two-layer hypergraph structure is that virtual devices and physical devices are divided into two layers, each layer representing different aspects of the data flow. Since the virtual device interacts directly with the mobile client, high-level information of each data flow can be recorded on its corresponding hyperedge, including at least: the frequency of the data flow, the system service using the SVM, and the relaxation interval between continuous SVM accesses across devices.
[0143] The hypergraph structure includes multiple edges, and one edge can connect multiple devices. For example, if one edge connects three devices, then each edge is a data interaction process. When a call requires the three devices to share data at the same time, this edge will record: the frequency of a data interaction and / or the specific scenario in which the data interaction is sent. Therefore, when a certain scenario occurs, the hypergraph structure can be used to predict the data sharing situation (such as the access information of the next shared virtual memory).
[0144] Step S62: using the double-layer hypergraph structure and an exponential smoothing method, predict the time when the second device and the application data will be shared.
[0145] In this embodiment, the purpose of using a double-layer hypergraph structure is to utilize the key characteristics of the virtual system-on-chip data flow in the hypergraph structure: a data flow may involve multiple devices. Through the double-layer hypergraph structure and the state of the current device (such as the current state of the first device), the exponential smoothing method can be used to complete the prediction of the time when the second device and the application data will be shared, achieving a shared virtual memory access prediction accuracy of more than 99%.
[0146] In the exponential smoothing method used in this embodiment, the predicted value is a weighted average of past values, and the weight decays exponentially over time according to a hyperparameter α. Preferably, α can be empirically selected as 0.5 based on the evaluation results.
[0147] In combination with the above embodiments, in one embodiment, Figure 3 As shown, Figure 3 FIG. 1 is a schematic diagram of a data sharing process based on memory prefetching according to an embodiment of the present invention. Figure 3 In the process, the application on the mobile simulator in the client initiates write distribution, and the driver A on the mobile simulator controls the device A on the host to start writing the application data of the application into the memory of the device A; then, the constructed hypergraph structure is used to predict that the device B on the host will share the application data and the time when the application data will be shared; then, the device A performs memory prefetching: the application data is read from the memory of the device A and stored in the memory of the device B; the memory of the device A and the memory of the device B are regarded as a common shared virtual memory by the mobile simulator. In the memory prefetching process, if it is determined that the predicted prefetching time is greater than the gap time (i.e., the relaxation interval) between device A and device B for continuous access to the SVM, the synchronous prefetching stage is first performed: by driver A performing time compensation before the relaxation interval, a compensation time period is obtained, and driver A blocks in the compensation time period, so that device A only prefetches application data in the compensation time period; after the synchronous prefetching stage is completed, the asynchronous prefetching stage will be performed. In the asynchronous prefetching stage, device A can use the relaxation interval to continue prefetching application data and asynchronously store the application data in the memory of device B until device A completes memory prefetching. Finally, after device A completes memory prefetching, driver B performs read distribution, so that device B reads and starts using application data from the memory of device B when the time to share application data arrives, thereby completing efficient data sharing between device A and device B.
[0148] In one embodiment, the data sharing method designed above is integrated and implemented on two major Linux-based open source mobile systems, Android and Openharmony, with a total of 91K lines of C / C++ code. In the application benchmark test of immersive applications (including ultra-high-definition video, 360-degree video, augmented reality / virtual reality, camera and live broadcast) that widely use heterogeneous devices, the performance of the system integrated in this embodiment is compared with five mainstream mobile simulators. The evaluation results show that compared with other simulators, this embodiment can achieve a 1.7-4.6 times frame rate (FPS) increase and a 35%-62% reduction in latency, which greatly improves the smoothness of the mobile simulator when running immersive applications, optimizes the development, debugging and use experience of immersive applications, and promotes the development of this field.
[0149] In this embodiment, memory prefetching is achieved by making full use of the slack interval in the shared virtual memory operation, so as to establish a consistency management mechanism based on advance prediction by predicting when and where the next memory access will occur and extracting the data update to the predicted device in advance. The prediction of the next memory access information is achieved by maintaining a double-layer hypergraph structure, supplemented by a virtual memory barrier, minimizing the delay and overhead caused by data sharing between devices when the mobile simulator runs immersive applications, realizing a mobile simulator that can smoothly run functions such as ultra-high-definition video playback, and solving problems such as freezes and frame drops when the mobile simulator runs immersive applications.
[0150] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0151] Based on the same inventive concept, an embodiment of the present invention provides a data sharing device 400 for optimizing data between mobile simulators. Figure 4 , Figure 4 FIG. 1 is a structural block diagram of a data sharing device between mobile simulator optimization devices provided by an embodiment of the present invention. Figure 4 As shown, the device 400 includes:
[0152] Write distribution module 401, an application deployed on the mobile simulator, is used to initiate write distribution;
[0153] The writing module 402 is used to control the first device on the host machine to start writing the application data of the application into the physical memory of the first device through the first device driver on the mobile simulator;
[0154] A device prediction module 403, configured to predict, through a hypergraph structure on the mobile simulator, a second device on the host machine that will share the application data, and a time when the application data will be shared;
[0155] a pre-fetch module 404, deployed on the first device, for pre-fetching, reading the application data from the physical memory of the first device and storing it in the physical memory of the second device, wherein the physical memory of the first device and the physical memory of the second device are regarded as a common shared virtual memory by the mobile simulator;
[0156] The reading module 405 is deployed on the second device, and is used to read and start using the application data from the physical memory of the second device when the time to share the application data arrives.
[0157] Optionally, the device 400 further includes:
[0158] An information acquisition module, configured to acquire historical statistical information of a data stream corresponding to the shared virtual memory through the hypergraph structure based on the ID of the shared virtual memory, wherein the historical statistical information includes at least: a region size of the shared virtual memory and a bus bandwidth between the first device and all other devices;
[0159] The device prediction module 403 includes:
[0160] a time prediction module, configured to predict a prefetch time for the first device to perform prefetching based on the area size of the shared virtual memory and the bus bandwidth between the first device and the second device; and predict the second device from all other devices;
[0161] The pre-fetch module 404 includes:
[0162] The first pre-fetch submodule is deployed on the first device and is used to asynchronously store the application data into the physical memory of the second device by utilizing the relaxation interval when the pre-fetch time is less than or equal to the relaxation interval; the relaxation interval is the interval between two adjacent accesses of the two devices to the shared virtual memory.
[0163] Optionally, the prefetch module 404 includes: a synchronous prefetch submodule and an asynchronous prefetch submodule; the synchronous prefetch submodule is used to perform a synchronous prefetch phase when the prefetch time is greater than the relaxation interval; the asynchronous prefetch submodule is used to perform an asynchronous prefetch phase when the prefetch time is greater than the relaxation interval; wherein,
[0164] The synchronous prefetching stage includes: blocking the first device during the compensation time period before the relaxation interval by driving the first device, so that the first device only prefetches the application data during the compensation time period and stores the application data in the physical memory of the second device; the value of the compensation time period is the difference between the prefetching time and the relaxation interval;
[0165] The asynchronous pre-fetching stage includes: the first device continues to pre-fetch the application data by utilizing the relaxation interval, and asynchronously stores the application data into the physical memory of the second device.
[0166] Optionally, the device 400 further includes:
[0167] an instruction setting module, deployed in the first device driver, for setting a virtual barrier instruction, wherein the virtual barrier instruction is used to ensure that the second device is allowed to use the application data only after the first device pre-fetching is completed;
[0168] The reading module 405 includes:
[0169] a detection submodule, deployed in the second device, for detecting whether the prefetching of the first device is finished based on the virtual barrier instruction before starting to read the application data from the physical memory of the second device;
[0170] A waiting submodule is deployed on the second device, and is used to wait and continuously detect whether the prefetching of the first device is completed when the prefetching of the first device is not completed, until it is detected that the prefetching of the first device is completed;
[0171] The reading submodule is deployed on the second device, and is used to read the application data from the physical memory of the second device and start using the application data when the pre-fetching of the first device is completed.
[0172] Optionally, the physical memory of the second device includes a target memory for storing the application data, and the waiting submodule includes:
[0173] A locking submodule, deployed in the management unit of the shared virtual memory, for locking the target memory based on the virtual barrier instruction until the end of the prefetching of the first device is detected;
[0174] The reading submodule comprises:
[0175] The unlocking submodule is deployed in the management unit of the shared virtual memory, and is used to unlock the target memory based on the virtual barrier instruction when the pre-fetching of the first device is completed, and the second device reads the application data from the target memory and starts to use the application data.
[0176] Optionally, the device 400 further includes:
[0177] A hypergraph construction module, deployed in the mobile simulator, for collecting historical usage data of multiple shared virtual memories from a global perspective, and maintaining and constructing a double-layer hypergraph structure based on the historical usage data; wherein, in the double-layer hypergraph structure, one layer of the hypergraph structure includes historical data flows between virtual devices in the mobile simulator, and the other layer of the hypergraph structure includes historical data flows between real devices on the host machine;
[0178] The device prediction module 403 includes:
[0179] The prediction submodule is used to predict the time when the second device and the application data will be shared by using the exponential smoothing method through the double-layer hypergraph structure.
[0180] Based on the same inventive concept, another embodiment of the present invention provides an electronic device 500, such as Figure 5 shown. Figure 5 1 is a schematic diagram of an electronic device according to an embodiment of the present invention. The electronic device includes a processor 501, a memory 502, and a computer program stored in the memory 502 and executable on the processor 501. When the computer program is executed by the processor, the steps of the method for optimizing data sharing between devices using a mobile simulator according to any of the above embodiments of the present invention are implemented.
[0181] Based on the same inventive concept, another embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps in the method for optimizing data sharing between devices in a mobile simulator as described in any of the above embodiments of the present invention are implemented.
[0182] Based on the same inventive concept, another embodiment of the present invention provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps in the method for optimizing data sharing between devices in a mobile simulator as described in any of the above embodiments of the present invention.
[0183] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0184] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0185] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, embodiments of the present invention may take the form of complete hardware embodiments, complete software embodiments, or embodiments combining software and hardware. Furthermore, embodiments of the present invention may take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0186] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0187] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0188] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0189] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0190] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0191] The above is a detailed introduction to the method, device, equipment, medium and product for optimizing data sharing between devices in a mobile simulator provided by the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A method for optimizing data sharing between devices using a mobile simulator, characterized in that: The method comprises: The application on the mobile simulator initiates write distribution; Controlling, by means of a first device driver on the mobile simulator, a first device on the host machine to start writing application data of the application into a physical memory of the first device; Predicting, by means of a hypergraph structure on the mobile simulator, a second device on the host machine that will share the application data and a time when the application data will be shared; The first device performs pre-fetching, reads the application data from the physical memory of the first device and stores the application data into the physical memory of the second device, wherein the physical memory of the first device and the physical memory of the second device are regarded as a common shared virtual memory by the mobile simulator; When the time for sharing the application data arrives, the second device reads the application data from the physical memory of the second device and starts to use the application data.
2. The method according to claim 1, characterized in that The method further comprises: Based on the ID of the shared virtual memory, historical statistical information of the data flow corresponding to the shared virtual memory is obtained through the hypergraph structure, wherein the historical statistical information at least includes: the area size of the shared virtual memory and the bus bandwidth between the first device and all other devices; The predicting, by using the hypergraph structure on the mobile simulator, the second device on the host machine that will share the application data comprises: Predicting a prefetch time for the first device to perform prefetching based on the area size of the shared virtual memory and the bus bandwidth between the first device and the second device; and predicting the second device from all other devices; When the prefetch time is less than or equal to the relaxation interval, the first device performs prefetching, reads the application data from the physical memory of the first device and stores the application data in the physical memory of the second device, including: The first device uses the relaxation interval to asynchronously store the application data in the physical memory of the second device; the relaxation interval is the interval between two adjacent accesses to the shared virtual memory by two devices.
3. The method according to claim 2, characterized in that In the case where the prefetch time is greater than the relaxation interval, the first device performs prefetching, and the process of reading the application data from the physical memory of the first device and storing it in the physical memory of the second device includes: a synchronous prefetching stage and an asynchronous prefetching stage; The synchronous prefetching stage includes: blocking the first device during the compensation time period before the relaxation interval by driving the first device, so that the first device only prefetches the application data during the compensation time period and stores the application data in the physical memory of the second device; the value of the compensation time period is the difference between the prefetching time and the relaxation interval; The asynchronous pre-fetching stage includes: the first device continues to pre-fetch the application data by utilizing the relaxation interval, and asynchronously stores the application data into the physical memory of the second device.
4. The method according to claim 1, characterized in that: The method further comprises: The first device driver sets a virtual barrier instruction, wherein the virtual barrier instruction is used to ensure that the second device is allowed to use the application data only after the first device pre-fetching is completed; The reading and starting to use the application data from the physical memory of the second device includes: Before the second device starts to read the application data from the physical memory of the second device, detecting, based on the virtual barrier instruction, whether the prefetching of the first device is completed; In the case that the first device has not finished prefetching, the second device waits and continuously detects whether the first device has finished prefetching until it detects that the first device has finished prefetching; When the prefetching by the first device is finished, the second device reads the application data from the physical memory of the second device and starts to use the application data.
5. The method according to claim 4, characterized in that The physical memory of the second device includes a target memory for storing the application data, and the second device waits and continuously detects whether the prefetching of the first device is completed until it is detected that the prefetching of the first device is completed, including: The management unit of the shared virtual memory locks the target memory based on the virtual barrier instruction until it is detected that the prefetching of the first device ends; When the prefetching by the first device ends, the second device reads the application data from the physical memory of the second device and starts to use the application data, including: When the prefetching of the first device is completed, the management unit of the shared virtual memory unlocks the target memory based on the virtual barrier instruction, and the second device reads the application data from the target memory and starts to use the application data.
6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: The mobile simulator collects historical usage data of multiple shared virtual memories from a global perspective, and maintains and constructs a two-layer hypergraph structure based on the historical usage data; wherein, in the two-layer hypergraph structure, one layer of the hypergraph structure includes historical data flows between virtual devices in the mobile simulator, and the other layer of the hypergraph structure includes historical data flows between real devices on the host machine; The predicting, by using the hypergraph structure on the mobile simulator, the second device on the host machine that will share the application data and the time when the application data will be shared includes: The time when the second device and the application data will be shared is predicted by using the double-layer hypergraph structure and an exponential smoothing method.
7. A data sharing device between mobile simulator optimization devices, characterized in that: The device comprises: Write distribution module, an application deployed on the mobile simulator, used to initiate write distribution; A writing module, used for controlling the first device on the host machine to start writing the application data of the application into the physical memory of the first device through the first device driver on the mobile simulator; A device prediction module, used for predicting the second device on the host machine that will share the application data and the time when the application data will be shared through the hypergraph structure on the mobile simulator; a pre-fetch module, deployed on the first device, for pre-fetching, reading the application data from the physical memory of the first device and storing the application data in the physical memory of the second device, wherein the physical memory of the first device and the physical memory of the second device are regarded as a common shared virtual memory by the mobile simulator; The reading module is deployed on the second device and is used to read and start using the application data from the physical memory of the second device when the time for sharing the application data arrives.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the computer program is executed by the processor, the mobile simulator optimizes data sharing between devices as described in any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the mobile simulator optimizes data sharing between devices as described in any one of claims 1 to 6.
10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the mobile simulator optimized inter-device data sharing as claimed in any one of claims 1 to 6 is implemented.
