WO2019119315A1 - Input processing method and apparatus based on multiple operating systems, and electronic device - Google Patents

Input processing method and apparatus based on multiple operating systems, and electronic device Download PDF

Info

Publication number
WO2019119315A1
WO2019119315A1 PCT/CN2017/117557 CN2017117557W WO2019119315A1 WO 2019119315 A1 WO2019119315 A1 WO 2019119315A1 CN 2017117557 W CN2017117557 W CN 2017117557W WO 2019119315 A1 WO2019119315 A1 WO 2019119315A1
Authority
WO
WIPO (PCT)
Prior art keywords
operating system
guest operating
running state
input
kernel space
Prior art date
Application number
PCT/CN2017/117557
Other languages
French (fr)
Chinese (zh)
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 PCT/CN2017/117557 priority Critical patent/WO2019119315A1/en
Priority to CN201780003332.7A priority patent/CN108235759B/en
Publication of WO2019119315A1 publication Critical patent/WO2019119315A1/en

Links

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/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/545Interprogram communication where tasks reside in different layers, e.g. user- and kernel-space

Definitions

  • the present application relates to the field of virtualization technologies, and in particular, to an input processing method, apparatus, and electronic device based on multiple operating systems.
  • multiple operating systems or virtual machines can run on the electronic device at the same time, and the processors, memory, and input and output devices provided by the hardware devices are shared among multiple operating systems or virtual machines.
  • the input device node is typically opened in the user space of the host operating system, receiving input events, and then determining whether the event needs to be forwarded to the guest operating system; if the event needs to be forwarded to the client
  • the operating system injects the event into the guest operating system kernel input device module; the client operating system application obtains the injected input event by reading the input device node in its user space.
  • the embodiment of the present invention provides an input processing method, an apparatus, and an electronic device based on multiple operating systems, which are mainly used to solve the problem that the input event injection time is long when the input event is processed based on multiple operating systems.
  • a technical solution adopted by the embodiment of the present application is to provide a multi-operating system-based input processing method, where the operating system includes a host operating system and at least one guest operating system, and the method includes:
  • injecting the input event from a kernel space of the host operating system into a kernel space of the guest operating system in a foreground running state through a preset data transmission channel, so as to be in the foreground running state The guest operating system responds to the input event.
  • another technical solution adopted by the embodiment of the present application is to provide an input processing device based on multiple operating systems, where the operating system includes a host operating system and at least one guest operating system, and the device includes determining Module and first processing module;
  • the determining module is configured to: when it is detected that the host operating system receives an input event, determine whether the guest operating system is currently in a foreground running state;
  • the first processing module is configured to: when the guest operating system is currently in a foreground running state, inject the input event from the kernel space of the host operating system into the client in a foreground running state through a preset data transmission channel; The kernel space of the operating system to cause the guest operating system in the foreground operating state to respond to the input event.
  • an electronic device including: at least one processor; and a memory communicably connected to the at least one processor; wherein the memory An instruction program executable by the at least one processor is stored, the instruction program being executed by the at least one processor to cause the at least one processor to perform the method as described above.
  • another technical solution adopted by the embodiment of the present application is to provide a non-volatile computer readable storage medium, where the non-volatile computer readable storage medium stores computer-executable instructions.
  • the computer executable instructions are for causing a computer to perform the method as described above.
  • another technical solution adopted by the embodiment of the present application is to provide a computer program product, the computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer
  • the program includes program instructions that, when executed by a computer, cause the computer to perform the method as described above.
  • the embodiment of the present application provides an input processing method and apparatus based on multiple operating systems.
  • the host operating system receives an input event, it determines whether the guest operating system is in the foreground running state, and if it exists in the foreground running state.
  • the guest operating system injects input events from the host operating system into the kernel space of the guest operating system in the foreground running state through a preset data transmission channel, thereby causing the guest operating system to respond to the input event. Since the input event can be directly injected into the kernel space of the guest operating system from the kernel space of the host operating system, the injection time of the input event is shortened, and the performance of the input system in the guest operating system is improved.
  • FIG. 1 is a schematic diagram of an application scenario of the method and apparatus of the present application.
  • FIG. 2 is a schematic flowchart of an input processing method based on multiple operating systems according to an embodiment of the present application
  • FIG. 3 is a schematic flowchart of a method for determining whether a guest operating system is in a foreground running state in a multi-operating system based input processing method according to an embodiment of the present application;
  • FIG. 4 is a schematic diagram showing the functional structure of a kernel accelerator in a host operating system kernel space in an input processing method based on multiple operating systems according to an embodiment of the present application;
  • FIG. 5 is a schematic flowchart of a multi-operating system based input processing method according to another embodiment of the present application.
  • FIG. 6 is a schematic flowchart of a multi-operating system-based input processing method according to another embodiment of the present application.
  • FIG. 7 is a schematic diagram showing the functional structure of a backend program of the guest operating system in an input processing method based on multiple operating systems according to an embodiment of the present application;
  • FIG. 8 is a schematic flowchart of a multi-operating system-based input processing method according to still another embodiment of the present application.
  • FIG. 9 is a schematic structural diagram of an input processing apparatus based on multiple operating systems according to an embodiment of the present application.
  • FIG. 10 is a schematic structural diagram of hardware of an electronic device according to an embodiment of the present application.
  • FIG. 1 is a schematic diagram of an application scenario of an input processing method and apparatus based on multiple operating systems according to an embodiment of the present application.
  • the application scenario may be a computer system environment running on a smart terminal.
  • the application scenario includes: a host operating system 10 , a guest operating system 11 , an emulator 12 , and a physical hardware device 13 .
  • the host operating system 10 and the guest operating system 11 belong to a computer program for managing and controlling the physical hardware device 13 and corresponding software resources, and are the most basic system software directly running on the "bare metal machine", and any other software must be in It can be run with the support of the host operating system 10 or the guest operating system 11.
  • the host operating system 10 and the guest operating system 11 may be any suitable type of operating system, such as: Linux, Unix, IOS, Android, Windows, etc., for receiving user instructions and outputting corresponding data accordingly. The processing results are shown to the user.
  • the physical hardware device 13 is shared between the host operating system 10 and the guest operating system 11.
  • the host operating system 10 can directly use the hardware devices in the physical hardware device 13, and the guest operating system 11 uses the virtual devices provided by the virtual machines that drive the guest operating system 11.
  • the “virtual machine” refers to a computer system that is simulated by software and has a complete hardware system function and runs in a completely isolated environment.
  • the virtual machine may form a plurality of simulated hardware devices (such as the virtual input device described in the embodiment of the present application) for use by the guest operating system 11 based on the physical hardware device 13 or a software program.
  • a virtual machine corresponds to a guest operating system 11, and each of the virtual machines can be run as one of the applications in the host operating system 10.
  • the simulator 12 can also be run as one of the applications in the host operating system 10.
  • the simulator 12 corresponds to the guest operating system 11, and when a plurality of guest operating systems 11 are included, each guest operating system 11 corresponds to one simulator 12, respectively.
  • the simulator 12 is used to run a backend program of the virtual input device, and the backend program of the virtual input device is the backend program of the guest operating system 11.
  • the physical hardware device 13 is a physically existing hardware device and may include any suitable device component that constitutes a complete computer system, including but not limited to: a processor, a storage medium, an input/output device, a communication module, and the like.
  • the processor may be any suitable type of processor having a certain logic operation capability, such as a CPU, a graphics processor, or the like.
  • the processor may also include multiple cores for multi-threading or parallel processing.
  • the storage medium may include a memory module such as a ROM, a RAM, a flash memory module, and a mass storage such as an optical disk and a hard disk.
  • Computer programs are stored in the storage medium, and when the processor executes the computer programs, various corresponding method steps or processes can be implemented.
  • the input/output device may be any suitable type of peripheral device that provides one or more modes of user interaction, such as a mouse, keyboard or touch input screen that receives user action instructions, a somatosensory camera for acquiring image information, A microphone that collects sound information or a display that presents image information to a user or a speaker that outputs audio.
  • the input/output device can optionally connect to other physical hardware devices using wired or wireless peripherals.
  • the communication module can include some network interface devices that establish connections through a wired or wireless communication network. For example, a network cable interface, a bus interface, a USB interface, a WiFi module, or a Bluetooth communication module.
  • the physical hardware device 13 may also add or reduce one or more devices to meet different practical application requirements, such as adding a database or a server device.
  • an input implementation method of multiple operating systems is implemented based on the host operating system 10, the guest operating system 11, the simulator 12, and the physical hardware device 13. Specifically, the host operating system 10 monitors whether it receives an input event, and if an input event is received, determines whether there is currently a guest operating system 11 in a foreground running state, and if so, the host operating system 10 injects the input event into the simulator. In 12, the input event is written into the kernel space of the guest operating system 11 by a backend program of the virtual input device in the simulator 12. It should be noted that after inputting the event injection simulator 12, the guest operating system 11 can also actively read the input events in the simulator 12.
  • the host operating system 10 responds to the input event when all of the guest operating systems 11 in the computer system of the smart terminal are in a sleep state.
  • the multi-operating system-based input processing method provided by the embodiment of the present application can be further extended to other suitable application environments, and is not limited to the application environment shown in FIG. 1 .
  • the application environment may also include more guest operating systems and more or less physical hardware device types.
  • FIG. 2 is a schematic flowchart of a multi-operating system-based input processing method according to an embodiment of the present application. Referring to FIG. 2, the method is include:
  • the host operating system monitors whether it receives an input event through a preset program, and the input event refers to an operation instruction generated when an operator operates an input/output device such as a keyboard or a mouse, and an operation instruction It can correspond to an input event, which can be to open a page or enter a letter or delete a symbol, and so on.
  • the host operating system After the host operating system receives the input event, it is determined whether the guest operating system is in the foreground running state. Specifically, refer to FIG. 3, where it is determined whether the guest operating system is in the foreground running state, including:
  • the host operating system communicates with the virtual switching device in the virtual machine, obtains the front/back running state of the guest operating system supported by the host operating system, and sets the front/back running state of the guest operating system to The kernel accelerator of the virtual input device in the host operating system kernel space, thereby causing the host operating system to acquire a guest operating system in a foreground running state.
  • the communication between the host operating system and the virtual switching device in the virtual machine is implemented by a backend program of the guest operating system, that is, a backend program of the virtual input device.
  • the virtual switching device is mainly used to control a front/back running state of the virtual machine.
  • the virtual switching device receives a handover request including the source virtual machine information, and determines whether the handover request is legal according to the source virtual machine information in the handover request, and if it is legal, the virtual machine corresponding to the handover request is The background running state is switched to the foreground running state.
  • the virtual switching device can also switch the virtual machine in the sleep state to the foreground running state.
  • the switching virtual machine is also a switching client, and therefore, the virtual switching device can acquire the front/back running state of all the guest operating systems it supports.
  • the background running state of the virtual machine refers to the virtual machine running, but the related service program of the human-computer interaction is closed, so the human-computer interaction interface is invisible to the user, that is, the virtual machine in the background running state can invoke the network. Modules such as communications, but can't call input and output modules that involve user interaction, such as keyboards or displays.
  • the foreground running state of the virtual machine is the state opposite to the background running state. It should be noted that the specific process of the virtual switching device acquiring the front/back running state of the guest operating system supported by the virtual switching device may also refer to the description in the related art, and is not limited to the foregoing embodiment.
  • 202 if present, injecting, by using a preset data transmission channel, the input event from a kernel space of the host operating system into a kernel space of the guest operating system in a foreground running state, so that the The guest operating system is responsive to the input event.
  • the preset data transmission channel is configured between the host operating system and the guest operating system in the foreground running state, specifically the backend program of the guest operating system running in the simulator (ie, the backend program of the virtual input device) ) to build.
  • the backend program of the guest operating system transfers information of the data transmission channel to a kernel accelerator of a virtual input device in a host operating system kernel space, by using a kernel accelerator running in a kernel space of the host operating system
  • the input event injects a backend program of the guest operating system running in a foreground running state from a kernel space of the host operating system, and the backend program writes the input event to a kernel of the guest operating system Space, thereby causing the guest operating system to respond to the input event.
  • the host operating system determines that the input event injected into the guest operating system is directly injected into the guest operating system by the accelerator in the host operating system kernel through the backend program of the virtual input device, thereby The event of input event injection into the guest operating system is shortened, so that the guest operating system can respond to the input event as soon as possible, thereby improving the performance of the guest operating system.
  • the kernel accelerator in the host operating system kernel space can implement two functions:
  • Function 1 after receiving the channel information of the data between the systems set by the backend program of the guest operating system, when the input subsystem in the host operating system kernel space has a new input event, if the input event needs to be delivered to the client
  • the operating system injects the event into the guest operating system through the data transmission channel;
  • Function 2 When the guest operating system changes from the background to the foreground running state, the data transfer channel between the systems is enabled, and the kernel accelerator enters an active state; when the guest operating system is changed from the foreground running state to the background, the inter-system is not enabled. The data transfer channel, the kernel accelerator enters a sleep state. The guest operating system is in the background by default, so the data transfer channel is turned off by default. Its functional structure is shown in Figure 4.
  • the backend program writes the input event to the kernel space of the guest operating system, and in other embodiments, the guest operating system may actively take the The input event is read into the kernel space in the end program.
  • the preset data transmission channel can be established between each guest operating system and the host operating system. And adjusting the data transmission channel corresponding to the guest operating system in the foreground running state to the enabled state, and adjusting the data transmission channel corresponding to the guest operating system in the background running state or the background sleeping state to the closed state.
  • the virtual input device corresponding to the guest operating system switched to the background enters a sleep state
  • the virtual input device corresponding to the guest operating system switched to the foreground enters an active state.
  • the method further includes:
  • the input event is cleared from an event list of the host operating system.
  • the input event can be cleared from the event list by a preset program. By deleting the input event in the event list, it is not necessary to set the input device to be exclusive when the virtual machine program is operated, so that other applications in the user space can be prevented from reading the input event, thereby reducing the leakage of the input event. risk.
  • the method before performing the method shown in FIG. 2, the method further includes:
  • the above steps are pre-configured with the virtual input device corresponding to the guest operating system before the input event is injected into the guest operating system.
  • the input device is a physical input device corresponding to a host operating system, such as a keyboard, a mouse, or the like.
  • each input device has its corresponding device file, and the device file contains configuration information such as attributes of the input device, and the configuration information is transmitted to the kernel space of the guest operating system, thereby enabling the customer to operate.
  • a driver of the virtual input device in the system registers corresponding virtual input devices in the guest operating system according to the configuration information, and sets configuration information of the virtual input devices. With this configuration, the host operating system and the guest operating system can share the same input device.
  • configuring the virtual input device is also implemented by a backend program of the guest operating system, that is, a backend program of the virtual input device in the simulator.
  • the backend program of the guest operating system mainly implements three functions: function one, configuring a channel for transferring data between the host operating system and the guest operating system, and information of the channels.
  • a kernel accelerator passed to the virtual input device in the host operating system kernel space; function 2, obtaining configuration information such as attributes of the input device through the input device in the device node in the host operating system, and transmitting the configuration information to the guest operating system Kernel space, the driver of the virtual input device in the guest operating system registers the corresponding input device in the guest operating system according to the configuration information, and sets corresponding configuration information; function three, communicates with the virtual switching device in the virtual machine, obtains It supports the front-end state of the guest operating system and sets the current front-end state to the kernel accelerator of the virtual input device in the host operating system kernel space.
  • the method further includes:
  • the host operating system responds to the input event if the guest operating system does not currently exist in the foreground running state.
  • the embodiment of the present application provides an input processing method based on multiple operating systems.
  • the host operating system receives an input event, it determines whether the guest operating system is in the foreground running state, and if it exists in the foreground running state.
  • the guest operating system injects input events from the host operating system into the kernel space of the guest operating system in the foreground running state through a preset data transmission channel, thereby causing the guest operating system to respond to the input event. Since the input event can be directly injected into the kernel space of the guest operating system from the kernel space of the host operating system, the injection time of the input event is shortened, and the performance of the input system in the guest operating system is improved. In addition, input events injected into the guest operating system are cleared from the event list, thereby reducing the risk of the input event being compromised.
  • FIG. 9 is a schematic structural diagram of an input processing apparatus based on multiple operating systems according to an embodiment of the present disclosure.
  • the operating system includes a host operating system and at least one guest operating system, as shown in FIG.
  • the device 30 includes a judging module 31 and a first processing module 32.
  • the determining module 31 is configured to: when it is detected that the host operating system receives an input event, determine whether the guest operating system is currently in a foreground running state; the first processing module 32 is configured to: if the client currently exists The operating system is in a foreground running state, and the input event is injected from a kernel space of the host operating system into a kernel space of the guest operating system in a foreground running state through a preset data transmission channel, so that the operation is in the foreground The guest operating system of the state responds to the input event.
  • the determining module 31 includes a data reading unit 311 and a state determining unit 312.
  • the data reading unit 311 is configured to read a front/back running state of the at least one guest operating system from a virtual switching device corresponding to the at least one guest operating system;
  • the state determining unit 312 is configured to: And determining, according to the obtained front/back running state of the at least one guest operating system, whether the guest operating system is currently in the foreground running state.
  • the first processing module 32 is specifically configured to: if the guest operating system is currently in the foreground running state, use the kernel accelerator running in the host operating system kernel space to input the input event from the host operating system.
  • the kernel space injects a backend program of the guest operating system running in a foreground running state, and the backend program writes the input event into a kernel space of the guest operating system to make the foreground running state
  • the guest operating system is responsive to the input event.
  • the apparatus 30 further includes a deletion module 33.
  • the deleting module 33 is configured to: when the input event is injected from a kernel space of the host operating system into a kernel space of the guest operating system in a foreground running state, the input event is from the host operating system Cleared in the event list.
  • the apparatus 30 further includes a first obtaining module 34 , a second acquiring module 35 , and a sending module 36 .
  • the first obtaining module 34 is configured to read a device file of the input device in the host operating system
  • the second acquiring module 35 is configured to acquire configuration information of the input device according to the device file
  • the sending module 36 is configured to send the configuration information to a kernel space of the guest operating system, so that a driver of the virtual input device corresponding to the input device in the guest operating system is configured according to the configuration information.
  • the virtual input device is configured.
  • the apparatus 30 further includes a second processing module 37.
  • the second processing module 37 is configured to respond to the input event if the guest operating system is not in the foreground running state.
  • the embodiment of the present application provides an input processing device based on multiple operating systems.
  • the host operating system receives an input event, it determines whether the guest operating system is in the foreground running state, and if it exists in the foreground running state.
  • the guest operating system injects input events from the host operating system into the kernel space of the guest operating system in the foreground running state through a preset data transmission channel, thereby causing the guest operating system to respond to the input event. Since the input event can be directly injected into the kernel space of the guest operating system from the kernel space of the host operating system, the injection time of the input event is shortened, and the performance of the input system in the guest operating system is improved. In addition, input events injected into the guest operating system are cleared from the event list, thereby reducing the risk of the input event being compromised.
  • FIG. 10 is a schematic structural diagram of hardware of an electronic device according to an embodiment of the present application.
  • the electronic device 40 can be any type of smart terminal, such as a mobile phone, tablet, laptop, desktop computer, server, robot, etc., capable of performing a multi-operating system based input processing method as described above. As shown in FIG. 10, the electronic device 40 includes:
  • One or more processors 41 and a memory 42 are exemplified by a processor 41 in FIG.
  • the processor 41 and the memory 42 can be connected by a bus or other means, as exemplified by a bus connection in FIG.
  • the electronic device that performs the multi-operating system based input processing method may further include: an input device 43 and an output device 44.
  • the memory 42 is a non-volatile computer readable storage medium for storing non-volatile software programs, non-volatile computer-executable programs, and modules, such as multi-operating system-based input processing in the embodiments of the present application.
  • the corresponding program instructions/modules e.g., the various modules shown in Figure 9).
  • the processor 41 executes various functional applications and data processing of the server by executing non-volatile software programs, instructions, and modules stored in the memory 42, that is, implementing the input processing method based on multiple operating systems of the above method embodiments.
  • the memory 42 may include a storage program area and an storage data area, wherein the storage program area may store an operating system, an application required for at least one function; the storage data area may be stored according to use of the multi-operating system based input processing device Data, etc.
  • memory 42 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device.
  • memory 42 may optionally include memory remotely located relative to processor 41, which may be connected to a multi-operating system based input processing device over a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
  • the input device 43 can receive input numeric or character information and generate key signal inputs related to user settings and function control of the multi-operating system based input processing device.
  • Output device 44 may include a display device such as a display screen.
  • the one or more modules are stored in the memory 42 and, when executed by the one or more processors 41, perform a multi-operating system based input processing method in any of the above method embodiments, for example, performing the above Method step 201 to step 202 in FIG. 2, method step 2011 to step 2012 in FIG. 3, method step 201 to step 203 in FIG. 5, method step 201 to step 206 in FIG. 6, and in FIG.
  • the method steps 201 to 207 implement the functions of the modules 31-37 and the units 311-312 in FIG.
  • the embodiment of the present application provides a non-transitory computer readable storage medium storing computer-executable instructions that are executed by an electronic device to perform any of the above method embodiments.
  • the multi-operating system-based input processing method for example, performs the method steps 201 to 202 in FIG. 2, the method steps 2011 to 2012 in FIG. 3, and the method steps 201 to 203 in FIG.
  • the method steps 201 to 206 in FIG. 6 and the method steps 201 to 207 in FIG. 8 implement the functions of the modules 31-37 and the units 311-312 in FIG.
  • An embodiment of the present application provides a computer program product, including a computing program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions, when the program instructions are executed by a computer,
  • the computer executes the multi-operating system based input processing method in any of the above method embodiments, for example, performs the method steps 201 to 202 in FIG. 2 described above, the method steps 2011 to 2012 in FIG. 3, and the method in FIG.
  • the method steps 201 to 203, the method steps 201 to 206 in FIG. 6, and the method steps 201 to 207 in FIG. 8 implement the functions of the modules 31-37 and the units 311-312 in FIG.
  • the device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, ie may be located A place, or it can be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • the storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • User Interface Of Digital Computer (AREA)
  • Computer And Data Communications (AREA)
  • Stored Programmes (AREA)

