WO2018119709A1 - 用于多操作系统的内存访问方法、装置和电子设备 - Google Patents

用于多操作系统的内存访问方法、装置和电子设备 Download PDF

Info

Publication number
WO2018119709A1
WO2018119709A1 PCT/CN2016/112489 CN2016112489W WO2018119709A1 WO 2018119709 A1 WO2018119709 A1 WO 2018119709A1 CN 2016112489 W CN2016112489 W CN 2016112489W WO 2018119709 A1 WO2018119709 A1 WO 2018119709A1
Authority
WO
WIPO (PCT)
Prior art keywords
operating system
shared memory
software
guest operating
sub
Prior art date
Application number
PCT/CN2016/112489
Other languages
English (en)
French (fr)
Inventor
孔祥晓
Original Assignee
深圳前海达闼云端智能科技有限公司
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 深圳前海达闼云端智能科技有限公司 filed Critical 深圳前海达闼云端智能科技有限公司
Priority to CN201680002957.7A priority Critical patent/CN106796536A/zh
Priority to PCT/CN2016/112489 priority patent/WO2018119709A1/zh
Priority to JP2019533029A priority patent/JP2020503609A/ja
Publication of WO2018119709A1 publication Critical patent/WO2018119709A1/zh
Priority to US16/453,055 priority patent/US20190317795A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45545Guest-host, i.e. hypervisor is an application program itself, e.g. VirtualBox
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45583Memory management, e.g. access or allocation