Abstract

The present application relates to the technical field of virtualization, in particular to an input processing method and apparatus based on multiple operating systems, and an electronic device. The method comprises: when it is monitored that a host operating system receives an input event, determining whether there is a guest operating system in a foreground running state at present; and if so, injecting, by means of a preset data transmission channel, the input event from a kernel space of the host operating system into a kernel space of the guest operating system in the foreground running state, so that the guest operating system in the foreground running state responds to the input event. By means of the implementation, the injection duration for an input event is shortened, thereby improving the performance of an input system in a guest operating system.

Description

基于多操作系统的输入处理方法、装置及电子设备Input processing method, device and electronic device based on multiple operating systems 技术领域Technical field
本申请涉及虚拟化技术领域,特别是涉及基于多操作系统的输入处理方法、装置及电子设备。The present application relates to the field of virtualization technologies, and in particular, to an input processing method, apparatus, and electronic device based on multiple operating systems.
背景技术Background technique
基于虚拟化技术,多个操作系统或者虚拟机可以同时运行在电子设备上,多个操作系统或者虚拟机之间共享硬件设备提供的处理器、内存以及输入输出设备。当基于多个操作系统实现输入的方法时,通常是在宿主操作系统的用户空间中打开输入设备节点,接收输入事件,然后判断该事件是否需要转发至客户操作系统;如果该事件需要转发至客户操作系统,则将该事件注入到客户操作系统内核输入设备模块中;客户操作系统的应用程序通过读取其用户空间中的输入设备节点获取注入的输入事件。Based on the virtualization technology, multiple operating systems or virtual machines can run on the electronic device at the same time, and the processors, memory, and input and output devices provided by the hardware devices are shared among multiple operating systems or virtual machines. When implementing a method based on multiple operating systems, the input device node is typically opened in the user space of the host operating system, receiving input events, and then determining whether the event needs to be forwarded to the guest operating system; if the event needs to be forwarded to the client The operating system injects the event into the guest operating system kernel input device module; the client operating system application obtains the injected input event by reading the input device node in its user space.
发明人发现相关技术存在以下问题:注入给客户操作系统的输入事件经历了从宿主操作系统内核空间上报到用户空间,再由用户空间传递到宿主操作系统内核空间,再注入到客户操作系统内核空间的一个过程,以至于输入事件注入的过程较长,对客户操作系统输入系统的性能造成影响。The inventor found that the related art has the following problem: the input event injected into the guest operating system is reported from the host operating system kernel space to the user space, and then transferred from the user space to the host operating system kernel space, and then injected into the guest operating system kernel space. One process, so that the process of input event injection is long, affects the performance of the guest operating system input system.
发明内容Summary of the invention
本申请实施例提供一种基于多操作系统的输入处理方法、装置及电子设备,主要用于解决基于多操作系统处理输入事件时存在输入事件注入时间长的问题。The embodiment of the present invention provides an input processing method, an apparatus, and an electronic device based on multiple operating systems, which are mainly used to solve the problem that the input event injection time is long when the input event is processed based on multiple operating systems.
为解决上述技术问题,本申请实施例采用的一个技术方案是:提供一种基于多操作系统的输入处理方法,所述操作系统包括宿主操作系统和至少一个客户操作系统,所述方法包括:To solve the above technical problem, a technical solution adopted by the embodiment of the present application is to provide a multi-operating system-based input processing method, where the operating system includes a host operating system and at least one guest operating system, and the method includes:
当监测到所述宿主操作系统接收到输入事件时,判断当前是否存在客户操作系统处于前台运行状态;When it is detected that the host operating system receives an input event, it is determined whether there is currently a guest operating system in a foreground running state;
若存在,通过预设的数据传输通道将所述输入事件从所述宿主操作系统的内核空间注入处于前台运行状态的所述客户操作系统的内核空间,以使所述处于前台运行状态的所述客户操作系统响应所述输入事件。If present, injecting the input event from a kernel space of the host operating system into a kernel space of the guest operating system in a foreground running state through a preset data transmission channel, so as to be in the foreground running state The guest operating system responds to the input event.
为解决上述技术问题,本申请实施例采用的另一个技术方案是:提供一种基于多操作系统的输入处理装置,所述操作系统包括宿主操作系统和至少一个客户操作系统,所述装置包括判断模块和第一处理模块;To solve the above technical problem, another technical solution adopted by the embodiment of the present application is to provide an input processing device based on multiple operating systems, where the operating system includes a host operating system and at least one guest operating system, and the device includes determining Module and first processing module;
所述判断模块,用于当监测到所述宿主操作系统接收到输入事件时,判断当前是否存在客户操作系统处于前台运行状态;The determining module is configured to: when it is detected that the host operating system receives an input event, determine whether the guest operating system is currently in a foreground running state;
所述第一处理模块,用于若当前存在客户操作系统处于前台运行状态,通过预设的数据传输通道将所述输入事件从所述宿主操作系统的内核空间注入处于前台运行状态的所述客户操作系统的内核空间,以使所述处于前台运行状态的所述客户操作系统响应所述输入事件。The first processing module is configured to: when the guest operating system is currently in a foreground running state, inject the input event from the kernel space of the host operating system into the client in a foreground running state through a preset data transmission channel; The kernel space of the operating system to cause the guest operating system in the foreground operating state to respond to the input event.
为解决上述技术问题,本申请实施例采用的又一个技术方案是:提供一种电子设备,包括:至少一个处理器;以及,与所述至少一个处理器通信连接的存储器;其中,所述存储器存储有可被所述至少一个处理器执行的指令程序,所述指令程序被所述至少一个处理器执行,以使所述至少一个处理器执行如上所述的方法。In order to solve the above technical problem, another technical solution adopted by the embodiment of the present application is to provide an electronic device, including: at least one processor; and a memory communicably connected to the at least one processor; wherein the memory An instruction program executable by the at least one processor is stored, the instruction program being executed by the at least one processor to cause the at least one processor to perform the method as described above.
为解决上述技术问题,本申请实施例采用的还一个技术方案是:提供一种非易失性计算机可读存储介质,所述非易失性计算机可读存储介质存储有计算机可执行指令,所述计算机可执行指令用于使计算机执行如上所述的方法。In order to solve the above technical problem, another technical solution adopted by the embodiment of the present application is to provide a non-volatile computer readable storage medium, where the non-volatile computer readable storage medium stores computer-executable instructions. The computer executable instructions are for causing a computer to perform the method as described above.
为解决上述技术问题,本申请实施例采用的再一个技术方案是:提供一种计算机程序产品,所述计算机程序产品包括存储在非易失性计算机可读存储介质上的计算机程序,所述计算机程序包括程序指令,当所述程序指令被计算机执行时,使所述计算机执行如上所述的方法。In order to solve the above technical problem, another technical solution adopted by the embodiment of the present application is to provide a computer program product, the computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer The program includes program instructions that, when executed by a computer, cause the computer to perform the method as described above.
本申请实施例提供了一种基于多操作系统的输入处理方法和装置,通过在监测到宿主操作系统接收到输入事件时,判断当前是否存在客户操作系统处于前台运行状态,如果存在处于前台运行状态的客户操作系统,则通过预设的数据传输通道将输入事件从宿主操作系统注入到处于前台运行状态的客户操作系统的内核空间,从而使该客户操作系统响应所述输入事件。由于输入事件可以直接从宿主操作系统的内核空间注入到客户操作系统的内核空间,从而缩短了输入事件的注入时长,提升了客户操作系统中输入系统的性能。The embodiment of the present application provides an input processing method and apparatus based on multiple operating systems. When the host operating system receives an input event, it determines whether the guest operating system is in the foreground running state, and if it exists in the foreground running state. The guest operating system injects input events from the host operating system into the kernel space of the guest operating system in the foreground running state through a preset data transmission channel, thereby causing the guest operating system to respond to the input event. Since the input event can be directly injected into the kernel space of the guest operating system from the kernel space of the host operating system, the injection time of the input event is shortened, and the performance of the input system in the guest operating system is improved.
附图说明DRAWINGS
一个或多个实施例通过与之对应的附图中的图片进行示例性说明,这些示例性说明并不构成对实施例的限定,附图中具有相同参考数字标号的元件表示为类似的元件,除非有特别申明,附图中的图不构成比例限制。The one or more embodiments are exemplified by the accompanying drawings in the accompanying drawings, and FIG. The figures in the drawings do not constitute a scale limitation unless otherwise stated.
图1是本申请方法和装置的应用场景示意图;1 is a schematic diagram of an application scenario of the method and apparatus of the present application;
图2是本申请实施例提供的一种基于多操作系统的输入处理方法的流程示意图;2 is a schematic flowchart of an input processing method based on multiple operating systems according to an embodiment of the present application;
图3是本申请实施例提供的一种基于多操作系统的输入处理方法中判断当前是否存在客户操作系统处于前台运行状态的方法的流程示意图;3 is a schematic flowchart of a method for determining whether a guest operating system is in a foreground running state in a multi-operating system based input processing method according to an embodiment of the present application;
图4是本申请实施例提供的一种基于多操作系统的输入处理方法中宿主操作系统内核空间中的内核加速器的功能结构示意图;4 is a schematic diagram showing the functional structure of a kernel accelerator in a host operating system kernel space in an input processing method based on multiple operating systems according to an embodiment of the present application;
图5是本申请另一实施例提供的一种基于多操作系统的输入处理方法的流程示意图;FIG. 5 is a schematic flowchart of a multi-operating system based input processing method according to another embodiment of the present application; FIG.
图6是本申请又一实施例提供的一种基于多操作系统的输入处理方法的流程示意图;6 is a schematic flowchart of a multi-operating system-based input processing method according to another embodiment of the present application;
图7是本申请实施例提供的一种基于多操作系统的输入处理方法中所述客户操作系统的后端程序的功能结构示意图;7 is a schematic diagram showing the functional structure of a backend program of the guest operating system in an input processing method based on multiple operating systems according to an embodiment of the present application;
图8是本申请再一实施例提供的一种基于多操作系统的输入处理方法的流程示意图;FIG. 8 is a schematic flowchart of a multi-operating system-based input processing method according to still another embodiment of the present application; FIG.
图9是本申请实施例提供的一种基于多操作系统的输入处理装置的结构示意图;FIG. 9 is a schematic structural diagram of an input processing apparatus based on multiple operating systems according to an embodiment of the present application; FIG.
图10是本申请实施例提供的一种电子设备的硬件结构示意图。FIG. 10 is a schematic structural diagram of hardware of an electronic device according to an embodiment of the present application.
具体实施方式Detailed ways
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。In order to make the objects, technical solutions, and advantages of the present application more comprehensible, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It is understood that the specific embodiments described herein are merely illustrative of the application and are not intended to be limiting.
需要说明的是,如果不冲突,本申请实施例中的各个特征可以相互结合,均在本申请的保护范围之内。另外,虽然在装置示意图中进行了功能模块划分,在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于装置示意图中的模块划分,或流程图中的顺序执行所示出或描述的步骤。It should be noted that, if there is no conflict, the various features in the embodiments of the present application may be combined with each other, and are all within the protection scope of the present application. In addition, although the functional module division is performed in the device schematic, the logical sequence is shown in the flowchart, but in some cases, it may be performed in a different manner from the module in the device schematic, or in the order in the flowchart. The steps that are described or described.
图1是本申请实施例提供的基于多操作系统的输入处理方法和装置的应用场景示意图。该应用场景可以是运行在某一智能终端上的计算机系统环境。具体地,如图1所示,该应用场景包括:宿主操作系统10、客户操作系统11、模拟器12以及物理硬件设备13。FIG. 1 is a schematic diagram of an application scenario of an input processing method and apparatus based on multiple operating systems according to an embodiment of the present application. The application scenario may be a computer system environment running on a smart terminal. Specifically, as shown in FIG. 1 , the application scenario includes: a host operating system 10 , a guest operating system 11 , an emulator 12 , and a physical hardware device 13 .
其中,宿主操作系统10和客户操作系统11均属于管理和控制物理硬件设备13以及相应的软件资源的计算机程序,是直接运行在“裸机”上的最基本的系统软件,任何其他软件都必须在宿主操作系统10或客户操作系统11的支持下才能运行。在本申请实施例中,宿主操作系统10和客户操作系统11均可以是任何合适类型的操作系统,如:Linux、Unix、IOS、Android、Windows等,用以接收用户指令并据此输出对应的处理结果向用户展示。The host operating system 10 and the guest operating system 11 belong to a computer program for managing and controlling the physical hardware device 13 and corresponding software resources, and are the most basic system software directly running on the "bare metal machine", and any other software must be in It can be run with the support of the host operating system 10 or the guest operating system 11. In the embodiment of the present application, the host operating system 10 and the guest operating system 11 may be any suitable type of operating system, such as: Linux, Unix, IOS, Android, Windows, etc., for receiving user instructions and outputting corresponding data accordingly. The processing results are shown to the user.
宿主操作系统10以及客户操作系统11之间共享所述物理硬件设备13。在实际运行时,宿主操作系统10可以直接使用所述物理硬件设备13中的硬件设备,而客户操作系统11则使用由驱动该客户操作系统11的虚拟机提供的虚拟设备。其中,所述“虚拟机”是指通过软件模拟的具有完整硬件系统功能的,运行在一个完全隔离环境中的计算机系统。所述虚拟机可以基于物理硬件设备13或者软件程序形成多个模拟出来的硬件设备(比如,本申请实施例所述的虚拟输入设备)供客户操作系统11使用。一个虚拟机对应驱动一个客户操作系统11,每一所述虚拟机可以作为宿主操作系统10中的其中一个应用程序运行。The physical hardware device 13 is shared between the host operating system 10 and the guest operating system 11. In actual operation, the host operating system 10 can directly use the hardware devices in the physical hardware device 13, and the guest operating system 11 uses the virtual devices provided by the virtual machines that drive the guest operating system 11. The “virtual machine” refers to a computer system that is simulated by software and has a complete hardware system function and runs in a completely isolated environment. The virtual machine may form a plurality of simulated hardware devices (such as the virtual input device described in the embodiment of the present application) for use by the guest operating system 11 based on the physical hardware device 13 or a software program. A virtual machine corresponds to a guest operating system 11, and each of the virtual machines can be run as one of the applications in the host operating system 10.
不同的操作系统之间存在有内存隔离,即便是宿主操作系统10也不能够访问客户操作系统11的内存空间。这样,当计算机系统中存在两个或以上的客户操作系统11时,若其中一个客户操作系统11因为异常重新启动,宿主操作系统10和其它客户操作系统11还可以正常运行,相互隔离。然而,由于虚拟机是作为宿主操作系统10中的应用程序运行的,因此,若宿主操作系统10因为异常重新启动,那么所有的客户操作系统11都需要重新启动才可以运行。There is memory isolation between different operating systems, and even the host operating system 10 cannot access the memory space of the guest operating system 11. Thus, when there are two or more guest operating systems 11 in the computer system, if one of the guest operating systems 11 restarts due to an abnormality, the host operating system 10 and other guest operating systems 11 can also operate normally and be isolated from each other. However, since the virtual machine is running as an application in the host operating system 10, if the host operating system 10 restarts due to an abnormality, all of the guest operating systems 11 need to be restarted before they can run.
模拟器12也可以作为宿主操作系统10中的其中一个应用程序运行。在本实施例中,模拟器12与所述客户操作系统11对应,当包含多个客户操作系统11时,每一个客户操作系统11分别对应一个模拟器12。在本实施例中,模拟器12用于运行虚拟输入设备的后端程序,所述虚拟输入设备的后端程序即是所述客户操作系统11的后端程序。The simulator 12 can also be run as one of the applications in the host operating system 10. In the present embodiment, the simulator 12 corresponds to the guest operating system 11, and when a plurality of guest operating systems 11 are included, each guest operating system 11 corresponds to one simulator 12, respectively. In the present embodiment, the simulator 12 is used to run a backend program of the virtual input device, and the backend program of the virtual input device is the backend program of the guest operating system 11.
物理硬件设备13是实际存在的硬件设备,可以包括任何合适的,组成完整计算机系统的设备组件,包括但不限于:处理器、存储介质、输入/输出设备以及通信模组等。具体地,处理器可以是任何合适类型的,具有一定逻辑运算能力的处理器,例如:CPU、图形处理器等。处理器还可以包括用于多线程或并行处理的多个核心。存储介质可以包括内存模块,例如:ROM、RAM、闪存模块,以及大容量存储器,例如光盘和硬盘。存储介质中存储有计算机程序,当处理器执行这些计算机程序时,可以实现各种相应方法步骤或流程。输入/输出设备可以是任何合适类型的,提供一种或者多种用户交互方式的外围设备,例如接收用户动作操作指令的鼠标、键盘或者触摸输入屏,用于采集图像信息的体感摄像机、用于采集声音信息的麦克风或者向用户展示图像信息的显示屏或者用于输出音频的扬声器。所述输入/输出设备可以选择使用有线或者无线的外围设备与其他物理硬件设备连接。通信模组可以包括某些通过有线或者无线通信网络建立连接的网络接口设备。例如,网线接口、总线接口、USB接口、WiFi模组或者蓝牙通信模组等。The physical hardware device 13 is a physically existing hardware device and may include any suitable device component that constitutes a complete computer system, including but not limited to: a processor, a storage medium, an input/output device, a communication module, and the like. Specifically, the processor may be any suitable type of processor having a certain logic operation capability, such as a CPU, a graphics processor, or the like. The processor may also include multiple cores for multi-threading or parallel processing. The storage medium may include a memory module such as a ROM, a RAM, a flash memory module, and a mass storage such as an optical disk and a hard disk. Computer programs are stored in the storage medium, and when the processor executes the computer programs, various corresponding method steps or processes can be implemented. The input/output device may be any suitable type of peripheral device that provides one or more modes of user interaction, such as a mouse, keyboard or touch input screen that receives user action instructions, a somatosensory camera for acquiring image information, A microphone that collects sound information or a display that presents image information to a user or a speaker that outputs audio. The input/output device can optionally connect to other physical hardware devices using wired or wireless peripherals. The communication module can include some network interface devices that establish connections through a wired or wireless communication network. For example, a network cable interface, a bus interface, a USB interface, a WiFi module, or a Bluetooth communication module.
在实际应用过程中,所述物理硬件设备13还可以添加或者减少一个或者多个设备,用以满足不同的实际应用情况需求,例如增加数据库或者服务器设备等。In the actual application process, the physical hardware device 13 may also add or reduce one or more devices to meet different practical application requirements, such as adding a database or a server device.
在本申请实施例中,基于上述宿主操作系统10、客户操作系统11、模拟器12以及物理硬件设备13实现多操作系统的输入实现方法。具体地,宿主操作系统10监测自身是否接收到输入事件,如果接收到输入事件,判断当前是否存在处于前台运行状态的客户操作系统11,如果存在,宿主操作系统10将所述输入事件注入模拟器12中,由所述模拟器12中虚拟输入设备的后端程序,将所述输入事件写入所述客户操作系统11的内核空间。需要说明的是,在输入事件注入模拟器12后,所述客户操作系统11也可以主动读取所述模拟器12中的输入事件。In the embodiment of the present application, an input implementation method of multiple operating systems is implemented based on the host operating system 10, the guest operating system 11, the simulator 12, and the physical hardware device 13. Specifically, the host operating system 10 monitors whether it receives an input event, and if an input event is received, determines whether there is currently a guest operating system 11 in a foreground running state, and if so, the host operating system 10 injects the input event into the simulator. In 12, the input event is written into the kernel space of the guest operating system 11 by a backend program of the virtual input device in the simulator 12. It should be noted that after inputting the event injection simulator 12, the guest operating system 11 can also actively read the input events in the simulator 12.
此外,可以理解的是,当该智能终端的计算机系统中所有的客户操作系统11均处于休眠状态时,所述宿主操作系统10响应所述输入事件。Moreover, it can be understood that the host operating system 10 responds to the input event when all of the guest operating systems 11 in the computer system of the smart terminal are in a sleep state.
再者,需要说明的是,本申请实施例提供的基于多操作系统的输入处理方法还可以进一步的拓展到其他合适的应用环境中,而不限于图1中所示的应用环境。在实际应用过程中,该应用环境还可以包括更多的客户操作系统以及更多或者更少物理硬件设备类型。In addition, it should be noted that the multi-operating system-based input processing method provided by the embodiment of the present application can be further extended to other suitable application environments, and is not limited to the application environment shown in FIG. 1 . In the actual application process, the application environment may also include more guest operating systems and more or less physical hardware device types.
基于上述应用场景,提供一种基于多操作系统的输入处理方法,具体地,图2是本申请实施例提供的一种基于多操作系统的输入处理方法的流程示意图,请参阅图2,该方法包括:Based on the foregoing application scenario, a multi-operating system-based input processing method is provided. Specifically, FIG. 2 is a schematic flowchart of a multi-operating system-based input processing method according to an embodiment of the present application. Referring to FIG. 2, the method is include:
201:当监测到所述宿主操作系统接收到输入事件时,判断当前是否存在客户操作系统处于前台运行状态;201: When it is detected that the host operating system receives an input event, determining whether the guest operating system is currently in a foreground running state;
其中,所述宿主操作系统通过预设的程序监测自身是否接收到输入事件,所述输入事件指的是在操作人员操作键盘、鼠标等输入/输出设备时,所产生的操作指令,一条操作指令可以对应一个输入事件,这些操作指令可以是打开某个页面或者输入某个字母或者删除某个符号,等等。在监测到所述宿主操作系统接收到输入事件后,判断当前是否存在客户操作系统处于前台运行状态,具体地,请参阅图3,所述判断当前是否存在客户操作系统处于前台运行状态,包括:The host operating system monitors whether it receives an input event through a preset program, and the input event refers to an operation instruction generated when an operator operates an input/output device such as a keyboard or a mouse, and an operation instruction It can correspond to an input event, which can be to open a page or enter a letter or delete a symbol, and so on. After the host operating system receives the input event, it is determined whether the guest operating system is in the foreground running state. Specifically, refer to FIG. 3, where it is determined whether the guest operating system is in the foreground running state, including:
2011:从所述至少一个客户操作系统对应的虚拟切换设备中,读取所述至少一个客户操作系统的前/后台运行状态;2011: Read, from the virtual switching device corresponding to the at least one guest operating system, a front/back running state of the at least one guest operating system;
2012:根据获取到的所述至少一个客户操作系统的前/后台运行状态,判断当前是否存在客户操作系统处于前台运行状态。2012: Determine, according to the obtained front/back running state of the at least one guest operating system, whether the guest operating system is currently in the foreground running state.
在本实施例中,所述宿主操作系统与虚拟机中的虚拟切换设备通信,获得其支持的客户操作系统的前/后台运行状态,并将所述客户操作系统的前/后台运行状态设置给所述宿主操作系统内核空间中的虚拟输入设备的内核加速器,从而使所述宿主操作系统获取处于前台运行状态的客户操作系统。In this embodiment, the host operating system communicates with the virtual switching device in the virtual machine, obtains the front/back running state of the guest operating system supported by the host operating system, and sets the front/back running state of the guest operating system to The kernel accelerator of the virtual input device in the host operating system kernel space, thereby causing the host operating system to acquire a guest operating system in a foreground running state.
其中,所述宿主操作系统与虚拟机中的虚拟切换设备通信是通过所述客户操作系统的后端程序实现的,也即是虚拟输入设备的后端程序。The communication between the host operating system and the virtual switching device in the virtual machine is implemented by a backend program of the guest operating system, that is, a backend program of the virtual input device.
其中,所述虚拟切换设备主要用于控制虚拟机的前/后台运行状态。比如,所述虚拟切换设备接收包含源虚拟机信息的切换请求,根据所述切换请求中的源虚拟机信息判断所述切换请求是否合法,如果合法,则将所述切换请求对应的虚拟机由后台运行状态切换至前台运行状态。此外,所述虚拟切换设备还可以将处于休眠状态的虚拟机切换至前台运行状态。在这里,切换虚拟机也即是切换客户机,因此,所述虚拟切换设备能够获取其支持的全部客户操作系统的前/后台运行状态。其中,虚拟机的后台运行状态指的是虚拟机正在运行,但是其人机交互的相关服务程序被关闭了,因此其人机交互界面对用户不可见,即后台运行状态的虚拟机可以调用网络通信等模块,但是已经不能调用涉及用户交互的输入输出模块,比如键盘或者显示屏。虚拟机的前台运行状态即与所述后台运行状态相反的状态。需要说明的是,所述虚拟切换设备获取其支持的客户操作系统的前/后台运行状态的具体过程还可以参考相关技术中的记载,并不仅限制于上述实施方式。The virtual switching device is mainly used to control a front/back running state of the virtual machine. For example, the virtual switching device receives a handover request including the source virtual machine information, and determines whether the handover request is legal according to the source virtual machine information in the handover request, and if it is legal, the virtual machine corresponding to the handover request is The background running state is switched to the foreground running state. In addition, the virtual switching device can also switch the virtual machine in the sleep state to the foreground running state. Here, the switching virtual machine is also a switching client, and therefore, the virtual switching device can acquire the front/back running state of all the guest operating systems it supports. The background running state of the virtual machine refers to the virtual machine running, but the related service program of the human-computer interaction is closed, so the human-computer interaction interface is invisible to the user, that is, the virtual machine in the background running state can invoke the network. Modules such as communications, but can't call input and output modules that involve user interaction, such as keyboards or displays. The foreground running state of the virtual machine is the state opposite to the background running state. It should be noted that the specific process of the virtual switching device acquiring the front/back running state of the guest operating system supported by the virtual switching device may also refer to the description in the related art, and is not limited to the foregoing embodiment.
202:若存在,通过预设的数据传输通道将所述输入事件从所述宿主操作系统的内核空间注入处于前台运行状态的所述客户操作系统的内核空间,以使所述处于前台运行状态的所述客户操作系统响应所述输入事件。202: if present, injecting, by using a preset data transmission channel, the input event from a kernel space of the host operating system into a kernel space of the guest operating system in a foreground running state, so that the The guest operating system is responsive to the input event.
其中,所述预设的数据传输通道配置在宿主操作系统和处于前台运行状态的客户操作系统之间,具体是模拟器中运行的客户操作系统的后端程序(即虚拟输入设备的后端程序)来建立的。所述客户操作系统的后端程序将所述数据传输通道的信息传递给宿主操作系统内核空间中的虚拟输入设备的内核加速器,通过运行于所述宿主操作系统内核空间中的内核加速器,将所述输入事件从所述宿主操作系统的内核空间注入运行于前台运行状态的所述客户操作系统的后端程序,再由所述后端程序将所述输入事件写入所述客户操作系统的内核空间,从而使所述客户操作系统响应所述输入事件。该实施方式,当客户操作系统在前台运行时,宿主操作系统决定注入给客户操作系统的输入事件经虚拟输入设备的后端程序,由宿主操作系统内核中的加速器直接注入给客户操作系统,从而缩短了输入事件注入所述客户操作系统的事件,使得客户操作系统能够尽快响应所述输入事件,提升了客户操作系统的性能。The preset data transmission channel is configured between the host operating system and the guest operating system in the foreground running state, specifically the backend program of the guest operating system running in the simulator (ie, the backend program of the virtual input device) ) to build. The backend program of the guest operating system transfers information of the data transmission channel to a kernel accelerator of a virtual input device in a host operating system kernel space, by using a kernel accelerator running in a kernel space of the host operating system The input event injects a backend program of the guest operating system running in a foreground running state from a kernel space of the host operating system, and the backend program writes the input event to a kernel of the guest operating system Space, thereby causing the guest operating system to respond to the input event. In this implementation manner, when the guest operating system is running in the foreground, the host operating system determines that the input event injected into the guest operating system is directly injected into the guest operating system by the accelerator in the host operating system kernel through the backend program of the virtual input device, thereby The event of input event injection into the guest operating system is shortened, so that the guest operating system can respond to the input event as soon as possible, thereby improving the performance of the guest operating system.
其中,所述宿主操作系统内核空间中的内核加速器可以实现两项功能:The kernel accelerator in the host operating system kernel space can implement two functions:
功能一,在接收到客户操作系统的后端程序设置的系统间传递数据的通道信息之后,当宿主操作系统内核空间中的输入子系统有新的输入事件时,如果该输入事件需要传递给客户操作系统,则通过数据传输通道将该事件注入给客户操作系统;Function 1, after receiving the channel information of the data between the systems set by the backend program of the guest operating system, when the input subsystem in the host operating system kernel space has a new input event, if the input event needs to be delivered to the client The operating system injects the event into the guest operating system through the data transmission channel;
功能二,当客户操作系统由后台转为前台运行状态时,使能系统间的数据传递通道,内核加速器进入活跃状态;当客户操作系统由前台运行状态转为后台时,不使能系统间的数据传递通道,内核加速器进入休眠状态。客户操作系统默认是在后台的,因此数据传输通道默认是关闭的。其功能结构如附图4所示。Function 2: When the guest operating system changes from the background to the foreground running state, the data transfer channel between the systems is enabled, and the kernel accelerator enters an active state; when the guest operating system is changed from the foreground running state to the background, the inter-system is not enabled. The data transfer channel, the kernel accelerator enters a sleep state. The guest operating system is in the background by default, so the data transfer channel is turned off by default. Its functional structure is shown in Figure 4.
需要说明的是,上述过程中,所述后端程序将所述输入事件写入所述客户操作系统的内核空间,在其他一些实施例中,也可以是所述客户操作系统主动从所述后端程序中读取所述输入事件至内核空间。It should be noted that, in the foregoing process, the backend program writes the input event to the kernel space of the guest operating system, and in other embodiments, the guest operating system may actively take the The input event is read into the kernel space in the end program.
此外,当存在多个客户操作系统时,可以在每一个客户操作系统与宿主操作系统之间建立所述预设的数据传输通道。并且将处于前台运行状态的客户操作系统对应的数据传输通道调整为使能状态,将处于后台运行状态或者后台休眠状态的客户操作系统对应的数据传输通道调整为关闭状态。其中,在两个客户操作系统之间进行切换时,被切换到后台的客户操作系统其所对应的虚拟输入设备进入休眠状态,切换到前台的客户操作系统其所对应的虚拟输入设备进入活跃状态。In addition, when there are multiple guest operating systems, the preset data transmission channel can be established between each guest operating system and the host operating system. And adjusting the data transmission channel corresponding to the guest operating system in the foreground running state to the enabled state, and adjusting the data transmission channel corresponding to the guest operating system in the background running state or the background sleeping state to the closed state. Wherein, when switching between two guest operating systems, the virtual input device corresponding to the guest operating system switched to the background enters a sleep state, and the virtual input device corresponding to the guest operating system switched to the foreground enters an active state. .
在其他一些实施例中,请参阅图5,所述方法还包括:In other embodiments, referring to FIG. 5, the method further includes:
203:当所述输入事件从所述宿主操作系统的内核空间注入处于前台运行状态的所述客户操作系统的内核空间之后,将所述输入事件从所述宿主操作系统的事件列表中清除。其中,可以通过预设的程序将所述输入事件从所述事件列表中清除。通过删除事件列表中的输入事件可以不需要将输入设备在虚拟机程序操作时设置为独占,就能避免用户空间中其他应用程序读取所述输入事件,从而降低了所述输入事件被泄露的风险。203: After the input event is injected from a kernel space of the host operating system into a kernel space of the guest operating system in a foreground running state, the input event is cleared from an event list of the host operating system. The input event can be cleared from the event list by a preset program. By deleting the input event in the event list, it is not necessary to set the input device to be exclusive when the virtual machine program is operated, so that other applications in the user space can be prevented from reading the input event, thereby reducing the leakage of the input event. risk.
在其他一些实施例中,请参阅图6,在执行图2所示的方法之前,所述方法还包括:In some other embodiments, referring to FIG. 6, before performing the method shown in FIG. 2, the method further includes:
204:读取输入设备在所述宿主操作系统中的设备文件;204: Read a device file of the input device in the host operating system;
205:根据所述设备文件获取所述输入设备的配置信息;205: Obtain configuration information of the input device according to the device file.
206:将所述配置信息发送至所述客户操作系统的内核空间,以使所述客户操作系统中与所述输入设备对应的虚拟输入设备的驱动程序,根据所述配置信息配置所述虚拟输入设备。206: Send the configuration information to a kernel space of the guest operating system, so that a driver of the virtual input device corresponding to the input device in the guest operating system configures the virtual input according to the configuration information device.
上述步骤是在将输入事件注入客户操作系统之前,就预先配置好客户操作系统对应的虚拟输入设备。其中,所述输入设备是宿主操作系统对应的物理输入设备,比如键盘、鼠标等。在宿主操作系统中,每一输入设备都有其对应的设备文件,该设备文件包含了所述输入设备的属性等配置信息,将这些配置信息传递至客户操作系统的内核空间,从而使客户操作系统中的虚拟输入设备的驱动程序根据所述配置信息在客户操作系统中注册相应的虚拟输入设备,并且设置这些虚拟输入设备的配置信息。通过这种配置,可以使宿主操作系统和客户操作系统共享相同的输入设备。The above steps are pre-configured with the virtual input device corresponding to the guest operating system before the input event is injected into the guest operating system. The input device is a physical input device corresponding to a host operating system, such as a keyboard, a mouse, or the like. In the host operating system, each input device has its corresponding device file, and the device file contains configuration information such as attributes of the input device, and the configuration information is transmitted to the kernel space of the guest operating system, thereby enabling the customer to operate. A driver of the virtual input device in the system registers corresponding virtual input devices in the guest operating system according to the configuration information, and sets configuration information of the virtual input devices. With this configuration, the host operating system and the guest operating system can share the same input device.
其中,配置所述虚拟输入设备也是由所述客户操作系统的后端程序,即模拟器中虚拟输入设备的后端程序来实现。基于上述实施例,请参阅图7,所述客户操作系统的后端程序主要实现三项功能:功能一,配置在宿主操作系统和客户操作系统之间传递数据的通道,并将这些通道的信息传递给在宿主操作系统内核空间中的虚拟输入设备的内核加速器;功能二,通过输入设备在宿主操作系统中的设备节点获得输入设备的属性等配置信息,将这些配置信息传递到客户操作系统的内核空间,客户操作系统中的虚拟输入设备的驱动程序根据这些配置信息在客户操作系统中注册相应的输入设备,并设置相应的配置信息;功能三,与虚拟机中的虚拟切换设备通信,获得其支持的客户操作系统的前后台状态,并将当前的前后台状态设置给在宿主操作系统内核空间中的虚拟输入设备的内核加速器。Wherein, configuring the virtual input device is also implemented by a backend program of the guest operating system, that is, a backend program of the virtual input device in the simulator. Based on the foregoing embodiment, referring to FIG. 7, the backend program of the guest operating system mainly implements three functions: function one, configuring a channel for transferring data between the host operating system and the guest operating system, and information of the channels. a kernel accelerator passed to the virtual input device in the host operating system kernel space; function 2, obtaining configuration information such as attributes of the input device through the input device in the device node in the host operating system, and transmitting the configuration information to the guest operating system Kernel space, the driver of the virtual input device in the guest operating system registers the corresponding input device in the guest operating system according to the configuration information, and sets corresponding configuration information; function three, communicates with the virtual switching device in the virtual machine, obtains It supports the front-end state of the guest operating system and sets the current front-end state to the kernel accelerator of the virtual input device in the host operating system kernel space.
在其他一些实施例中,请参阅图8,所述方法还包括:In other embodiments, referring to FIG. 8, the method further includes:
207:若当前不存在客户操作系统处于前台运行状态,所述宿主操作系统响应所述输入事件。207: The host operating system responds to the input event if the guest operating system does not currently exist in the foreground running state.
本申请实施例提供了一种基于多操作系统的输入处理方法,该方法通过在监测到宿主操作系统接收到输入事件时,判断当前是否存在客户操作系统处于前台运行状态,如果存在处于前台运行状态的客户操作系统,则通过预设的数据传输通道将输入事件从宿主操作系统注入到处于前台运行状态的客户操作系统的内核空间,从而使该客户操作系统响应所述输入事件。由于输入事件可以直接从宿主操作系统的内核空间注入到客户操作系统的内核空间,从而缩短了输入事件的注入时长,提升了客户操作系统中输入系统的性能。另外,将注入客户操作系统后的输入事件从事件列表中清除,从而降低了所述输入事件被泄露的风险。The embodiment of the present application provides an input processing method based on multiple operating systems. When the host operating system receives an input event, it determines whether the guest operating system is in the foreground running state, and if it exists in the foreground running state. The guest operating system injects input events from the host operating system into the kernel space of the guest operating system in the foreground running state through a preset data transmission channel, thereby causing the guest operating system to respond to the input event. Since the input event can be directly injected into the kernel space of the guest operating system from the kernel space of the host operating system, the injection time of the input event is shortened, and the performance of the input system in the guest operating system is improved. In addition, input events injected into the guest operating system are cleared from the event list, thereby reducing the risk of the input event being compromised.
请参阅图9,图9是本申请实施例提供的一种基于多操作系统的输入处理装置的结构示意图,所述操作系统包括宿主操作系统和至少一个客户操作系统,如图9所示,该装置30包括:判断模块31和第一处理模块32。Please refer to FIG. 9. FIG. 9 is a schematic structural diagram of an input processing apparatus based on multiple operating systems according to an embodiment of the present disclosure. The operating system includes a host operating system and at least one guest operating system, as shown in FIG. The device 30 includes a judging module 31 and a first processing module 32.
其中,所述判断模块31,用于当监测到所述宿主操作系统接收到输入事件时,判断当前是否存在客户操作系统处于前台运行状态;所述第一处理模块32,用于若当前存在客户操作系统处于前台运行状态,通过预设的数据传输通道将所述输入事件从所述宿主操作系统的内核空间注入处于前台运行状态的所述客户操作系统的内核空间,以使所述处于前台运行状态的所述客户操作系统响应所述输入事件。The determining module 31 is configured to: when it is detected that the host operating system receives an input event, determine whether the guest operating system is currently in a foreground running state; the first processing module 32 is configured to: if the client currently exists The operating system is in a foreground running state, and the input event is injected from a kernel space of the host operating system into a kernel space of the guest operating system in a foreground running state through a preset data transmission channel, so that the operation is in the foreground The guest operating system of the state responds to the input event.
其中,所述判断模块31包括数据读取单元311和状态判断单元312。所述数据读取单元311,用于从所述至少一个客户操作系统对应的虚拟切换设备中,读取所述至少一个客户操作系统的前/后台运行状态;所述状态判断单元312,用于根据获取到的所述至少一个客户操作系统的前/后台运行状态,判断当前是否存在客户操作系统处于前台运行状态。The determining module 31 includes a data reading unit 311 and a state determining unit 312. The data reading unit 311 is configured to read a front/back running state of the at least one guest operating system from a virtual switching device corresponding to the at least one guest operating system; the state determining unit 312 is configured to: And determining, according to the obtained front/back running state of the at least one guest operating system, whether the guest operating system is currently in the foreground running state.
其中,所述第一处理模块32具体用于:若当前存在客户操作系统处于前台运行状态,通过运行于所述宿主操作系统内核空间中的内核加速器,将所述输入事件从所述宿主操作系统的内核空间注入运行于前台运行状态的所述客户操作系统的后端程序,由所述后端程序将所述输入事件写入所述客户操作系统的内核空间,以使所述前台运行状态的所述客户操作系统响应所述输入事件。The first processing module 32 is specifically configured to: if the guest operating system is currently in the foreground running state, use the kernel accelerator running in the host operating system kernel space to input the input event from the host operating system. The kernel space injects a backend program of the guest operating system running in a foreground running state, and the backend program writes the input event into a kernel space of the guest operating system to make the foreground running state The guest operating system is responsive to the input event.
在其他一些实施例中,同样请参阅图9,所述装置30还包括删除模块33。所述删除模块33,用于当所述输入事件从所述宿主操作系统的内核空间注入处于前台运行状态的所述客户操作系统的内核空间之后,将所述输入事件从所述宿主操作系统的事件列表中清除。In other embodiments, referring also to FIG. 9, the apparatus 30 further includes a deletion module 33. The deleting module 33 is configured to: when the input event is injected from a kernel space of the host operating system into a kernel space of the guest operating system in a foreground running state, the input event is from the host operating system Cleared in the event list.
在其他一些实施例中,同样请参阅图9,所述装置30还包括第一获取模块34、第二获取模块35以及发送模块36。所述第一获取模块34,用于读取输入设备在所述宿主操作系统中的设备文件;所述第二获取模块35,用于根据所述设备文件获取所述输入设备的配置信息;所述发送模块36,用于将所述配置信息发送至所述客户操作系统的内核空间,以使所述客户操作系统中与所述输入设备对应的虚拟输入设备的驱动程序,根据所述配置信息配置所述虚拟输入设备。In other embodiments, referring also to FIG. 9 , the apparatus 30 further includes a first obtaining module 34 , a second acquiring module 35 , and a sending module 36 . The first obtaining module 34 is configured to read a device file of the input device in the host operating system, and the second acquiring module 35 is configured to acquire configuration information of the input device according to the device file; The sending module 36 is configured to send the configuration information to a kernel space of the guest operating system, so that a driver of the virtual input device corresponding to the input device in the guest operating system is configured according to the configuration information. The virtual input device is configured.
在其他一些实施例中,同样请参阅图9,所述装置30还包括第二处理模块37。所述第二处理模块37,用于若当前不存在客户操作系统处于前台运行状态,所述宿主操作系统响应所述输入事件。In other embodiments, referring also to FIG. 9, the apparatus 30 further includes a second processing module 37. The second processing module 37 is configured to respond to the input event if the guest operating system is not in the foreground running state.
需要说明的是,由于所述基于多操作系统的输入处理装置与上述方法实施例中的基于多操作系统的输入处理方法基于相同的发明构思,因此,上述方法实施例的相应内容以及有益效果同样适用于本装置实施例,此处不再详述。It should be noted that, since the multi-operating system-based input processing device and the multi-operating system-based input processing method in the foregoing method embodiments are based on the same inventive concept, the corresponding content and beneficial effects of the foregoing method embodiments are also the same. Applicable to the embodiment of the device, and will not be described in detail herein.
本申请实施例提供了一种基于多操作系统的输入处理装置,该装置通过在监测到宿主操作系统接收到输入事件时,判断当前是否存在客户操作系统处于前台运行状态,如果存在处于前台运行状态的客户操作系统,则通过预设的数据传输通道将输入事件从宿主操作系统注入到处于前台运行状态的客户操作系统的内核空间,从而使该客户操作系统响应所述输入事件。由于输入事件可以直接从宿主操作系统的内核空间注入到客户操作系统的内核空间,从而缩短了输入事件的注入时长,提升了客户操作系统中输入系统的性能。另外,将注入客户操作系统后的输入事件从事件列表中清除,从而降低了所述输入事件被泄露的风险。The embodiment of the present application provides an input processing device based on multiple operating systems. When the host operating system receives an input event, it determines whether the guest operating system is in the foreground running state, and if it exists in the foreground running state. The guest operating system injects input events from the host operating system into the kernel space of the guest operating system in the foreground running state through a preset data transmission channel, thereby causing the guest operating system to respond to the input event. Since the input event can be directly injected into the kernel space of the guest operating system from the kernel space of the host operating system, the injection time of the input event is shortened, and the performance of the input system in the guest operating system is improved. In addition, input events injected into the guest operating system are cleared from the event list, thereby reducing the risk of the input event being compromised.
请参阅图10,图10是本申请实施例提供的一种电子设备的硬件结构示意图。该电子设备40可以是任意类型的智能终端,如:手机、平板电脑、笔记本电脑、台式计算机、服务器、机器人等,能够执行如上所述的基于多操作系统的输入处理方法。如图10所示,该电子设备40包括:Please refer to FIG. 10. FIG. 10 is a schematic structural diagram of hardware of an electronic device according to an embodiment of the present application. The electronic device 40 can be any type of smart terminal, such as a mobile phone, tablet, laptop, desktop computer, server, robot, etc., capable of performing a multi-operating system based input processing method as described above. As shown in FIG. 10, the electronic device 40 includes:
一个或多个处理器41以及存储器42,图10中以一个处理器41为例。One or more processors 41 and a memory 42 are exemplified by a processor 41 in FIG.
处理器41和存储器42可以通过总线或者其他方式连接,图10中以通过总线连接为例。The processor 41 and the memory 42 can be connected by a bus or other means, as exemplified by a bus connection in FIG.
执行基于多操作系统的输入处理方法的电子设备还可以包括:输入装置43和输出装置44。The electronic device that performs the multi-operating system based input processing method may further include: an input device 43 and an output device 44.
存储器42作为一种非易失性计算机可读存储介质,可用于存储非易失性软件程序、非易失性计算机可执行程序以及模块,如本申请实施例中的基于多操作系统的输入处理方法对应的程序指令/模块(例如,附图9中所示的各个模块)。处理器41通过运行存储在存储器42中的非易失性软件程序、指令以及模块,从而执行服务器的各种功能应用以及数据处理,即实现上述方法实施例基于多操作系统的输入处理方法。The memory 42 is a non-volatile computer readable storage medium for storing non-volatile software programs, non-volatile computer-executable programs, and modules, such as multi-operating system-based input processing in the embodiments of the present application. The corresponding program instructions/modules (e.g., the various modules shown in Figure 9). The processor 41 executes various functional applications and data processing of the server by executing non-volatile software programs, instructions, and modules stored in the memory 42, that is, implementing the input processing method based on multiple operating systems of the above method embodiments.
存储器42可以包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需要的应用程序;存储数据区可存储根据基于多操作系统的输入处理装置的使用所创建的数据等。此外,存储器42可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他非易失性固态存储器件。在一些实施例中,存储器42可选包括相对于处理器41远程设置的存储器,这些远程存储器可以通过网络连接至基于多操作系统的输入处理装置。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。The memory 42 may include a storage program area and an storage data area, wherein the storage program area may store an operating system, an application required for at least one function; the storage data area may be stored according to use of the multi-operating system based input processing device Data, etc. Moreover, memory 42 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some embodiments, memory 42 may optionally include memory remotely located relative to processor 41, which may be connected to a multi-operating system based input processing device over a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
输入装置43可接收输入的数字或字符信息,以及产生与基于多操作系统的输入处理装置的用户设置以及功能控制有关的键信号输入。输出装置44可包括显示屏等显示设备。The input device 43 can receive input numeric or character information and generate key signal inputs related to user settings and function control of the multi-operating system based input processing device. Output device 44 may include a display device such as a display screen.
所述一个或者多个模块存储在所述存储器42中,当被所述一个或者多个处理器41执行时,执行上述任意方法实施例中的基于多操作系统的输入处理方法,例如,执行以上描述的图2中的方法步骤201至步骤202,图3中的方法步骤2011至步骤2012,图5中的方法步骤201至步骤203,图6中的方法步骤201至步骤206,图8中的方法步骤201至步骤207,实现图9中的模块31-37,单元311-312的功能。The one or more modules are stored in the memory 42 and, when executed by the one or more processors 41, perform a multi-operating system based input processing method in any of the above method embodiments, for example, performing the above Method step 201 to step 202 in FIG. 2, method step 2011 to step 2012 in FIG. 3, method step 201 to step 203 in FIG. 5, method step 201 to step 206 in FIG. 6, and in FIG. The method steps 201 to 207 implement the functions of the modules 31-37 and the units 311-312 in FIG.
上述产品可执行本申请实施例所提供的方法,具备执行方法相应的功能模块和有益效果。未在本实施例中详尽描述的技术细节,可参见本申请实施例所提供的方法。The above products can perform the methods provided by the embodiments of the present application, and have the corresponding functional modules and beneficial effects of the execution method. For technical details that are not described in detail in this embodiment, reference may be made to the method provided by the embodiments of the present application.
本申请实施例提供了一种非易失性计算机可读存储介质,所述非易失性计算机可读存储介质存储有计算机可执行指令,该计算机可执行指令被电子设备执行上述任意方法实施例中的基于多操作系统的输入处理方法,例如,执行以上描述的图2中的方法步骤201至步骤202,图3中的方法步骤2011至步骤2012,图5中的方法步骤201至步骤203,图6中的方法步骤201至步骤206,图8中的方法步骤201至步骤207,实现图9中的模块31-37,单元311-312的功能。The embodiment of the present application provides a non-transitory computer readable storage medium storing computer-executable instructions that are executed by an electronic device to perform any of the above method embodiments. The multi-operating system-based input processing method, for example, performs the method steps 201 to 202 in FIG. 2, the method steps 2011 to 2012 in FIG. 3, and the method steps 201 to 203 in FIG. The method steps 201 to 206 in FIG. 6 and the method steps 201 to 207 in FIG. 8 implement the functions of the modules 31-37 and the units 311-312 in FIG.
本申请实施例提供了一种计算机程序产品,包括存储在非易失性计算机可读存储介质上的计算程序,所述计算机程序包括程序指令,当所述程序指令被计算机执行时时,使所述计算机执行上述任意方法实施例中的基于多操作系统的输入处理方法,例如,执行以上描述的图2中的方法步骤201至步骤202,图3中的方法步骤2011至步骤2012,图5中的方法步骤201至步骤203,图6中的方法步骤201至步骤206,图8中的方法步骤201至步骤207,实现图9中的模块31-37,单元311-312的功能。An embodiment of the present application provides a computer program product, including a computing program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions, when the program instructions are executed by a computer, The computer executes the multi-operating system based input processing method in any of the above method embodiments, for example, performs the method steps 201 to 202 in FIG. 2 described above, the method steps 2011 to 2012 in FIG. 3, and the method in FIG. The method steps 201 to 203, the method steps 201 to 206 in FIG. 6, and the method steps 201 to 207 in FIG. 8 implement the functions of the modules 31-37 and the units 311-312 in FIG.
以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, ie may be located A place, or it can be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
通过以上的实施方式的描述,本领域普通技术人员可以清楚地了解到各实施方式可借助软件加通用硬件平台的方式来实现,当然也可以通过硬件。本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(Random Access Memory,RAM)等。Through the description of the above embodiments, those skilled in the art can clearly understand that the various embodiments can be implemented by means of software plus a general hardware platform, and of course, by hardware. A person skilled in the art can understand that all or part of the process of implementing the above embodiments can be completed by a computer program to instruct related hardware, and the program can be stored in a computer readable storage medium. When executed, the flow of an embodiment of the methods as described above may be included. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
最后应说明的是:以上实施例仅用以说明本申请的技术方案,而非对其限制;在本申请的思路下,以上实施例或者不同实施例中的技术特征之间也可以进行组合,步骤可以以任意顺序实现,并存在如上所述的本申请的不同方面的许多其它变化,为了简明,它们没有在细节中提供;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, and are not limited thereto; in the idea of the present application, the technical features in the above embodiments or different embodiments may also be combined. The steps may be carried out in any order, and there are many other variations of the various aspects of the present application as described above, which are not provided in the details for the sake of brevity; although the present application has been described in detail with reference to the foregoing embodiments, The skilled person should understand that the technical solutions described in the foregoing embodiments may be modified, or some of the technical features may be equivalently replaced; and the modifications or substitutions do not deviate from the embodiments of the present application. The scope of the technical solution.

Claims (15)

  1. 一种基于多操作系统的输入处理方法,所述操作系统包括宿主操作系统和至少一个客户操作系统,其特征在于,所述方法包括:A multi-operating system based input processing method, the operating system comprising a host operating system and at least one guest operating system, wherein the method comprises:
    当监测到所述宿主操作系统接收到输入事件时,判断当前是否存在客户操作系统处于前台运行状态;When it is detected that the host operating system receives an input event, it is determined whether there is currently a guest operating system in a foreground running state;
    若存在,通过预设的数据传输通道将所述输入事件从所述宿主操作系统的内核空间注入处于前台运行状态的所述客户操作系统的内核空间,以使所述处于前台运行状态的所述客户操作系统响应所述输入事件。If present, injecting the input event from a kernel space of the host operating system into a kernel space of the guest operating system in a foreground running state through a preset data transmission channel, so as to be in the foreground running state The guest operating system responds to the input event.
  2. 根据权利要求1所述的方法,其特征在于,所述判断当前是否存在客户操作系统处于前台运行状态,包括:The method according to claim 1, wherein the determining whether the guest operating system is currently in a foreground running state comprises:
    从所述至少一个客户操作系统对应的虚拟切换设备中,读取所述至少一个客户操作系统的前/后台运行状态;Reading, from the virtual switching device corresponding to the at least one guest operating system, a front/back running state of the at least one guest operating system;
    根据获取到的所述至少一个客户操作系统的前/后台运行状态,判断当前是否存在客户操作系统处于前台运行状态。And determining, according to the obtained front/back running state of the at least one guest operating system, whether the guest operating system is currently in the foreground running state.
  3. 根据权利要求1所述的方法,其特征在于,所述通过预设的数据传输通道将所述输入事件从所述宿主操作系统的内核空间注入处于前台运行状态的所述客户操作系统的内核空间,具体包括:The method according to claim 1, wherein the input event is injected from a kernel space of the host operating system into a kernel space of the guest operating system in a foreground running state through a preset data transmission channel. Specifically, including:
    通过运行于所述宿主操作系统内核空间中的内核加速器,将所述输入事件从所述宿主操作系统的内核空间注入运行于前台运行状态的所述客户操作系统的后端程序,由所述后端程序将所述输入事件写入所述客户操作系统的内核空间。Passing the input event from a kernel space of the host operating system to a backend program of the guest operating system running in a foreground running state by a kernel accelerator running in a kernel space of the host operating system, The end program writes the input event to the kernel space of the guest operating system.
  4. 根据权利要求1至3任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1 to 3, wherein the method further comprises:
    当所述输入事件从所述宿主操作系统的内核空间注入处于前台运行状态的所述客户操作系统的内核空间之后,将所述输入事件从所述宿主操作系统的事件列表中清除。The input event is cleared from the event list of the host operating system after the input event injects kernel space of the guest operating system in a foreground running state from a kernel space of the host operating system.
  5. 根据权利要求4所述的方法,其特征在于,所述方法还包括:The method of claim 4, wherein the method further comprises:
    读取输入设备在所述宿主操作系统中的设备文件;Reading a device file of the input device in the host operating system;
    根据所述设备文件获取所述输入设备的配置信息;Obtaining configuration information of the input device according to the device file;
    将所述配置信息发送至所述客户操作系统的内核空间,以使所述客户操作系统中与所述输入设备对应的虚拟输入设备的驱动程序,根据所述配置信息配置所述虚拟输入设备。Sending the configuration information to a kernel space of the guest operating system, so that a driver of the virtual input device corresponding to the input device in the guest operating system configures the virtual input device according to the configuration information.
  6. 根据权利要求1所述的方法,其特征在于,所述方法还包括:The method of claim 1 further comprising:
    若当前不存在客户操作系统处于前台运行状态,所述宿主操作系统响应所述输入事件。If there is currently no guest operating system in the foreground running state, the host operating system responds to the input event.
  7. 一种基于多操作系统的输入处理装置,所述操作系统包括宿主操作系统和至少一个客户操作系统,其特征在于,所述装置包括判断模块和第一处理模块;An input processing device based on a multi-operating system, the operating system comprising a host operating system and at least one guest operating system, wherein the device comprises a judging module and a first processing module;
    所述判断模块,用于当监测到所述宿主操作系统接收到输入事件时,判断当前是否存在客户操作系统处于前台运行状态;The determining module is configured to: when it is detected that the host operating system receives an input event, determine whether the guest operating system is currently in a foreground running state;
    所述第一处理模块,用于若当前存在客户操作系统处于前台运行状态,通过预设的数据传输通道将所述输入事件从所述宿主操作系统的内核空间注入处于前台运行状态的所述客户操作系统的内核空间,以使所述处于前台运行状态的所述客户操作系统响应所述输入事件。The first processing module is configured to: when the guest operating system is currently in a foreground running state, inject the input event from the kernel space of the host operating system into the client in a foreground running state through a preset data transmission channel; The kernel space of the operating system to cause the guest operating system in the foreground operating state to respond to the input event.
  8. 根据权利要求7所述的装置,其特征在于,所述判断模块包括数据读取单元和状态判断单元;The apparatus according to claim 7, wherein said determining module comprises a data reading unit and a state determining unit;
    所述数据读取单元,用于从所述至少一个客户操作系统对应的虚拟切换设备中,读取所述至少一个客户操作系统的前/后台运行状态;The data reading unit is configured to read a front/back running state of the at least one guest operating system from a virtual switching device corresponding to the at least one guest operating system;
    所述状态判断单元,用于根据获取到的所述至少一个客户操作系统的前/后台运行状态,判断当前是否存在客户操作系统处于前台运行状态。The state determining unit is configured to determine, according to the obtained front/back running state of the at least one guest operating system, whether the guest operating system is currently in a foreground running state.
  9. 根据权利要求7所述的装置,其特征在于,所述第一处理模块具体用于:The device according to claim 7, wherein the first processing module is specifically configured to:
    若当前存在客户操作系统处于前台运行状态,通过运行于所述宿主操作系统内核空间中的内核加速器,将所述输入事件从所述宿主操作系统的内核空间注入运行于前台运行状态的所述客户操作系统的后端程序,由所述后端程序将所述输入事件写入所述客户操作系统的内核空间,以使所述前台运行状态的所述客户操作系统响应所述输入事件。If the guest operating system is currently in the foreground running state, the input event is injected from the kernel space of the host operating system into the client running in the foreground running state by a kernel accelerator running in the kernel space of the host operating system. a backend program of the operating system, the input event being written by the backend program to a kernel space of the guest operating system to cause the guest operating system of the foreground running state to respond to the input event.
  10. 根据权利要求7至9任一项所述的装置,其特征在于,所述装置还包括删除模块;The device according to any one of claims 7 to 9, wherein the device further comprises a deletion module;
    所述删除模块,用于当所述输入事件从所述宿主操作系统的内核空间注入处于前台运行状态的所述客户操作系统的内核空间之后,将所述输入事件从所述宿主操作系统的事件列表中清除。The deleting module, configured to: when the input event is injected from a kernel space of the host operating system into a kernel space of the guest operating system in a foreground running state, the event of the input event from the host operating system Cleared in the list.
  11. 根据权利要求10所述的装置,其特征在于,所述装置还包括第一获取模块、第二获取模块以及发送模块;The device according to claim 10, wherein the device further comprises a first obtaining module, a second acquiring module, and a sending module;
    所述第一获取模块,用于读取输入设备在所述宿主操作系统中的设备文件;The first obtaining module is configured to read a device file of the input device in the host operating system;
    所述第二获取模块,用于根据所述设备文件获取所述输入设备的配置信息;The second obtaining module is configured to acquire configuration information of the input device according to the device file;
    所述发送模块,用于将所述配置信息发送至所述客户操作系统的内核空间,以使所述客户操作系统中与所述输入设备对应的虚拟输入设备的驱动程序,根据所述配置信息配置所述虚拟输入设备。The sending module is configured to send the configuration information to a kernel space of the guest operating system, so that a driver of the virtual input device corresponding to the input device in the guest operating system is configured according to the configuration information. The virtual input device is configured.
  12. 根据权利要求1所述的方法,其特征在于,所述装置还包括第二处理模块;The method of claim 1 wherein said apparatus further comprises a second processing module;
    所述第二处理模块,用于若当前不存在客户操作系统处于前台运行状态,所述宿主操作系统响应所述输入事件。The second processing module is configured to respond to the input event if the guest operating system is not in a foreground running state.
  13. 一种电子设备,其特征在于,包括:An electronic device, comprising:
    至少一个处理器;以及,At least one processor; and,
    与所述至少一个处理器通信连接的存储器;其中,a memory communicatively coupled to the at least one processor; wherein
    所述存储器存储有可被所述至少一个处理器执行的指令程序,所述指令程序被所述至少一个处理器执行,以使所述至少一个处理器执行权利要求1至6任一项所述的方法。The memory stores an instruction program executable by the at least one processor, the instruction program being executed by the at least one processor to cause the at least one processor to perform the method of any one of claims 1 to 6. Methods.
  14. 一种非易失性计算机可读存储介质,其特征在于,所述非易失性计算机可读存储介质存储有计算机可执行指令,所述计算机可执行指令用于使计算机执行权利要求1至6任一项所述的方法。A non-transitory computer readable storage medium, wherein the non-transitory computer readable storage medium stores computer-executable instructions for causing a computer to perform claims 1 to 6 The method of any of the preceding claims.
  15. 一种计算机程序产品,其特征在于,所述计算机程序产品包括存储在非易失性计算机可读存储介质上的计算机程序,所述计算机程序包括程序指令,当所述程序指令被计算机执行时,使所述计算机执行权利要求1至6任一项所述的方法。A computer program product, comprising: a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions, when the program instructions are executed by a computer, The computer is caused to perform the method of any one of claims 1 to 6.