Definitions

  • the present application relates to the field of virtualization technologies, and in particular, to a memory access method, apparatus, and electronic device for multiple operating systems.
  • Gralloc Graphic Memory Allocator
  • the shared memory refers to a memory area that is continuously accessed by a DMA (Direct Memory Access) device and can be directly used by a GPU (Graphics Processing Unit) or a VPU (Visual Processing Unit,
  • the hardware processing device such as the visual processing unit), the camera camera, and the like, and also supports the texture texture as OpenGL (Open Graphics Library) for rendering use.
  • OpenGL Open Graphics Library
  • Gralloc allows memory sharing between different modules, and the shared memory supports direct access by DMA devices without the need for CPU (Central Processing Unit) copying and processing, which greatly reduces the CPU load rate. CPU utilization and parallel processing power are greatly improved.
  • CPU Central Processing Unit
  • the embodiment of the present application provides a memory access method, device, and electronic device for multiple operating systems, which are mainly used to implement access to shared memory by multiple operating systems.
  • the embodiment of the present application provides a memory access method for multiple operating systems, where the method includes:
  • the shared memory management module Gralloc allocates a shared memory sub-area to the guest operating system, and returns an index value of the shared memory sub-area to the guest operating system;
  • the address of the mapping sub-region is returned to the software.
  • the embodiment of the present application provides a memory access device for multiple operating systems, where the device includes:
  • the application module is configured to apply for shared memory to the main operating system when the shared memory is detected in the guest operating system;
  • a first processing module configured to allocate, by the shared memory management module Gralloc, a shared memory sub-area in the main operating system, and return an index value of the shared memory sub-area to the guest operating system;
  • a second processing module configured to: in the guest operating system, after mapping the shared memory sub-region corresponding to the index value to the guest operating system by the analog processor QEMU, returning the address of the mapping sub-region to the software.
  • an embodiment of the present application provides an electronic device, where the electronic device includes:
  • a memory one or more processors; a memory coupled to the processor via a communication bus; a processor configured to execute instructions in the memory; the storage medium storing instructions for performing the various steps of the first aspect described above.
  • an embodiment of the present application provides a computer program product for use in conjunction with an electronic device, the computer program product comprising a computer program embedded in a computer readable storage medium, the computer program comprising The electronic device performs each of the above first aspects Instructions for the steps.
  • the shared memory in the guest operating system, when the software needs to share the memory, the shared memory is applied to the main operating system; in the main operating system, a shared memory sub-area is allocated to the guest operating system through the Gralloc, and is operated by the client.
  • the system returns the index value of the shared memory sub-area; in the guest operating system, after the shared memory sub-region corresponding to the index value is mapped to the guest operating system by the QEMU, the address of the mapped sub-area is returned to the software, and the multi-operating system pair is realized. Shared memory access.
  • FIG. 1 is a schematic structural diagram of a system for applying a memory access method for multiple operating systems according to an embodiment of the present application
  • FIG. 2 is a schematic flowchart of a memory access method for multiple operating systems according to an embodiment of the present application
  • FIG. 3 is a schematic flowchart of another memory access method for multiple operating systems in the embodiment of the present application.
  • FIG. 4 is a schematic structural diagram of a memory access device for multiple operating systems according to an embodiment of the present application.
  • FIG. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
  • Gralloc can enable different modules to access a block of memory at the same time, and the access of the memory also supports direct access of the DMA device without copying through the CPU, which greatly reduces the CPU load rate and makes the CPU utilization and parallel processing capability larger. Improvement. But for virtual operating systems, there is currently no viable solution for virtualizing Grancloc.
  • the present application provides a memory access method for multiple operating systems.
  • the shared memory is requested from the main operating system; in the main operating system, through the Gralloc Allocating a shared memory sub-area to the guest operating system, and returning the index value of the shared memory sub-area to the guest operating system; in the guest operating system, after mapping the shared memory sub-area corresponding to the index value to the guest operating system through QEMU, the mapping is performed.
  • the address of the sub-area is returned to the software, enabling multiple operating systems to access shared memory.
  • the present invention provides a memory access method for multiple operating systems, which is applied to the system shown in FIG. 1, which includes a plurality of guest operating systems 101 and a host operating system 102.
  • Each guest operating system 101 includes a vGralloc and front end driver 1011.
  • the main operating system 102 includes a backend driver 1021, a Gralloc 1022, and a Gralloc server 1023.
  • the software is software that needs to call the central processor to directly access the memory. For example, Camera Capture or video soft coding.
  • the shared memory application is sent to the main operating system.
  • any guest operating system 101 when monitoring that the software requires shared memory, communicates with the backend driver 1011 through the communication between the front end driver 1011 and the backend driver 1011, to the Gralloc server 1023. Apply for a shared memory.
  • the main operating system 102 after receiving the shared memory request by the backend driver 1021, the main operating system 102 requests the Gralloc server 1023 to call the Gralloc 1022 to allocate a shared memory sub-area for the any guest operating system 1021.
  • the main operating system 102 returns the index value corresponding to the shared memory sub-area to any of the guest operating systems by communication between the front-end driver 1011 and the back-end driver 1021.
  • the address of the mapping sub-region is returned to the software.
  • any guest operating system 101 sends an index value to the QEMU, and the QEMU maps the shared memory sub-region corresponding to the index value to any guest operating system 101, and any guest operating system 101 returns the address of the mapping sub-region to the software. .
  • the shared memory sub-area is mapped to any guest operating system 101 system through the QEMU, and the QEMU mapped shared memory sub-area is remapped to the user space of any guest operating system 101 through the kernel of any guest operating system 101.
  • the address of the mapping sub-area is returned to the software, so that the mapping sub-area corresponding to the address is accessed by software in any of the guest operating systems 101, thereby accessing the shared memory sub-area of the main operating system 102.
  • any guest operating system 101 is a guest
  • the main operating system 102 is a Host.
  • the Camera in the Guest is ready to take a photo, apply for a shared memory to the Gralloc server of the Host through the communication between the front-end driver of the Guest and the back-end driver of the Host.
  • Guest through front-end driver and The communication between the host's backend driver obtains the index value corresponding to the shared memory subregion.
  • the index value is first sent to the main operating system of the Camera, and the main operating system of the Camera finds the corresponding shared memory sub-area according to the index value, and the camera device fills the photographed data into the area by DMA. Then, the index value corresponding to the shared memory sub-area is sent to the QEMU at the guest end, and the shared memory sub-area corresponding to the index value is mapped to the guest system by the QEMU, thereby locking the corresponding shared memory sub-area. After the guest maps the shared memory sub-area to the user space, the Guest returns the address of the mapped sub-area to the software, and the software of the Camera in the Guest reads and saves the data of the shared memory sub-area as a photo file by the CPU.
  • the shared memory in the guest operating system, when the software needs to share the memory, the shared memory is applied to the main operating system; in the main operating system, a shared memory sub-area is allocated to the guest operating system through the Gralloc, and is operated by the client.
  • the system returns the index value of the shared memory sub-area; in the guest operating system, after the shared memory sub-region corresponding to the index value is mapped to the guest operating system by the QEMU, the address of the mapped sub-area is returned to the software, and the multi-operating system pair is realized. Shared memory access.
  • the present embodiment provides a memory access device for multiple operating systems, the principle of the memory access device for multiple operating systems solving the problem and one for multiple operating systems shown in FIG.
  • the memory access method is similar, so the implementation of the memory access device for multiple operating systems can be referred to the implementation of a memory access method for multiple operating systems shown in FIG. 2, and the repeated description is not repeated.
  • the memory access device for multiple operating systems includes:
  • the application module 401 is configured to apply for shared memory to the main operating system when the shared memory is detected by the software in the guest operating system;
  • the first processing module 402 is configured to share the memory management module in the main operating system Gralloc allocates a shared memory sub-area for the guest operating system and returns the index value of the shared memory sub-area to the guest operating system;
  • the second processing module 403 is configured to: after mapping the shared memory sub-region corresponding to the index value to the guest operating system by the analog processor QEMU in the guest operating system, returning the address of the mapping sub-region to the software.
  • the application module 401 is configured to send, in the guest operating system, a shared memory request to the main operating system when it is detected that the software needs the shared memory.
  • the software is software that requires a central processor to access the memory directly.
  • the shared memory in the guest operating system, when the software needs to share the memory, the shared memory is applied to the main operating system; in the main operating system, a shared memory sub-area is allocated to the guest operating system through the Gralloc, and is operated by the client.
  • the system returns the index value of the shared memory sub-area; in the guest operating system, after the shared memory sub-region corresponding to the index value is mapped to the guest operating system by the QEMU, the address of the mapped sub-area is returned to the software, and the multi-operating system pair is realized. Shared memory access.
  • the embodiment of the present application further provides an electronic device.
  • the electronic device includes:
  • a memory 501 one or more processors 502; a memory coupled to the processor via a communication bus; a processor configured to execute instructions in the memory; the storage medium storing therein for performing any of the above Instructions for each step in the memory access method of multiple operating systems.
  • an embodiment of the present application further provides a computer program product for use in combination with an electronic device, the computer program product comprising a computer program embedded in a computer readable storage medium, the computer program comprising The electronic device is caused to execute the instructions of the various steps in the memory access method for multiple operating systems described in any of the above.
  • embodiments of the present application can be provided as a method, system, or computer program product.
  • the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment in combination of software and hardware.
  • the application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer usable program code.
  • the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
  • These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device.
  • the instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Memory System Of A Hierarchy Structure (AREA)
  • Stored Programmes (AREA)
  • Multi Processors (AREA)

Abstract

一种用于多操作系统的内存访问方法、装置和电子设备,该方法在客户操作系统中,在监测到软件需要共享内存时,向主操作系统申请共享内存(201);在主操作系统中,通过Gralloc为客户操作系统分配一块共享内存子区域,向客户操作系统返回共享内存子区域的索引值(202);在客户操作系统中,通过QEMU将索引值对应的共享内存子区域映射至客户操作系统后,将映射子区域的地址返回至软件(203)。该方法客户操作系统向主操作系统申请共享内存;主操作系统为客户操作系统分配一块共享内存子区域;在客户操作系统中,通过QEMU将索引值对应的共享内存子区域映射至客户操作系统后,将映射子区域的地址返回至软件,实现了多操作系统对共享内存的访问。

Description

用于多操作系统的内存访问方法、装置和电子设备 技术领域
本申请涉及虚拟化技术领域,特别涉及一种用于多操作系统的内存访问方法、装置和电子设备。
背景技术
Gralloc(Graphic Memory Allocator)是谷歌Google开发的专为安卓Android显示系统使用的一种共享内存的管理模块。该共享内存特指一种物理地址连续、支持DMA(Direct Memory Access,直接内存存取)设备直接访问的内存区域,可以直接被GPU(Graphics Processing Unit,图形处理器)、VPU(Visual Processing Unit,视觉处理单元)、相机Camera等硬件设备访问,并且还支持作为OpenGL(Open Graphics Library,图形程序接口)的纹理texture作渲染使用。
通过Gralloc可以使不同的模块之间的内存共享,并且该共享内存支持DMA设备直接访问,而不需要通过CPU(Central Processing Unit,中央处理器)拷贝和处理,大大降低了CPU的负载率,使CPU利用率和并行处理能力得到更大的提升。
随着虚拟化技术的飞速发展,在虚拟化技术领域如何访问这种共享内存成为亟待解决的问题。
发明内容
本申请实施例提供了一种用于多操作系统的内存访问方法、装置和电子设备,主要用以实现多操作系统对共享内存的访问。
第一方面,本申请实施例提供了一种用于多操作系统的内存访问方法,所述方法包括:
在客户操作系统中,在监测到软件需要共享内存时,向主操作系统申请共享内存;
在主操作系统中,通过共享内存管理模块Gralloc为所述客户操作系统分配一块共享内存子区域,向所述客户操作系统返回共享内存子区域的索引值;
在客户操作系统中,通过模拟处理器QEMU将所述索引值对应的共享内存子区域映射至所述客户操作系统后,将映射子区域的地址返回至所述软件。
第二方面,本申请实施例提供了一种用于多操作系统的内存访问装置,所述装置包括:
申请模块,用于在客户操作系统中,在监测到软件需要共享内存时,向主操作系统申请共享内存;
第一处理模块,用于在主操作系统中,通过共享内存管理模块Gralloc为所述客户操作系统分配一块共享内存子区域,向所述客户操作系统返回共享内存子区域的索引值;
第二处理模块,用于在客户操作系统中,通过模拟处理器QEMU将所述索引值对应的共享内存子区域映射至所述客户操作系统后,将映射子区域的地址返回至所述软件。
第三方面,本申请实施例提供了一种电子设备,所述电子设备包括:
存储器,一个或多个处理器;存储器与处理器通过通信总线相连;处理器被配置为执行存储器中的指令;所述存储介质中存储有用于执行上述第一方面中各个步骤的指令。
第四方面,本申请实施例提供了一种与电子设备结合使用的计算机程序产品,所述计算机程序产品包括内嵌于计算机可读的存储介质中的计算机程序,所述计算机程序包括用于使所述电子设备执行上述第一方面中各 个步骤的指令。
有益效果如下:
本申请实施例中在客户操作系统中,在监测到软件需要共享内存时,向主操作系统申请共享内存;在主操作系统中,通过Gralloc为客户操作系统分配一块共享内存子区域,向客户操作系统返回共享内存子区域的索引值;在客户操作系统中,通过QEMU将索引值对应的共享内存子区域映射至客户操作系统后,将映射子区域的地址返回至软件,实现了多操作系统对共享内存的访问。
附图说明
下面将参照附图描述本申请的具体实施例,其中:
图1为本申请实施例中的一种应用用于多操作系统的内存访问方法的系统的结构示意;
图2为本申请实施例中的一种用于多操作系统的内存访问方法的流程示意图;
图3为本申请实施例中的另一种用于多操作系统的内存访问方法的流程示意图;
图4为本申请实施例中的一种用于多操作系统的内存访问装置的结构示意图;
图5为本申请实施例中的一种电子设备的结构示意图。
具体实施方式
为了使本申请的技术方案及优点更加清楚明白,以下结合附图对本申请的示例性实施例进行进一步详细的说明,显然,所描述的实施例仅是本申请的一部分实施例,而不是所有实施例的穷举。并且在不冲突的情况下,本申请中的实施例及实施例中的特征可以互相结合。
申请人在申请过程中注意到:
Gralloc既可以使不同的模块同时访问一块内存,并且该内存的访问还支持DMA设备的直接访问而不需要通过CPU拷贝,大大降低了CPU的负载率,使CPU利用率和并行处理能力得到更大的提升。但是对于虚拟操作系统,目前没有将Gralloc虚拟化的可行方案。
基于此,本申请提供了一种用于多操作系统的内存访问方法,在客户操作系统中,在监测到软件需要共享内存时,向主操作系统申请共享内存;在主操作系统中,通过Gralloc为客户操作系统分配一块共享内存子区域,向客户操作系统返回共享内存子区域的索引值;在客户操作系统中,通过QEMU将索引值对应的共享内存子区域映射至客户操作系统后,将映射子区域的地址返回至软件,实现了多操作系统对共享内存的访问。
本申请提供的一种用于多操作系统的内存访问方法,应用于图1所示的系统,该系统包括多个客户操作系统101和一个主操作系统102。各客户操作系统101均包括一个vGralloc和前端驱动1011,主操作系统102包括后端驱动1021、一个Gralloc1022、以及一个Gralloc服务端1023。
图1所示的系统中任一客户操作系统101在访问由所有客户操作系统101和主操作系统102共享的物理连续的内存时,可按照如下流程实现。参见图2,该流程为:
201,在客户操作系统中,在监测到软件需要共享内存时,向主操作系统申请共享内存。
其中,软件为需要调用中央处理器直接访问内存的软件。例如,Camera Capture或者视频软编码。
具体的,在客户操作系统中,在监测到软件需要共享内存时,向主操作系统发送共享内存申请。
例如,任一客户操作系统101在监测到软件需要共享内存时,通过其包括的前端驱动1011与后端驱动1021之间的通信,向Gralloc服务端1023 申请一块共享内存。
202,在主操作系统中,通过Gralloc为客户操作系统分配一块共享内存子区域,向客户操作系统返回共享内存子区域的索引值。
具体的,主操作系统102通过后端驱动1021接收到共享内存申请后,请求Gralloc服务端1023调用Gralloc1022为该任一客户操作系统1021分配一块共享内存子区域。主操作系统102通过前端驱动1011与后端驱动1021之间的通信,向该任一客户操作系统返回共享内存子区域对应的索引值。
通过步骤201和步骤202为任一客户操作系统101分配共享内存子区域后,即实现Gralloc 1022的虚拟化。
203,在客户操作系统中,通过QEMU将索引值对应的共享内存子区域映射至客户操作系统后,将映射子区域的地址返回至软件。
具体的,任一客户操作系统101将索引值发送给QEMU,QEMU将索引值对应的共享内存子区域映射到任一客户操作系统101,任一客户操作系统101将映射子区域的地址返回至软件。
例如,将共享内存子区域通过QEMU映射到任一客户操作系统101系统中,再通过任一客户操作系统101的kernel将QEMU映射的共享内存子区域再映射到任一客户操作系统101的用户空间中,任一客户操作系统101将映射子区域的地址返回至软件,从而通过任一客户操作系统101中的软件访问该地址对应的映射子区域,进而访问主操作系统102的共享内存子区域。
以拍照流程为例,通过本实施例提供的方法进行内存访问的方法如下。参见图3,任一客户操作系统101为Guest,主操作系统102为Host。Guest中的Camera准备拍照时,通过Guest的前端驱动与Host的后端驱动之间的通信,向Host的Gralloc服务端申请一块共享内存。Guest通过前端驱动与 Host的后端驱动之间的通信获取该共享内存子区域对应的索引值。当Camera拍照时,先将索引值发送至Camera的主操作系统,由Camera的主操作系统根据索引值找到对应的共享内存子区域,并由Camera设备通过DMA将拍照后的数据填充至本区域,然后在Guest端将该共享内存子区域对应的索引值发送至QEMU,QEMU将索引值对应的共享内存子区域映射到Guest系统中,进而锁定对应的共享内存子区域。Guest将该共享内存子区域映射到用户空间后,Guest将映射子区域的地址返回至软件,Guest中的Camera的软件通过CPU将该共享内存子区域的数据读出并保存为照片文件。
有益效果:
本申请实施例中在客户操作系统中,在监测到软件需要共享内存时,向主操作系统申请共享内存;在主操作系统中,通过Gralloc为客户操作系统分配一块共享内存子区域,向客户操作系统返回共享内存子区域的索引值;在客户操作系统中,通过QEMU将索引值对应的共享内存子区域映射至客户操作系统后,将映射子区域的地址返回至软件,实现了多操作系统对共享内存的访问。
基于同一发明构思,本实施例提供了一种用于多操作系统的内存访问装置,该用于多操作系统的内存访问装置解决问题的原理与图2所示的一种用于多操作系统的内存访问方法相似,因此该用于多操作系统的内存访问装置的实施可以参见图2所示的一种用于多操作系统的内存访问方法的实施,重复之处不再赘述。
参见图4,该用于多操作系统的内存访问装置包括:
申请模块401,用于在客户操作系统中,在监测到软件需要共享内存时,向主操作系统申请共享内存;
第一处理模块402,用于在主操作系统中,通过共享内存管理模块 Gralloc为客户操作系统分配一块共享内存子区域,向客户操作系统返回共享内存子区域的索引值;
第二处理模块403,用于在客户操作系统中,通过模拟处理器QEMU将索引值对应的共享内存子区域映射至客户操作系统后,将映射子区域的地址返回至软件。
可选地,申请模块401,用于在客户操作系统中,在监测到软件需要共享内存时,向主操作系统发送共享内存申请。
可选地,软件为需要调用中央处理器直接访问内存的软件。
有益效果:
本申请实施例中在客户操作系统中,在监测到软件需要共享内存时,向主操作系统申请共享内存;在主操作系统中,通过Gralloc为客户操作系统分配一块共享内存子区域,向客户操作系统返回共享内存子区域的索引值;在客户操作系统中,通过QEMU将索引值对应的共享内存子区域映射至客户操作系统后,将映射子区域的地址返回至软件,实现了多操作系统对共享内存的访问。
再一方面,本申请实施例还提供了一种电子设备,参见图5,电子设备包括:
存储器501,一个或多个处理器502;存储器与处理器通过通信总线相连;处理器被配置为执行存储器中的指令;所述存储介质中存储有用于执行上述的任一项所述的用于多操作系统的内存访问方法中各个步骤的指令。
再一方面,本申请实施例还提供了一种与电子设备结合使用的计算机程序产品,所述计算机程序产品包括内嵌于计算机可读的存储介质中的计算机程序,所述计算机程序包括用于使所述电子设备执行上述的任一项所述的用于多操作系统的内存访问方法中各个步骤的指令。
本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本申请是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
尽管已描述了本申请的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所 附权利要求意欲解释为包括优选实施例以及落入本申请范围的所有变更和修改。