PCT/CN2017/117557 2017-12-20 2017-12-20 Input processing method and apparatus based on multiple operating systems, and electronic device WO2019119315A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2017/117557 WO2019119315A1 (en) 2017-12-20 2017-12-20 Input processing method and apparatus based on multiple operating systems, and electronic device
CN201780003332.7A CN108235759B (en) 2017-12-20 2017-12-20 Input processing method and device based on multiple operating systems and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2017/117557 WO2019119315A1 (en) 2017-12-20 2017-12-20 Input processing method and apparatus based on multiple operating systems, and electronic device

Publications (1)

Publication Number Publication Date
WO2019119315A1 true WO2019119315A1 (en) 2019-06-27

Family

ID=62644765

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/117557 WO2019119315A1 (en) 2017-12-20 2017-12-20 Input processing method and apparatus based on multiple operating systems, and electronic device

Country Status (2)

Country Link
CN (1) CN108235759B (en)
WO (1) WO2019119315A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111666167A (en) * 2020-06-05 2020-09-15 北京元心科技有限公司 Input event reading processing optimization method, nonvolatile memory and terminal equipment
CN115567634A (en) * 2022-09-05 2023-01-03 青岛海信移动通信技术股份有限公司 Network management method, device, equipment and storage medium

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110825606B (en) * 2019-11-08 2023-04-07 北京金山云网络技术有限公司 Data operation method, device and central station system
CN112394871B (en) * 2020-11-30 2021-11-02 北京麟卓信息科技有限公司 Method and device for supporting android system multi-point touch by Linux platform
CN112394872B (en) * 2020-11-30 2022-01-11 北京麟卓信息科技有限公司 Method and device for optimizing android system multi-touch supported by Linux platform
CN113791875A (en) * 2021-11-18 2021-12-14 北京鲸鲮信息系统技术有限公司 Input device virtualization method and device, electronic device and storage medium
CN115657879B (en) * 2022-12-09 2023-04-07 北京小米移动软件有限公司 Input control method, device, equipment and medium based on heterogeneous operating system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101008903A (en) * 2006-01-23 2007-08-01 联想(北京)有限公司 Virtual machine system and device access method thereof
CN105573817A (en) * 2015-12-11 2016-05-11 北京奇虎科技有限公司 Virtual input control method, device and system
CN106796531A (en) * 2016-12-27 2017-05-31 深圳前海达闼云端智能科技有限公司 The management method of kernel setup information, device and electronic equipment
CN107278294A (en) * 2017-05-12 2017-10-20 深圳前海达闼云端智能科技有限公司 Input equipment implementation method and its realize device

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101451781B1 (en) * 2013-04-05 2014-10-16 국방과학연구소 System and method for device duplication of virtualization system in virtual machine environment
EP3062225B1 (en) * 2015-02-24 2019-07-03 Huawei Technologies Co., Ltd. Multi-operating system device, notification device and methods thereof
CN105335241A (en) * 2015-10-27 2016-02-17 联想(北京)有限公司 Information processing method and electronic equipment
US10489121B2 (en) * 2016-06-02 2019-11-26 Avago Technologies International Sales Pte. Limited Method and apparatus for determining system information in a device having a plurality of processors, each including virtual machines and some located on separate insertable boards

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101008903A (en) * 2006-01-23 2007-08-01 联想(北京)有限公司 Virtual machine system and device access method thereof
CN105573817A (en) * 2015-12-11 2016-05-11 北京奇虎科技有限公司 Virtual input control method, device and system
CN106796531A (en) * 2016-12-27 2017-05-31 深圳前海达闼云端智能科技有限公司 The management method of kernel setup information, device and electronic equipment
CN107278294A (en) * 2017-05-12 2017-10-20 深圳前海达闼云端智能科技有限公司 Input equipment implementation method and its realize device

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111666167A (en) * 2020-06-05 2020-09-15 北京元心科技有限公司 Input event reading processing optimization method, nonvolatile memory and terminal equipment
CN115567634A (en) * 2022-09-05 2023-01-03 青岛海信移动通信技术股份有限公司 Network management method, device, equipment and storage medium
CN115567634B (en) * 2022-09-05 2024-03-29 青岛海信移动通信技术有限公司 Network management method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN108235759B (en) 2022-09-16
CN108235759A (en) 2018-06-29