Claims (8)

  1. 一种用于多操作系统的内存访问方法,其特征在于,所述方法包括:
    在客户操作系统中,在监测到软件需要共享内存时,向主操作系统申请共享内存;
    在主操作系统中,通过共享内存管理模块Gralloc为所述客户操作系统分配一块共享内存子区域,向所述客户操作系统返回共享内存子区域的索引值;
    在客户操作系统中,通过模拟处理器QEMU将所述索引值对应的共享内存子区域映射至所述客户操作系统后,将映射子区域的地址返回至所述软件。
  2. 根据权利要求1所述的方法,其特征在于,所述在客户操作系统中,在监测到软件需要共享内存时,向主操作系统申请共享内存,包括:
    在客户操作系统中,在监测到软件需要共享内存时,向主操作系统发送共享内存申请。
  3. 根据权利要求1所述的方法,其特征在于,所述软件为需要调用中央处理器直接访问内存的软件。
  4. 一种用于多操作系统的内存访问装置,其特征在于,所述装置包括:
    申请模块,用于在客户操作系统中,在监测到软件需要共享内存时,向主操作系统申请共享内存;
    第一处理模块,用于在主操作系统中,通过共享内存管理模块Gralloc为所述客户操作系统分配一块共享内存子区域,向所述客户操作系统返回共享内存子区域的索引值;
    第二处理模块,用于在客户操作系统中,通过模拟处理器QEMU将所述索引值对应的共享内存子区域映射至所述客户操作系统后,将映射子区域的地址返回至所述软件。
  5. 根据权利要求4所述的装置,其特征在于,所述申请模块,用于在客户操作系统中,在监测到软件需要共享内存时,向主操作系统发送共享内存申请。
  6. 根据权利要求4所述的装置,其特征在于,所述软件为需要调用中央处理器直接访问内存的软件。
  7. 一种电子设备,其特征在于,所述电子设备包括:
    存储器,一个或多个处理器;存储器与处理器通过通信总线相连;处理器被配置为执行存储器中的指令;所述存储介质中存储有用于执行权利要求1至3任一权利要求中各个步骤的指令。
  8. 一种与电子设备结合使用的计算机程序产品,所述计算机程序产品包括内嵌于计算机可读的存储介质中的计算机程序,所述计算机程序包括用于使所述电子设备执行权利要求1至3任一权利要求中的各个步骤的指令。
PCT/CN2016/112489 2016-12-27 2016-12-27 用于多操作系统的内存访问方法、装置和电子设备 WO2018119709A1 (zh)

Priority Applications (4)

Application Number Priority Date Filing Date Title
CN201680002957.7A CN106796536A (zh) 2016-12-27 2016-12-27 用于多操作系统的内存访问方法、装置和电子设备
PCT/CN2016/112489 WO2018119709A1 (zh) 2016-12-27 2016-12-27 用于多操作系统的内存访问方法、装置和电子设备
JP2019533029A JP2020503609A (ja) 2016-12-27 2016-12-27 マルチオペレーティングシステム用のメモリアクセス方法、装置及び電子設備
US16/453,055 US20190317795A1 (en) 2016-12-27 2019-06-26 Memory access method for use in multi-operating systems and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2016/112489 WO2018119709A1 (zh) 2016-12-27 2016-12-27 用于多操作系统的内存访问方法、装置和电子设备

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US16/453,055 Continuation US20190317795A1 (en) 2016-12-27 2019-06-26 Memory access method for use in multi-operating systems and electronic device

Publications (1)

Publication Number Publication Date
WO2018119709A1 true WO2018119709A1 (zh) 2018-07-05

Family

ID=58952276

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/112489 WO2018119709A1 (zh) 2016-12-27 2016-12-27 用于多操作系统的内存访问方法、装置和电子设备