Similar Documents

Publication Publication Date Title
WO2019119315A1 (en) Input processing method and apparatus based on multiple operating systems, and electronic device
US11023363B2 (en) Performance test application sequence script
US20190243670A1 (en) Execution of a script based on properties of a virtual device associated with a virtual machine
WO2017124842A1 (en) Method and device for taking screenshots
US10387182B2 (en) Direct memory access (DMA) based synchronized access to remote device
JP6598848B2 (en) Presenting the computing environment on multiple devices
US9940283B2 (en) Application sharing in multi host computing systems
US20210081187A1 (en) Modification of software behavior in run time
WO2015062339A1 (en) Method and device for running remote application program
US9665463B2 (en) In-process wrapped execution engine(s) for tooling a dynamic program across a process boundary
CN105700944A (en) Online migration method and device for virtual machine not in shared storage condition
AU2019256257A1 (en) Processor core scheduling method and apparatus, terminal, and storage medium
CN113037795B (en) Thin terminal system and processing method thereof
US11249771B2 (en) Terminal input invocation
CN108401453B (en) Method and device for controlling display screen and intelligent terminal
US10261937B2 (en) Method and system for communication of device information
CN107949828B (en) Method and apparatus for dynamically migrating execution of machine code in an application to a virtual machine
CN111274044A (en) GPU (graphics processing unit) virtualized resource limit processing method and device
CN109388435A (en) Realize app while the repeatedly method and apparatus of opening operation
US11233853B1 (en) System and method for controlling remote sessions executing on other devices
JP7093798B2 (en) View switching
US10733005B1 (en) Providing access to mobile applications by heterogeneous devices
US9298502B2 (en) Pausing virtual machines using API signaling
EP4390852A1 (en) Scene rendering method and apparatus, device and system
US20160196205A1 (en) Method and apparatus for accessing remote mobile devices

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: 17935562

Country of ref document: EP

Kind code of ref document: A1

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 271020)

122 Ep: pct application non-entry in european phase

Ref document number: 17935562

Country of ref document: EP

Kind code of ref document: A1