Country Status (4)

Country Link
US (1) US20190317795A1 (zh)
JP (1) JP2020503609A (zh)
CN (1) CN106796536A (zh)
WO (1) WO2018119709A1 (zh)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107329836B (zh) * 2017-07-13 2021-01-22 北京元心科技有限公司 多系统的内存管理方法、管理装置以及移动终端
CN107656993A (zh) * 2017-09-15 2018-02-02 上海斐讯数据通信技术有限公司 一种实现进程间avl树使用的方法及系统
CN108932213A (zh) * 2017-10-10 2018-12-04 北京猎户星空科技有限公司 多操作系统间的通讯方法、装置、电子设备和存储介质
CN111247512B (zh) * 2017-10-17 2021-11-09 华为技术有限公司 用于统一内存访问的计算机系统
CN116302617B (zh) * 2023-05-12 2023-08-04 苏州浪潮智能科技有限公司 共享内存的方法、通信方法、嵌入式系统以及电子设备
CN118113495A (zh) * 2024-04-29 2024-05-31 山东乾云启创信息科技股份有限公司 一种安全的基于共享内存的进程间数据识别方法及系统

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070052715A1 (en) * 2005-09-07 2007-03-08 Konstantin Levit-Gurevich Device, system and method of graphics processing
CN101794237A (zh) * 2009-02-02 2010-08-04 联想(北京)有限公司 一种实现通用显示的计算机和方法
CN103106058A (zh) * 2013-01-25 2013-05-15 Tcl集团股份有限公司 一种基于Android系统的双屏显示方法及智能显示终端
CN105868028A (zh) * 2015-01-23 2016-08-17 华为技术有限公司 一种进程间共享数据的方法、装置及终端

Family Cites Families (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5950228A (en) * 1997-02-03 1999-09-07 Digital Equipment Corporation Variable-grained memory sharing for clusters of symmetric multi-processors using private and shared state tables
US7644407B2 (en) * 2004-03-05 2010-01-05 Intel Corporation Method, apparatus and system for seamlessly sharing a graphics device amongst virtual machines
US9058292B2 (en) * 2004-12-29 2015-06-16 Intel Corporation System and method for one step address translation of graphics addresses in virtualization
US8065687B2 (en) * 2007-01-05 2011-11-22 Moka5, Inc. Bypass virtualization
JP4854710B2 (ja) * 2008-06-23 2012-01-18 株式会社東芝 仮想計算機システム及びネットワークデバイス共有方法
CN102110196B (zh) * 2009-12-25 2015-04-29 中国长城计算机深圳股份有限公司 并行运行多用户操作系统间的数据安全传输方法及系统
US8928680B1 (en) * 2012-07-10 2015-01-06 Google Inc. Method and system for sharing a buffer between a graphics processing unit and a media encoder
US9430258B2 (en) * 2013-05-10 2016-08-30 Vmware, Inc. Efficient sharing of identical graphics resources by multiple virtual machines using separate host extension processes
US9582849B2 (en) * 2013-10-28 2017-02-28 Vmware, Inc. Method and system to virtualize graphic processing services
CN104714821B (zh) * 2013-12-17 2018-07-31 华为技术有限公司 操作系统实例创建方法及装置
CN104580188B (zh) * 2014-12-29 2017-11-07 中国科学院信息工程研究所 一种在虚拟化环境中保护根ca证书的方法与系统
US10002405B2 (en) * 2016-01-22 2018-06-19 Intel Corporation Smart optimization of unused graphics buffer memory in computing environments

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070052715A1 (en) * 2005-09-07 2007-03-08 Konstantin Levit-Gurevich Device, system and method of graphics processing
CN101794237A (zh) * 2009-02-02 2010-08-04 联想(北京)有限公司 一种实现通用显示的计算机和方法
CN103106058A (zh) * 2013-01-25 2013-05-15 Tcl集团股份有限公司 一种基于Android系统的双屏显示方法及智能显示终端
CN105868028A (zh) * 2015-01-23 2016-08-17 华为技术有限公司 一种进程间共享数据的方法、装置及终端

Also Published As

Publication number Publication date
US20190317795A1 (en) 2019-10-17
CN106796536A (zh) 2017-05-31
JP2020503609A (ja) 2020-01-30

Similar Documents

Publication Publication Date Title
WO2018119709A1 (zh) 用于多操作系统的内存访问方法、装置和电子设备
US9569243B2 (en) Offloading and parallelizing translation table operations
US9430391B2 (en) Managing coherent memory between an accelerated processing device and a central processing unit
US20180349194A1 (en) Accelerated data operations
WO2018119952A1 (zh) 一种设备虚拟化方法、装置、系统及电子设备、计算机程序产品
WO2018119951A1 (zh) Gpu虚拟化方法、装置、系统及电子设备、计算机程序产品
US20160062802A1 (en) A scheduling method for virtual processors based on the affinity of numa high-performance network buffer resources
WO2017143718A1 (zh) 一种云渲染系统、服务器及方法
CN106462599B (zh) 缓存存储器与工作进程的关联
US11048447B2 (en) Providing direct data access between accelerators and storage in a computing environment, wherein the direct data access is independent of host CPU and the host CPU transfers object map identifying object of the data
US11204790B2 (en) Display method for use in multi-operating systems and electronic device
JP7123235B2 (ja) 仮想化用のgpuタスクコンテナとしてのvmid
WO2019028682A1 (zh) 一种多系统共享内存的管理方法及装置
CN107077376B (zh) 帧缓存实现方法、装置、电子设备和计算机程序产品
US10929079B2 (en) Video display method, electronic device and computer program product
US8751724B2 (en) Dynamic memory reconfiguration to delay performance overhead
US10089706B1 (en) GPU virtual device driver for offload processing in a storage array
CN112506646A (zh) 显存分配的方法及装置
US9088569B2 (en) Managing access to a shared resource using client access credentials
TWI452468B (zh) 虛擬機器記憶體的分享方法與電腦系統
US10051087B2 (en) Dynamic cache-efficient event suppression for network function virtualization
CN113918283A (zh) 数据存储方法、装置、系统及介质
WO2017113329A1 (zh) 一种主机集群中缓存管理方法及主机

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16925960

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2019533029

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 17.10.2019)

122 Ep: pct application non-entry in european phase

Ref document number: 16925960

Country of ref document: EP

Kind code of ref document: A1