WO2018039967A1 - 虚拟机切换方法、装置、电子设备和计算机程序产品 - Google Patents

虚拟机切换方法、装置、电子设备和计算机程序产品 Download PDF

Info

Publication number
WO2018039967A1
WO2018039967A1 PCT/CN2016/097516 CN2016097516W WO2018039967A1 WO 2018039967 A1 WO2018039967 A1 WO 2018039967A1 CN 2016097516 W CN2016097516 W CN 2016097516W WO 2018039967 A1 WO2018039967 A1 WO 2018039967A1
Authority
WO
WIPO (PCT)
Prior art keywords
virtual machine
switching
handover
request
running state
Prior art date
Application number
PCT/CN2016/097516
Other languages
English (en)
French (fr)
Inventor
李岩刚
Original Assignee
深圳前海达闼云端智能科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳前海达闼云端智能科技有限公司 filed Critical 深圳前海达闼云端智能科技有限公司
Priority to CN201680002815.0A priority Critical patent/CN107003891A/zh
Priority to PCT/CN2016/097516 priority patent/WO2018039967A1/zh
Publication of WO2018039967A1 publication Critical patent/WO2018039967A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45575Starting, stopping, suspending or resuming virtual machine instances

Definitions

  • the present invention relates to the field of virtualization technologies, and in particular, to a virtual machine switching method, apparatus, electronic device, and computer program product.
  • multiple operating systems or virtual machines can run on the electronic device at the same time, and multiple operating systems or virtual machines share the processor, memory, and input and output devices provided by the hardware device.
  • the hardware system which mainly includes the processor, memory, and input and output devices.
  • the hardware system On top of the hardware system is a secure and independent software running environment virtualization layer, running a virtual machine monitor (abbreviated as VMM or Hypervisor) at the virtualization layer to manage the real physical hardware platform, and for each client (Guest) ) Provide a corresponding virtual hardware platform.
  • VMM virtual machine monitor
  • the Hypervisor performs the aforementioned functions through the host (Host).
  • FIG. 1 is a schematic diagram of a virtualization system in the prior art.
  • the system has a host (Host) running on the kernel layer of the host operating system (Host OS) and running some applications.
  • the system also has three guests, each of which can be thought of as a small but complete computer system that emulates virtual system hardware for each client, including the client's processor, memory, and Input and output devices run the client's own operating system, the guest operating system (Guest OS), on top of each client's kernel layer.
  • Guest OS guest operating system
  • Users can switch between virtual machines to achieve isolated use of different applications on each virtual machine.
  • the operating systems of the virtual machines and the operating systems of the virtual machines are isolated from each other and cannot access the memory space.
  • the existing virtualization system can realize the isolation of multiple virtual machines on a single terminal through virtualization technology, the process of avoiding the operating systems of the respective virtual machines may adversely affect the operating systems of other virtual machines, but because the user can By switching virtual machines into the operating system of different virtual machines System, so the isolation between virtual machines is still low.
  • the embodiment of the invention provides a virtual machine switching method, device, electronic device and computer program product, which can improve the isolation between virtual machines in the virtualization system.
  • an embodiment of the present invention provides a virtual machine switching method, where the method includes:
  • the virtual machine to which it belongs is switched from the non-foreground running state to the foreground running state.
  • an embodiment of the present invention provides a virtual machine switching apparatus, where the apparatus includes:
  • a receiving module configured to receive a handover request, where the handover request includes information about a source virtual machine that initiates the handover request;
  • a determining module configured to determine, according to the information of the source virtual machine, that the switching request is legal
  • the switch module is configured to switch the owned virtual machine from a non-foreground running state to a foreground running state.
  • an embodiment of the present invention provides an electronic device, including: a display, a memory, one or more processors; and one or more modules, the one or more A module is stored in the memory and configured to be executed by the one or more processors, the one or more modules including instructions for performing the various steps of any of the above methods.
  • embodiments of the present invention provide a computer program product for use with an electronic device including a display, the computer program product comprising a computer readable storage medium and a computer program mechanism embedded therein,
  • the computer program mechanism includes instructions for performing the various steps of any of the above methods.
  • the handover when the source virtual machine initiates a handover to the virtual machine to which the handover process belongs, the handover is initiated.
  • the process needs to first determine whether to allow the source virtual machine to switch to the virtual machine to which the switching process belongs. Only when the switching source is legal, the virtual machine to which the switching process belongs is switched to the foreground.
  • the invention determines whether the handover request is legal before switching the virtual machine, and restricts the handover between the virtual machines, thereby further isolating the user's access to each virtual machine, and is more secure.
  • Figure 1 shows a schematic diagram of a virtualized system architecture
  • FIG. 2 is a schematic flowchart of a virtual machine switching method according to Embodiment 1 of the present invention.
  • FIG. 3 is a schematic structural diagram of a client implementing a virtual interrupt in Embodiment 2 of the present invention.
  • FIG. 4 is a schematic structural diagram of a virtual machine switching apparatus according to Embodiment 3 of the present invention.
  • the present invention provides a method for switching a virtual machine.
  • the handover process needs to first determine whether to allow the source virtual machine to switch to the virtual machine to which the handover process belongs.
  • the virtual machine to which the switching process belongs is switched to the foreground operation only when the switching source is legal.
  • the invention determines whether the handover request is legal before switching the virtual machine, and restricts the handover between the virtual machines, thereby further isolating the user's access to each virtual machine, and is more secure.
  • Embodiment 1 is a diagrammatic representation of Embodiment 1:
  • FIG. 1 is a schematic flowchart of a virtual machine switching method according to Embodiment 1 of the present invention. As shown in FIG. 1 , the virtual machine switching method includes:
  • Step 101 Receive a handover request, where the handover request includes information about a source virtual machine that initiates the handover request.
  • Step 102 Determine, according to information of the source virtual machine, that the handover request is legal;
  • Step 103 Switch the associated virtual machine from a non-foreground running state to a foreground running state.
  • each virtual machine in the virtualization system runs its own switching process, or correspondingly runs a switching process of each virtual machine in the virtualization system in the virtualization layer, and each switching process can receive a pointer to it.
  • the virtual machine is switched.
  • the switch request contains the information of the source virtual machine, that is, the information of the client or host that initiated the handover. After the virtual machine to which the switching process belongs receives the switching request, information about the source virtual machine can be obtained.
  • the virtual machine to which the switching process belongs is currently in a non-foreground running state, and the non-foreground running state is a background running state or a sleep state.
  • the background running state means that the virtual machine is 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 running in the background can call the module such as network communication, but already
  • the input/output module involved in user interaction cannot be called, such as a keyboard or a display screen;
  • the sleep state means that the virtual machine is in an inoperative state, and the operating system is in a closed state, so the virtual machine in the sleep state cannot invoke the user interaction. Input and output modules.
  • the switching request may be from the host or may be from another client running on the host, when the switching request is from another client.
  • the switching request may be forwarded by the virtualization layer; the virtual process belongs to the virtual process
  • the virtual machine can also be a host, in which case the switch request comes from a client running on the host.
  • the associated virtual machine is a host
  • the non-foreground running state refers to that the kernel layer is in a background running state, and the operating system is in a dormant state.
  • the current client is in the foreground running state
  • the host is in the background running state, that is, the kernel layer of the host is activated to support the client's call to the hardware device, but
  • the operating system is in a sleep state.
  • it can be implemented by the wakelock mechanism provided by the Linux system.
  • the client running in the foreground is applying for a wakelock lock.
  • the type of the lock is set to wake_lock_suspend, and its function is to prevent the entire host system from going to sleep.
  • the operating system After the host running in the background does not have system input for more than the predetermined time, the operating system will go to sleep because it has no input, but the kernel layer will still be activated by the client wakelock (when it is switched back to the host by the client) At the time, the client will release this wake_lock lock). Different from the prior art, the operating system of the host is still in the active state. In this embodiment, the kernel layer of the host is in the background running state, and the operating system of the host is in a dormant state, which is more power-saving.
  • the virtual machine running on the current console enters the sleep state due to no operation, and the client also releases the wake_lock lock to allow the entire system (the kernel layer and operating system of the host, as well as the kernel layer and operating system of the client). ) enters the sleep state to save power.
  • Step 102 is a step of determining, by the switching process, the legality of the source of the handover request.
  • the handover process may determine that the handover is legal according to any one or a combination of the following manners:
  • the virtual machine to which the switching process belongs stores a whitelist of the legal source virtual machine, that is, when the source virtual machine information in the current switching request is in the whitelist of the legal source virtual machine, it is determined that the switching is legal;
  • the virtual machine to which the switching process belongs stores the blacklist of the illegal source virtual machine, that is, when the source virtual machine information in the current switching request is not in the blacklist of the illegal source virtual machine, it is determined that the switching is legal;
  • the virtual machine to which the switching process belongs stores the security level of each virtual machine, and can be updated periodically. Only when the security level of the source virtual machine in the current switching request is higher than the preset level, the switching is determined. law;
  • the virtual machine to which the switching process belongs stores the security level of each virtual machine, and can be updated periodically. Only when the security level of the source virtual machine in the current switching request is not lower than the security level of the virtual machine to which the switching process belongs, the judgment center The switching is legal.
  • the handover process may also have other judgment strategies to determine whether the handover is legal according to the information of the source virtual machine in the handover request.
  • the virtual machine to which the switching process belongs may be a virtual machine that requires high security performance or involves user privacy.
  • the present invention can restrict the switching by the switching process according to the switching source before switching it to the foreground running state.
  • step 103 if it is determined that the handover is permitted by the foregoing steps, the virtual machine to which the handover process belongs is switched to the foreground running state, that is, a related program such as a human-machine interaction service program is run, so that the virtual machine to which the handover process belongs can be enabled.
  • a related program such as a human-machine interaction service program is run, so that the virtual machine to which the handover process belongs can be enabled.
  • Various modules that involve input and output involving user interaction including a keyboard or a display screen, such that the human-computer interaction interface is visible to the user and operable by the user.
  • the switching request may be discarded, or only the switching request may be stored but the switching operation is not performed.
  • the method further includes: obtaining, by the cloud server, a handover enable identifier of the virtual machine, where the handover enable identifier is used to determine whether the handover is currently allowed; determining that the handover is currently allowed according to the obtained handover enable identifier .
  • the cloud server stores a switch enable identifier corresponding to each virtual machine in a terminal, and is used to indicate whether the virtual machine to which the handover process belongs is allowed to implement handover.
  • the handover enablement identifier may be acquired from the cloud server periodically and stored in the virtual machine corresponding to the terminal before receiving the handover request, or may be acquired in real time by communicating with the cloud server when receiving the handover request.
  • the cloud server can communicate with the virtual machine to which the switching process belongs, so that the virtual machine to which the switching process belongs acquires the switching enable identifier; when the virtual machine to which the switching process belongs is a certain client
  • the cloud server can communicate with the virtual machine or the host to which the switching process belongs, so that the virtual machine to which the switching process belongs can directly obtain the switching enable identifier or pass through the host. Forwarding obtains the switch enable identifier.
  • the switch enable identifier can be obtained by the cloud server, the handover process of the virtual machine to which the handover process belongs will be more flexible. For example, after the user's device is lost, the cloud server can change the switch enable identifier of the virtual machine to which the switch process belongs, so that the switch is not enabled, but the other virtual machines are not hindered. The person picking up the device cannot snoop the switch process. The content in the virtual machine can be used to retrieve the owner by using the normal function of the mobile phone.
  • the cloud server may be a cloud robot.
  • the cloud robot is an intelligent robot that places a cognitive system in the cloud, a body, a drive, and a sensor are placed on the robot body, and the two are connected by mobile communication.
  • the cloud robot is intelligent. The direction in which humanoid robots develop.
  • the method further comprises: determining, according to the virtualization system security state and/or the preset allowed handover time period, that the current handover is allowed.
  • Existing virtualization systems usually have a security monitoring mechanism. Each client can monitor whether itself and/or the host has been tampered with. The host can also monitor itself and/or whether the clients have been tampered with. Whether the machine and/or host is tampered with determines the current security state of the virtualization system.
  • the virtual machine to which the switching process belongs monitors whether it is tampered with and/or the virtual machine to which the switching process belongs monitors whether the host has been tampered with. If there is a tampering, the switching process will determine the current virtualization. The system has security risks and does not allow handover; or the host monitors whether it has been tampered with and/or whether a client running on it has been tampered with. If there is a tampering situation, it determines that the current virtualization system has security risks, and the handover process passes. Communicating with the host to know that the current virtualization system has security risks does not allow switching.
  • the host monitors whether it has been tampered with and/or whether a client running on it is tampered with. If there is a tampering, it determines that the current virtualization system has a security risk, Allow switching.
  • the time period during which the switching is allowed may be preset, for example, the working time is allowed to be switched during the working day, and after the other time periods are entered, the virtual machine to which the switching process belongs cannot be switched, and the switching of the virtual machine is performed by allowing the switching time period. Further restrictions.
  • the method further includes: determining that the source virtual machine has completed interaction Business.
  • the virtual machine to which the switching process belongs After the virtual machine to which the switching process belongs is switched to the foreground running state, the virtual machine to which the switching process belongs will run a related program such as a human-machine interaction service program, so that the virtual machine to which the switching process belongs can invoke the input and output involving the user interaction.
  • a related program such as a human-machine interaction service program
  • the various modules, and the human-computer interaction interface of the virtual machine to which the switching process belongs become visible to the user and make the user operable.
  • the source virtual machine cannot implement the related functions of human-computer interaction. Therefore, before the virtual machine to which the handover process belongs is switched to the foreground running state, the source virtual machine that initiates the handover request needs to complete the interaction task.
  • the interaction task is a task completed by various modules involved in input and output of user interaction, and may be some specific interaction tasks preset, for example, may be a prompt that pops up before the handover, the user will enter the virtual machine to which the handover process belongs.
  • the dialog box is considered to be executed after the user clicks the confirmation, and the subsequent switching step is performed. It may also be other tasks that involve the user interaction that are relatively important and need to be executed first.
  • the handover request may be discarded, or only the handover request may be stored but not yet Perform the switching operation.
  • the handover request is stored; and the preset duration is delayed to determine whether the handover is allowed.
  • the handover process After the handover process receives the handover request, it is determined that the virtual machine is not allowed to perform handover when the virtual machine is currently not allowed to switch according to any one or more of the foregoing steps 102 or the preferred manners, and the handover request is stored. After the preset time T, the virtual machine to which the switching process belongs can determine whether the virtual machine is allowed to switch according to the above-mentioned scheme according to the stored switching request. If there are multiple switching requests, the latest one can be used. The switching step is completed when switching.
  • the execution order may be arbitrary.
  • the previous step may determine that the handover is not allowed, and the subsequent steps may not be performed.
  • the switching request is directly stored, and after each step of T, the steps are judged again.
  • the handover process when the source virtual machine initiates the handover to the virtual machine to which the handover process belongs, the handover process needs to first determine whether to allow the source virtual machine to switch to the virtual machine to which the handover process belongs, only when the handover source is legal.
  • the virtual machine to which the switching process belongs is switched to the foreground.
  • the handover between the virtual machines is restricted, and the user access to each virtual machine is further isolated, which is more secure.
  • the handover process may further determine whether to allow the handover according to the handover enable identifier obtained by the cloud server, and is more flexible; and may determine whether the handover is allowed according to the preset allowable handover time period, so that the handover restriction has practical significance;
  • the virtual machine that initiates the handover completes its interactive task, and does not affect the normal use of other virtual machines due to the handover; and can store the handover request when the handover is temporarily not allowed, and then switch when the handover is possible, and the handover request is not lost.
  • Embodiment 2 is a diagrammatic representation of Embodiment 1:
  • the operating system of the host machine runs in the foreground, and all the input and output devices of the system are monopolized, that is, information such as the configuration and attributes of the input and output devices can be obtained, and input information of the input/output device can be obtained, or the output of the system can be passed. Output device output.
  • the operating system of the host computer controls the execution task of the operating system according to the input. If no task needs to be executed, the system enters the sleep mode.
  • One or more clients are running on the host machine.
  • the operating system of one client When the operating system of one client is started, only the configuration and attributes of the input and output devices of the embedded system can be obtained, and the input information of the input/output device cannot be obtained, or Output the output of the system through the output device.
  • the client's operating system finishes booting, if it does not receive a request to switch to the guest operating system, it runs in the background or automatically enters sleep mode.
  • the user operates an application in the host operating system to initiate a handover request, the handover request being an interrupt instruction.
  • the host operating system After receiving the user's request, the host operating system sends it to the switching process corresponding to the client that the user wants to switch to the foreground running state, and the switching process checks the security of the current virtualization system and the task status in the current host operating system. Or the switching process obtains the result of the host checking the security of the current virtualization system and the task state in the current host operating system. If the current virtualization system is secure, and the tasks in the current host operating system have been completed, and according to the switching policy preset by the user, it is determined that the host that initiates the switching request has the same security level as the client pointed to by the switching request, that is, the permission is allowed.
  • the host machine switches to the client, then the host releases all the input and output devices in the exclusive embedded system, and the state of the operating system of the switching host is running in the background, and then the sleep mode can be further entered for a period of time. If the current virtualization system is not secure, or if some of the important tasks involved in the interaction of the current host operating system are not completed, and you need to continue to occupy the input and output devices in the embedded system, allow these tasks to use these devices until these tasks are completed. When the host's operating system is switched, the state is running in the background.
  • the guest operating system is woken up by an interrupt initiated by the host's operating system.
  • the client runs a handover process that performs handovers based on the current state of the client and guest operating systems and the received interrupts.
  • the client provides a virtual hardware environment for virtual operating systems and application software, including virtual central processors and virtual interrupt controllers.
  • the virtual central processor is used to execute the machine code of the virtual machine.
  • the virtual interrupt controller is used to detect, manage, and initiate client interrupts.
  • the interrupt controller can enable or disable interrupts.
  • Virtual interrupts are virtual CPU-specific interrupts.
  • the client virtualizes a virtual switching device that obtains a virtual interrupt by requesting a virtual interrupt source from the virtual interrupt controller.
  • One implementation of the virtual switching device is to determine whether the switching request is legal based on the analog register. It provides 4 virtual registers, as shown in Table 1, where registers 1-3 are used to respond to other operating system-initiated requests to switch the client operating system to the foreground, and register 4 is used to output the current operating system to switch to the background. Request.
  • the switch request interrupt control register (register 1) controls the enable of the virtual interrupt.
  • the register can be set by the cloud server based on communication or communicated with the cloud server, and can be set by the client itself or by the host; the switch request interrupt status
  • the register (register 2) holds the request record of the virtual interrupt, usually storing the latest virtual interrupt request;
  • the switch request interrupt source register (register 3) stores the source of the switch request, ie whether the switch is initiated by the host or initiated by another client. And storing information of the source of the handover request.
  • the switch request register (register 4) is used to initiate a request for the current client to switch to the background.
  • the register is divided into two domains (bit segments), a switch request field and a return status field, wherein the switch request field indicates that the foregoing handover request is sent.
  • the return status field is used to save the success or failure result of the switch request (that is, when the current client is running in the foreground, the user wants to switch the currently running client to run in the background, and switch other clients to the foreground.
  • the guest operating system has a driver for the virtual switching device that provides read and write registers and a response to interrupts.
  • the architecture diagram of the client implementing the virtual interrupt is shown in FIG. 3.
  • the virtual switch device's driver operation registers 1, 2, and 3 respond.
  • the current client stores the handover request in the register 2 after receiving the handover request, and stores the source of the handover request in the register 3. Then, according to the value in the register 1, it is judged whether the switching interrupt of the client is enabled.
  • the interrupt in the register 2 may be triggered; the operating system corresponding to the client runs the switching process, and is awakened after receiving the interrupt. Run the virtual device driver, respond to the interrupt request in register 2, and judge whether the source of the switch request interrupt is legal according to the data in register 3. For example, the client with lower security level can be restricted to the client with higher security level. Switching to achieve programmable between multiple operating systems The way to control the direction of system switching or to prohibit the system from switching.
  • the guest operating system responds to the switch request initiated by the host operating system, monopolizing all the input and output devices in the embedded system, and switching Running status for the foreground.
  • the switching process is similar to the above switching mode, except that the host operating system can be woken by the client through the event without interrupting. wake.
  • Embodiment 3 is a diagrammatic representation of Embodiment 3
  • FIG. 4 is a schematic structural diagram of a virtual machine switching apparatus according to Embodiment 3 of the present invention. As shown in the figure, the apparatus 400 includes:
  • the receiving module 401 is configured to receive a handover request, where the handover request includes information about a source virtual machine that initiates the handover request.
  • the determining module 402 is configured to determine, according to the information of the source virtual machine, that the switching request is legal;
  • the switching module 403 is configured to switch the associated virtual machine from a non-foreground running state to a foreground running state.
  • the receiving module 401 is further configured to acquire, from the cloud server, a handover enable identifier of the virtual machine to which the virtual machine belongs, where the handover enable identifier is used to determine whether the handover is currently allowed.
  • the determining module 402 is further configured to determine that the currently allowed switching is performed according to the obtained switching enable identifier before the switching module 403 switches the virtual machine to the foreground running state.
  • the determining module 402 is further configured to determine, according to the virtualized system security state and/or the preset allowed handover time period, that the current allowed handover is performed before the switching module 403 switches the associated virtual machine to the foreground running state.
  • the device further comprises:
  • a storage module configured to: when the determining module 402 determines that switching is currently not allowed, storing the Switching request;
  • the determining module 402 is further configured to delay the preset duration to determine whether to allow the handover.
  • the determining module 402 is further configured to: before the switching module 403 switches the virtual machine to the foreground running state, determine that the source virtual machine has completed the interaction task.
  • the switching request is an interrupt instruction; the determining module 402 is specifically configured to determine, according to the information of the source virtual machine, whether the switching request is legal based on the analog register.
  • the associated virtual machine is a host
  • the non-foreground running state refers to that the kernel layer is in a background running state, and the operating system is in a dormant state.
  • Embodiment 4 is a diagrammatic representation of Embodiment 4:
  • a virtual machine switching electronic device is also provided in the embodiment of the present invention. Since the principle is similar to the virtual machine switching method, the implementation of the method may refer to the implementation of the method, and the repeated description is not repeated.
  • the electronic device includes: a display, a memory, one or more processors; and one or more modules, the one or more modules being stored in the memory and configured to be configured by the one or more The processor executes, the one or more modules including instructions for performing the various steps of any of the above methods.
  • Embodiment 5 is a diagrammatic representation of Embodiment 5:
  • an embodiment of the present invention further provides a virtual machine switching computer program product used in combination with an electronic device including a display. Since the principle is similar to the virtual machine switching method, the implementation may refer to the implementation of the method, and the method is repeated. It will not be repeated here.
  • the computer program product comprises a computer readable storage medium and a computer program mechanism embodied therein, the computer program mechanism comprising instructions for performing the various steps of any of the foregoing methods.
  • embodiments of the present invention can be provided as a method, system, or computer program product. Accordingly, the present invention may employ an entirely hardware embodiment, an entirely software embodiment, Or in the form of an embodiment of the software and hardware aspects. Moreover, the invention can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer usable program code.
  • computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
  • These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device.
  • the instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

本发明提供了虚拟机切换方法、装置、电子设备和计算机程序产品,所述方法包括:接收切换请求,所述切换请求包括发起所述切换请求的源虚拟机的信息;根据所述源虚拟机的信息判断所述切换请求合法;将所属的虚拟机由非前台运行状态切换为前台运行状态。本发明提供了一种虚拟机切换方法可应用于智能终端或结合云端机器人应用,本发明通过在切换虚拟机前判断切换请求是否合法,以对虚拟机间的切换进行限制,进一步隔离了用户对各虚拟机的访问,更加安全。

Description

虚拟机切换方法、装置、电子设备和计算机程序产品 技术领域
本发明涉及虚拟化技术领域,特别涉及虚拟机切换方法、装置、电子设备和计算机程序产品。
背景技术
基于虚拟化技术多个操作系统或者虚拟机可以同时运行在电子设备上,多个操作系统或者虚拟机共享硬件设备提供的处理器、内存和输入输出设备。
虚拟化系统架构中处于底层的是硬件系统,主要包括处理器、内存和输入输出设备等。在硬件系统之上为安全独立的软件运行环境虚拟化层,在虚拟化层运行虚拟机监控器(缩写为VMM或称为Hypervisor)以管理真实的物理硬件平台,并为每个客户机(Guest)提供对应的虚拟硬件平台。Hypervisor通过宿主机(Host)实现前述职能。
图1为现有技术中虚拟化系统示意图,系统具有1个宿主机(Host),其内核层之上运行着宿主机的操作系统(Host OS),并运行了一些应用。系统还具有3个客户机(Guest),每个客户机可看作一个小的但是完整的计算机系统,宿主机为每个客户机模拟了虚拟的系统硬件,包括客户机的处理器、内存和输入输出设备,在各客户机的内核(kernel)层之上运行着客户机自己的操作系统,即客户机操作系统(Guest OS)。用户可在各虚拟机间切换,以实现隔离的使用各虚拟机上的不同应用程序。各虚拟机的操作系统之间以及各虚拟机的操作系统与宿主机的操作系统之间相互隔离,互相不能访问内存空间。
虽然现有的虚拟化系统能够通过虚拟化技术实现单一终端上多个虚拟机的隔离,避免多个虚拟机各自的操作系统运行的进程对其他虚拟机的操作系统产生不利影响,但是因为用户可通过切换虚拟机进入不同虚拟机的操作系 统,所以各虚拟机间的隔离性仍然较低。
发明内容
本发明实施例提出了虚拟机切换方法、装置、电子设备和计算机程序产品,能够提升虚拟化系统中各虚拟机间的隔离性。
在一个方面,本发明实施例提供了一种虚拟机切换方法,其特征在于,所述方法包括:
接收切换请求,所述切换请求包括发起所述切换请求的源虚拟机的信息;
根据所述源虚拟机的信息判断所述切换请求合法;
将所属的虚拟机由非前台运行状态切换为前台运行状态。
在另一个方面,本发明实施例提供了一种虚拟机切换装置,其特征在于,所述装置包括:
接收模块,用于接收切换请求,所述切换请求包括发起所述切换请求的源虚拟机的信息;
判断模块,用于根据所述源虚拟机的信息判断所述切换请求合法;
切换模块,用于将所属的虚拟机由非前台运行状态切换为前台运行状态。
在另一个方面,本发明实施例提供了一种电子设备,其特征在于,所述电子设备包括:显示器,存储器,一个或多个处理器;以及一个或多个模块,所述一个或多个模块被存储在所述存储器中,并被配置成由所述一个或多个处理器执行,所述一个或多个模块包括用于执行任一上述方法中各个步骤的指令。
在另一个方面,本发明实施例提供了一种与包括显示器的电子设备结合使用的计算机程序产品,所述计算机程序产品包括计算机可读的存储介质和内嵌于其中的计算机程序机制,所述计算机程序机制包括用于执行任一上述方法中各个步骤的指令。
本发明的有益效果如下:
本发明中,在由源虚拟机向切换进程所属的虚拟机发起切换时,切换进 程需要先确定是否允许由源虚拟机切换至切换进程所属的虚拟机,只有在所述切换来源合法时,才将切换进程所属的虚拟机切换为前台运行。本发明通过在切换虚拟机前判断切换请求是否合法,以对虚拟机间的切换进行限制,进一步隔离了用户对各虚拟机的访问,更加安全。
附图说明
下面将参照附图描述本发明的具体实施例,其中:
图1示出了虚拟化系统架构示意图;
图2示出了本发明实施例一中虚拟机切换方法的流程示意图;
图3示出了本发明实施例二中客户机实现虚拟中断的架构示意图;
图4示出了本发明实施例三中虚拟机切换装置的结构示意图。
具体实施方式
为了使本发明的技术方案及优点更加清楚明白,以下结合附图对本发明的示例性实施例进行进一步详细的说明,显然,所描述的实施例仅是本发明的一部分实施例,而不是所有实施例的穷举。并且在不冲突的情况下,本说明中的实施例及实施例中的特征可以互相结合。
发明人在发明过程中注意到:用户可通过切换虚拟机进入不同虚拟机的操作系统,各虚拟机间的隔离性仍然较低。
针对上述不足,本发明提供了一种虚拟机切换方法,在由源虚拟机向切换进程所属的虚拟机发起切换时,切换进程需要先确定是否允许由源虚拟机切换至切换进程所属的虚拟机,只有在所述切换来源合法时,才将切换进程所属的虚拟机切换为前台运行。本发明通过在切换虚拟机前判断切换请求是否合法,以对虚拟机间的切换进行限制,进一步隔离了用户对各虚拟机的访问,更加安全。
为了便于本发明的实施,下面以实例进行说明。
实施例一:
图1示出了本发明实施例一中虚拟机切换方法流程示意图,如图1所示,所述虚拟机切换方法包括:
步骤101,接收切换请求,所述切换请求包括发起所述切换请求的源虚拟机的信息;
步骤102,根据所述源虚拟机的信息判断所述切换请求合法;
步骤103,将所属的虚拟机由非前台运行状态切换为前台运行状态。
在步骤101中,虚拟化系统中的各虚拟机运行了各自的切换进程,或者在虚拟化层中对应的运行了虚拟化系统中各虚拟机的切换进程,各切换进程可在接收到指向其所属虚拟机的切换请求时对其所属虚拟机进行切换操作。
切换请求中包含源虚拟机的信息,即发起切换的客户机或者宿主机的信息。切换进程所属的虚拟机接收切换请求后,可获得其中的源虚拟机的信息。
切换进程所属的虚拟机当前处于非前台运行状态,所述非前台运行状态即为后台运行状态或者休眠状态。其中后台运行状态是指虚拟机正在运行,但是其人机交互的相关服务程序被关闭了,因此其人机交互界面对用户不可见,即后台运行的虚拟机可以调用网络通信等模块,但是已经不能调用涉及用户交互的输入输出模块,例如键盘或者显示屏;其中休眠状态是指虚拟机处于未运行状态,其上操作系统为关闭状态,因此处于休眠状态的虚拟机同样不能调用涉及用户交互的输入输出模块。
在某些场景下,用户可能会希望切换进程所属的虚拟机变为前台运行状态,例如希望运行切换进程所属的虚拟机操作系统下的某些程序,或者希望启动切换进程所属的虚拟机操作系统进一步操作,或者当关闭当前运行的其他虚拟机后,希望将后台运行的切换进程所属的虚拟机变为前台运行等。在这些场景下,切换请求指向的虚拟机对应的切换进程会接收到切换请求。
当切换进程所属的虚拟机为某一客户机时,所述切换请求可以是来自宿主机的,也可以是来自宿主机上运行的另一客户机的,当所述切换请求来自另一客户机时,可以由虚拟化层协助转发所述切换请求;切换进程所属的虚 拟机也可以为宿主机,此时切换请求来自宿主机上运行的某一客户机。
优选的,所述所属的虚拟机为宿主机,所述非前台运行状态是指内核层处于后台运行状态,操作系统处于休眠状态。
此种场景下,当前某一客户机为前台运行状态,宿主机处于后台运行状态,即所述宿主机的内核(kernel)层处于激活状态,用于支持客户机对硬件设备的调用,但是其操作系统处于休眠状态。具体可通过linux系统提供的wakelock机制实现,由当前前台运行的客户机申请一个wakelock锁,该锁的类型设置为wake_lock_suspend,其功能为阻止整个宿主机的系统进入休眠状态。后台运行的宿主机在没有系统输入超过预定时间之后,操作系统会因为没用输入而进入休眠状态,但内核层受客户机wakelock的限制将仍处于激活状态(当由客户机切换回宿主机的时候,客户机将释放这个wake_lock锁)。区别于现有技术中宿主机后台运行时操作系统仍处于激活状态的方案,本实施例中宿主机的内核层处于后台运行状态,所述宿主机的操作系统处于休眠状态,更加省电。当然,当前台运行的虚拟机因无操作而进入了休眠状态,客户机也会释放该wake_lock锁,以达到允许整个系统(宿主机的内核层和操作系统,以及客户机的内核层和操作系统)进入休眠状态从而节电的目的。
步骤102为切换进程对切换请求来源的合法性进行判断的步骤,在步骤102中切换进程可以根据以下方式中的任一种或者几种的组合判断所述切换合法:
1)切换进程所属的虚拟机存储有合法源虚拟机白名单,即仅当当前切换请求中的源虚拟机信息在所述合法源虚拟机白名单中时,判断所述切换合法;
2)切换进程所属的虚拟机存储有非法源虚拟机黑名单,即仅当当前切换请求中的源虚拟机信息不在所述非法源虚拟机黑名单中时,判断所述切换合法;
3)切换进程所属的虚拟机存储各虚拟机的安全等级,并可定期更新,仅当当前切换请求中的源虚拟机的安全等级高于预设等级时,判断所述切换合 法;
4)切换进程所属的虚拟机存储各虚拟机的安全等级,并可定期更新,仅当当前切换请求中的源虚拟机的安全等级不低于切换进程所属的虚拟机自身安全等级时,判断所述切换合法。
当然切换进程还可以有其他判断策略,根据切换请求中的源虚拟机的信息判断切换是否合法。
切换进程所属的虚拟机可能是对安全性能要求较高或者涉及用户隐私的虚拟机,本发明在将其切换至前台运行状态前,能够由切换进程根据切换来源对切换进行限制。
在步骤103中,若经前述步骤确定允许切换,则将所述切换进程所属的虚拟机切换为前台运行状态,即运行如人机交互服务程序等的相关程序,使切换进程所属的虚拟机能够调用涉及用户交互的输入输出的各种模块,包括键盘或者显示屏等,使其人机交互界面对用户可见,并且用户可操作。
若根据前述步骤判断不允许切换进程所属的虚拟机切换时,可以丢弃所述切换请求,或者仅存储所述切换请求但不执行切换的操作。
优选的,在步骤103之前还包括,从云端服务器获取所属的虚拟机的切换使能标识,所述切换使能标识用于确定当前是否允许切换;根据获取到的切换使能标识判断当前允许切换。
云端服务器存储了某一终端中各虚拟机对应的切换使能标识,用于表征是否允许切换进程所属的虚拟机实现切换。所述切换使能标识可以是在接收到切换请求前即周期性从云端服务器获取并存储在终端对应的虚拟机中的,也可以是在接收到切换请求时与云端服务器通信实时获取的。
当切换进程所属的虚拟机为宿主机时,云端服务器与切换进程所属的虚拟机可通信,使切换进程所属的虚拟机获取切换使能标识;当切换进程所属的虚拟机为某一客户机时,云端服务器可与切换进程所属的虚拟机或者宿主机通信,使切换进程所属的虚拟机直接获取切换使能标识,或者通过宿主机 的转发获取切换使能标识。
因为能够由云端服务器获取切换使能标识,所以切换进程对其所属的虚拟机的切换控制将更加灵活。例如用户的设备丢失后,可通过云端服务器更改切换进程所属的虚拟机的切换使能标识,使其切换不使能,但不妨碍其他虚拟机的使用,拾到设备的人既无法窥探切换进程所属的虚拟机中的内容,又可以利用手机的正常功能找回失主。
所述云端服务器可以为云端机器人,所述云端机器人是将认知系统放在云里,身体、驱动、传感器放在机器人本体上,通过移动通信将二者连接起来的智能机器人,云端机器人是智能仿人机器人发展的方向。
优选的,在步骤103之前,还包括:根据虚拟化系统安全状态和/或者预设允许切换时间段判断当前允许切换。
现有的虚拟化系统中通常具有安全监测机制,各客户机可对自身和/或宿主机是否被篡改进行监测,宿主机也可对自身和/或各客户机是否被篡改进行监测,通过客户机和/或宿主机是否被篡改可确定虚拟化系统当前的安全状态。
当切换进程所属的虚拟机为客户机时,切换进程所属的虚拟机监测自身是否被篡改和/或切换进程所属的虚拟机监测宿主机是否被篡改,若存在篡改情况切换进程将判断当前虚拟化系统存在安全风险,不允许切换;或者宿主机监测自身是否被篡改和/或其上运行的某个客户机是否被篡改,若存在篡改情况,则认定当前虚拟化系统存在安全风险,切换进程通过与宿主机通信获知当前虚拟化系统存在安全风险则不允许切换。当切换进程所属的虚拟机为宿主机时,宿主机监测自身是否被篡改和/或其上运行的某个客户机是否被篡改,若存在篡改情况,则认定当前虚拟化系统存在安全风险,不允许切换。
此外,可预设允许切换的时间段,例如在工作日上班时间才允许切换,在进入其他时段后将不能切换到切换进程所属的虚拟机,通过允许切换的时间段,对虚拟机的切换进行进一步限制。
优选的,在步骤103之前,还包括:确定所述源虚拟机已经完成交互任 务。
因为将切换进程所属的虚拟机切换为前台运行状态后,切换进程所属的虚拟机将运行如人机交互服务程序等的相关程序,使切换进程所属的虚拟机能够调用涉及用户交互的输入输出的各种模块,并且切换进程所属的虚拟机的人机交互界面变为对用户可见,使用户可操作,此时源虚拟机将无法实现人机交互的相关功能。所以本实施例在将切换进程所属的虚拟机切换为前台运行状态之前,需要先确定发起切换请求的源虚拟机已经完成了交互任务。所述交互任务为涉及用户交互的输入输出的各种模块完成的任务,并且可以为预先设定的某些特定交互任务,例如可以是在切换前弹出的提示用户将进入切换进程所属的虚拟机的对话框,在用户点击确认后才认为执行完该交互任务,进行后续切换步骤,也可以是其他相对重要需要优先执行完的涉及用户交互的任务。
若根据上述步骤102或者各优选方式中的任一种或者几种方式判断所属的虚拟机当前不允许切换时暂不进行切换,可以丢弃所述切换请求,或者仅存储所述切换请求但暂不执行切换的操作。
优选的,当判断当前不允许切换时,存储所述切换请求;延后预设时长判断是否允许切换。
当切换进程接收切换请求后,根据上述步骤102或者各优选方式中的任一种或者几种方式判断所属的虚拟机当前不允许切换时暂不进行切换,并对切换请求进行存储。在经过预设时间T后,切换进程所属的虚拟机重新根据存储的切换请求依上述方案判断所属虚拟机是否允许切换,若有多条切换请求,可以以最新的一条为准,在重新判断允许切换时完成切换步骤。
需要说明的是,上述步骤102和各优选的判断是否允许虚拟机进行切换的步骤的执行顺序可以是任意的,当有多步判断步骤时,在先步骤判断不允许切换时可不进行后续步骤,直接存储切换请求,待经过T时长后重新进行各步骤判断。
此外,可以理解的,当执行上述步骤的切换进程运行于其所属的虚拟机之上时将更加安全可靠,因其不会受到其他虚拟机上异常进程的影响。当各虚拟机的切换进程均运行于虚拟化层中时,将能够节约各虚拟机切换过程中的虚拟化层与各虚拟机的交互过程。
本实施例中,在由源虚拟机向切换进程所属的虚拟机发起切换时,切换进程需要先确定是否允许由源虚拟机切换至切换进程所属的虚拟机,只有在所述切换来源合法时,才将切换进程所属的虚拟机切换为前台运行。本实施例通过在切换虚拟机前判断切换请求是否合法,以对虚拟机间的切换进行限制,进一步隔离了用户对各虚拟机的访问,更加安全。
进一步的,切换进程还可以根据由云端服务器获取的切换使能标识判断是否允许切换,更加灵活;可根据预设允许切换时间段判断是否允许切换,使切换限制具有实用意义;可在切换前确定发起切换的虚拟机完成了其交互任务,不会因切换影响其他虚拟机的正常使用;以及可以在暂时不允许切换时存储切换请求,待可以切换时再行切换,切换请求不会丢失。
实施例二:
本实施例中,宿主机的操作系统前台运行,独占系统的所有输入输出设备,即能够获取输入输出设备的配置和属性等信息,并且能够获取输入输出设备的输入信息,或者将系统的输出通过输出设备输出。宿主机的操作系统在操作系统启动完成之后,根据输入控制操作系统的执行任务,如果没有任务需要执行,则系统进入休眠模式。
宿主机上运行一个或多个客户机,其中一个客户机的操作系统在启动时,只能够获取嵌入式系统的输入输出设备的配置和属性等信息,不能够获取输入输出设备的输入信息,或者将系统的输出通过输出设备输出。客户机的操作系统在启动完成之后,如果没有接收到切换到客户机操作系统的请求,则在后台运行,或者自动进入休眠模式。
将宿主机前台运行的状态切换为客户机前台运行的状态的过程如下:
用户操作宿主机操作系统中的应用程序发起切换请求,所述切换请求是中断指令。宿主机操作系统接收用户的请求后将其发送至用户希望切换为前台运行状态的客户机对应的切换进程,由该切换进程检查当前虚拟化系统的安全性和当前宿主机操作系统中的任务状态,或者该切换进程获取宿主机检查当前虚拟化系统的安全性和当前宿主机操作系统中的任务状态的结果。如果当前虚拟化系统安全,并且当前宿主机操作系统中的任务都已经完成,并且根据用户预先设置的切换策略,判断发起切换请求的宿主机与切换请求指向的客户机的安全级别相同,即允许所述宿主机机切换至所述客户机,那么宿主机释放独占的嵌入式系统中所有输入输出设备,切换宿主机的操作系统的状态为后台运行,之后一段时间内可进一步进入休眠模式。如果当前虚拟化系统不安全,或者当前宿主机操作系统中有部分重要的涉及交互的任务没有完成,需要继续占用嵌入式系统中的输入输出设备时,允许这些任务使用这些设备,直到这些任务完成时,切换宿主机的操作系统的状态为后台运行。
客户机操作系统由中断唤醒,该中断由宿主机的操作系统发起。客户机运行有切换进程,所述切换进程根据客户机和客户机操作系统当前的状态以及接收到的中断执行切换。
具体的,客户机提供虚拟的硬件环境供虚拟的操作系统和应用软件运行,这些硬件环境包括虚拟的中央处理器和虚拟的中断控制器。虚拟的中央处理器用来执行虚拟机的机器码。虚拟的中断控制器用来检测、管理和发起客户机的中断,中断控制器可以使能或者禁止中断,虚拟中断是虚拟中央处理器专属的中断。客户机会虚拟一个虚拟切换设备,该设备可通过向虚拟中断控制器申请一个虚拟中断源获得一个虚拟中断。
虚拟切换设备的一种实现方式是,基于模拟寄存器判断切换请求是否合法。其提供4个虚拟寄存器,如表1所示,其中寄存器1-3用于响应其他操作系统发起的请求该客户机操作系统切换到前台的切换请求,寄存器4用于输出当前操作系统切换到后台的请求。
寄存器1 切换请求中断控制寄存器
寄存器2 切换请求中断状态寄存器
寄存器3 切换请求中断源寄存器
寄存器4 切换请求寄存器
表1寄存器说明示意图
切换请求中断控制寄存器(寄存器1)控制虚拟中断的使能,该寄存器可基于通信由云端服务器设置或与云端服务器通信获取,可以由客户机自身设置,也可以由宿主机设置;切换请求中断状态寄存器(寄存器2)保存虚拟中断的请求记录,通常保存最新的虚拟中断请求;切换请求中断源寄存器(寄存器3)来存储切换请求的来源,即切换是由宿主机发起还是另一个客户机发起的,存储所述切换请求的来源的信息。切换请求寄存器(寄存器4)用于发起当前客户机切换到后台的请求,该寄存器分为两个域(位段),切换请求域和返回状态域,其中切换请求域表明发送了前述切换请求,返回状态域用于保存该次切换请求的成功或者失败的结果(即当当前客户机处于前台运行时,用户若希望将当前运行的客户机切换为后台运行,并将其他客户机切换为前台运行时,将由寄存器4发起中断)。
客户机操作系统具有针对该虚拟切换设备的驱动程序,提供读写寄存器和响应中断的功能。客户机实现虚拟中断的架构示意图如图3所示,当客户机接收到宿主机或者其他客户机发起的切换请求时,虚拟切换设备的驱动程序操作寄存器1、2、3进行响应。具体的,当宿主机或者其他客户机的操作系统发起切换请求时,当前的客户机在收到切换请求后,将切换请求存储于寄存器2中,将切换请求的来源存储于寄存器3中。之后根据寄存器1中的数值判断客户机的切换中断是否使能,如果中断已经使能,那么才可能触发寄存器2中的中断;客户机对应的操作系统运行切换进程,在收到中断之后被唤醒,运行虚拟设备驱动程序,响应寄存器2中的中断请求,根据寄存器3中的数据判断切换请求中断的来源是否合法,例如可限制安全性级别较低的客户机向安全性级别较高的客户机切换,以此实现多个操作系统之间可编程 的方式控制系统切换的方向或者禁止系统进行切换。
当同时满足中断使能,以及中断来源(本实施例中终端来源为宿主机)合法时,客户机操作系统响应宿主机操作系统发起的切换请求,独占嵌入式系统中所有的输入输出设备,切换为前台运行状态。
反之,当客户机处于前台运行状态,希望切换为宿主机处于前台运行的状态时,切换的过程与上述切换方式相似,不同之处在于,宿主机操作系统可由客户机通过事件唤醒而无需通过中断唤醒。
实施例三:
基于同一发明构思,本发明实施例中还提供了一种虚拟机切换装置,由于这些装置解决问题的原理与虚拟机切换方法相似,因此这些装置的实施可以参见方法的实施,重复之处不再赘述。图4示出了本发明实施例三中虚拟机切换装置的结构示意图,如图所示,所述装置400包括:
接收模块401,用于接收切换请求,所述切换请求包括发起所述切换请求的源虚拟机的信息;
判断模块402,用于根据所述源虚拟机的信息判断所述切换请求合法;
切换模块403,用于将所属的虚拟机由非前台运行状态切换为前台运行状态。
优选的,所述接收模块401,还用于从云端服务器获取所属的虚拟机的切换使能标识,所述切换使能标识用于确定当前是否允许切换;
所述判断模块402,还用于在所述切换模块403将所属的虚拟机切换为前台运行状态之前,根据获取到的切换使能标识判断当前允许切换。
优选的,所述判断模块402,还用于在所述切换模块403将所属的虚拟机切换为前台运行状态之前,根据虚拟化系统安全状态和/或者预设允许切换时间段判断当前允许切换。
优选的,所述装置还包括:
存储模块,用于当所述判断模块402判断当前不允许切换时,存储所述 切换请求;
所述判断模块402,还用于延后预设时长判断是否允许切换。
优选的,所述判断模块402还用于,在所述切换模块403将所属的虚拟机切换为前台运行状态之前,确定所述源虚拟机已经完成交互任务。
优选的,所述切换请求是中断指令;所述判断模块402,具体用于基于模拟寄存器根据所述源虚拟机的信息判断所述切换请求是否合法。
优选的,所述所属的虚拟机为宿主机,所述非前台运行状态是指内核层处于后台运行状态,操作系统处于休眠状态。
实施例四:
基于同一发明构思,本发明实施例中还提供了一种虚拟机切换电子设备,由于其原理与虚拟机切换方法相似,因此其实施可以参见方法的实施,重复之处不再赘述。所述电子设备包括:显示器,存储器,一个或多个处理器;以及一个或多个模块,所述一个或多个模块被存储在所述存储器中,并被配置成由所述一个或多个处理器执行,所述一个或多个模块包括用于执行任一上述方法中各个步骤的指令。
实施例五:
基于同一发明构思,本发明实施例还提供了一种与包括显示器的电子设备结合使用的虚拟机切换计算机程序产品,由于其原理与虚拟机切换方法相似,因此其实施可以参见方法的实施,重复之处不再赘述。所述计算机程序产品包括计算机可读的存储介质和内嵌于其中的计算机程序机制,所述计算机程序机制包括用于执行任一前述方法中各个步骤的指令。
为了描述的方便,以上所述装置的各部分以功能分为各种模块分别描述。当然,在实施本发明时可以把各模块或单元的功能在同一个或多个软件或硬件中实现。
本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、 或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
尽管已描述了本发明的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本发明范围的所有变更和修改。

Claims (16)

  1. 一种虚拟机切换方法,其特征在于,所述方法包括:
    接收切换请求,所述切换请求包括发起所述切换请求的源虚拟机的信息;
    根据所述源虚拟机的信息判断所述切换请求合法;
    将所属的虚拟机由非前台运行状态切换为前台运行状态。
  2. 如权利要求1所述的方法,其特征在于,在所述将所属的虚拟机切换为前台运行状态之前,还包括:
    从云端服务器获取所属的虚拟机的切换使能标识,所述切换使能标识用于确定当前是否允许切换;
    根据获取到的切换使能标识判断当前允许切换。
  3. 如权利要求1所述的方法,其特征在于,在所述将所属的虚拟机切换为前台运行状态之前,还包括:
    根据虚拟化系统安全状态和/或者预设允许切换时间段判断当前允许切换。
  4. 如权利要求2或者3所述的方法,其特征在于,所述方法还包括:
    当判断当前不允许切换时,存储所述切换请求;
    延后预设时长判断是否允许切换。
  5. 如权利要求1所述的方法,其特征在于,在所述将所属的虚拟机切换为前台运行状态之前,还包括:
    确定所述源虚拟机已经完成交互任务。
  6. 如权利要求1所述的方法,其特征在于,所述切换请求是中断指令;
    所述根据所述源虚拟机的信息判断所述切换请求合法,包括:基于模拟寄存器根据所述源虚拟机的信息判断所述切换请求是否合法。
  7. 如权利要求1所述的方法,其特征在于,所述所属的虚拟机为宿主机,所述非前台运行状态是指内核层处于后台运行状态,操作系统处于休眠状态。
  8. 一种虚拟机切换装置,其特征在于,所述装置包括:
    接收模块,用于接收切换请求,所述切换请求包括发起所述切换请求的源虚拟机的信息;
    判断模块,用于根据所述源虚拟机的信息判断所述切换请求合法;
    切换模块,用于将所属的虚拟机由非前台运行状态切换为前台运行状态。
  9. 如权利要求8所述的装置,其特征在于:
    所述接收模块,还用于从云端服务器获取所属的虚拟机的切换使能标识,所述切换使能标识用于确定当前是否允许切换;
    所述判断模块,还用于在所述切换模块将所属的虚拟机切换为前台运行状态之前,根据获取到的切换使能标识判断当前允许切换。
  10. 如权利要求8所述的装置,其特征在于:
    所述判断模块,还用于在所述切换模块将所属的虚拟机切换为前台运行状态之前,根据虚拟化系统安全状态和/或者预设允许切换时间段判断当前允许切换。
  11. 如权利要求9或者10所述的装置,其特征在于,所述装置还包括:
    存储模块,用于当所述判断模块判断当前不允许切换时,存储所述切换请求;
    所述判断模块,还用于延后预设时长判断是否允许切换。
  12. 如权利要求8所述的装置,其特征在于:
    所述判断模块还用于,在所述切换模块将所属的虚拟机切换为前台运行状态之前,确定所述源虚拟机已经完成交互任务。
  13. 如权利要求8所述的装置,其特征在于,所述切换请求是中断指令;
    所述判断模块,具体用于基于模拟寄存器根据所述源虚拟机的信息判断所述切换请求是否合法。
  14. 如权利要求8所述的装置,其特征在于,所述所属的虚拟机为宿主机,所述非前台运行状态是指内核层处于后台运行状态,操作系统处于休眠状态。
  15. 一种电子设备,其特征在于,所述电子设备包括:
    显示器,存储器,一个或多个处理器;以及一个或多个模块,所述一个或多个模块被存储在所述存储器中,并被配置成由所述一个或多个处理器执行,所述一个或多个模块包括用于执行权利要求1-7中任一所述方法中各个步骤的指令。
  16. 一种与包括显示器的电子设备结合使用的计算机程序产品,所述计算机程序产品包括计算机可读的存储介质和内嵌于其中的计算机程序机制,所述计算机程序机制包括用于执行权利要求1-7中任一所述方法中各个步骤的指令。
PCT/CN2016/097516 2016-08-31 2016-08-31 虚拟机切换方法、装置、电子设备和计算机程序产品 WO2018039967A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201680002815.0A CN107003891A (zh) 2016-08-31 2016-08-31 虚拟机切换方法、装置、电子设备和计算机程序产品
PCT/CN2016/097516 WO2018039967A1 (zh) 2016-08-31 2016-08-31 虚拟机切换方法、装置、电子设备和计算机程序产品

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2016/097516 WO2018039967A1 (zh) 2016-08-31 2016-08-31 虚拟机切换方法、装置、电子设备和计算机程序产品

Publications (1)

Publication Number Publication Date
WO2018039967A1 true WO2018039967A1 (zh) 2018-03-08

Family

ID=59431087

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/097516 WO2018039967A1 (zh) 2016-08-31 2016-08-31 虚拟机切换方法、装置、电子设备和计算机程序产品

Country Status (2)

Country Link
CN (1) CN107003891A (zh)
WO (1) WO2018039967A1 (zh)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109284169A (zh) * 2018-09-10 2019-01-29 福建星瑞格软件有限公司 基于进程虚拟化的大数据平台进程管理方法及计算机设备
CN111367609A (zh) * 2020-03-06 2020-07-03 北京云创世联科技股份有限公司 一种基于智能桌面虚拟化idv架构的桌面切换方法
CN112433811A (zh) * 2020-11-19 2021-03-02 北京浪潮数据技术有限公司 虚拟硬盘更换方法、装置、设备、系统及可读存储介质
CN113835838A (zh) * 2021-09-27 2021-12-24 湖南小算科技信息有限公司 一种真机系统与虚拟机系统快速切换的方法
CN115297467A (zh) * 2022-07-13 2022-11-04 青岛海信移动通信技术股份有限公司 一种数据域切换方法、装置、终端设备和介质
CN115988129A (zh) * 2022-12-28 2023-04-18 天翼电信终端有限公司 一种双系统云安全手机wifi安全使用方法

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019119438A1 (zh) * 2017-12-22 2019-06-27 深圳前海达闼云端智能科技有限公司 一种操作系统屏幕锁定的方法、装置及电子设备
CN110018886B (zh) * 2017-12-29 2021-11-12 Oppo广东移动通信有限公司 应用状态切换方法和装置、电子设备、可读存储介质
WO2019213835A1 (zh) * 2018-05-08 2019-11-14 深圳前海达闼云端智能科技有限公司 客户操作系统唤醒方法、装置、电子设备及可读介质
CN113691628B (zh) * 2021-08-25 2023-08-01 北京百度网讯科技有限公司 任务切换方法和装置、系统、电子设备、计算机介质
CN114168211B (zh) * 2022-02-14 2022-05-20 麒麟软件有限公司 系统兼容时使Android应用与Linux锁屏机制关联的方法

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102033781A (zh) * 2011-01-27 2011-04-27 中标软件有限公司 虚拟机桌面系统切换方法
CN102110217A (zh) * 2009-12-28 2011-06-29 北京安码科技有限公司 一种通过虚拟机岗位轮换实现自动修复的方法
CN104598294A (zh) * 2015-01-07 2015-05-06 杨学仕 用于移动设备的高效安全的虚拟化方法及其设备
CN105022660A (zh) * 2015-07-07 2015-11-04 国鼎网络空间安全技术有限公司 一种虚拟机切换方法及系统
CN105704249A (zh) * 2016-04-18 2016-06-22 广州优达信息科技有限公司 一种复合云桌面系统

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9501644B2 (en) * 2010-03-15 2016-11-22 F-Secure Oyj Malware protection
CN102254120B (zh) * 2011-08-09 2014-05-21 华为数字技术(成都)有限公司 恶意代码的检测方法、系统及相关装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102110217A (zh) * 2009-12-28 2011-06-29 北京安码科技有限公司 一种通过虚拟机岗位轮换实现自动修复的方法
CN102033781A (zh) * 2011-01-27 2011-04-27 中标软件有限公司 虚拟机桌面系统切换方法
CN104598294A (zh) * 2015-01-07 2015-05-06 杨学仕 用于移动设备的高效安全的虚拟化方法及其设备
CN105022660A (zh) * 2015-07-07 2015-11-04 国鼎网络空间安全技术有限公司 一种虚拟机切换方法及系统
CN105704249A (zh) * 2016-04-18 2016-06-22 广州优达信息科技有限公司 一种复合云桌面系统

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109284169A (zh) * 2018-09-10 2019-01-29 福建星瑞格软件有限公司 基于进程虚拟化的大数据平台进程管理方法及计算机设备
CN109284169B (zh) * 2018-09-10 2022-10-25 福建星瑞格软件有限公司 基于进程虚拟化的大数据平台进程管理方法及计算机设备
CN111367609A (zh) * 2020-03-06 2020-07-03 北京云创世联科技股份有限公司 一种基于智能桌面虚拟化idv架构的桌面切换方法
CN112433811A (zh) * 2020-11-19 2021-03-02 北京浪潮数据技术有限公司 虚拟硬盘更换方法、装置、设备、系统及可读存储介质
CN112433811B (zh) * 2020-11-19 2023-12-22 北京浪潮数据技术有限公司 虚拟硬盘更换方法、装置、设备、系统及可读存储介质
CN113835838A (zh) * 2021-09-27 2021-12-24 湖南小算科技信息有限公司 一种真机系统与虚拟机系统快速切换的方法
CN115297467A (zh) * 2022-07-13 2022-11-04 青岛海信移动通信技术股份有限公司 一种数据域切换方法、装置、终端设备和介质
CN115988129A (zh) * 2022-12-28 2023-04-18 天翼电信终端有限公司 一种双系统云安全手机wifi安全使用方法

Also Published As

Publication number Publication date
CN107003891A (zh) 2017-08-01

Similar Documents

Publication Publication Date Title
WO2018039967A1 (zh) 虚拟机切换方法、装置、电子设备和计算机程序产品
US8117435B2 (en) Method and system for secured dynamic bios update
TWI616818B (zh) 用於系統管理請求之虛擬高特權模式
JP5861228B2 (ja) 仮想パーティションを監視するためのシステム、装置、プログラムおよび方法
US8151027B2 (en) System management mode inter-processor interrupt redirection
KR101920980B1 (ko) 멀티-운영 체제 디바이스들에 대한 액세스 격리
US8719560B2 (en) Virtual machine monitor bridge to bare-metal booting
US9026824B2 (en) Establishing power save mode in hypervisor system
US10146940B2 (en) Multiple hardware-separated computer operating systems within a single processor computer system to prevent cross-contamination between systems
US9864626B2 (en) Coordinating joint operation of multiple hypervisors in a computer system
US10948967B2 (en) Mobile device virtualization solution based on bare-metal hypervisor with optimal resource usage and power consumption
US9645625B2 (en) System and method for power management of computing devices in a virtual desktop infrastructure
US8417862B2 (en) Inter-virtual machine interrupt coalescing
TW201211894A (en) Virtual machine code injection
CN113826072B (zh) 系统管理模式中的代码更新
US9910677B2 (en) Operating environment switching between a primary and a secondary operating system
US20140245291A1 (en) Sharing devices assigned to virtual machines using runtime exclusion
US20150381766A1 (en) Application transfer system, application transfer method, terminal, and program
US10121001B1 (en) System and method for monolithic scheduling in a portable computing device using a hypervisor
TWI709081B (zh) 電子裝置及其快速開機方法
US11768696B2 (en) Security for microengine access
WO2018119810A1 (zh) 多虚拟机切换过程中的上下文处理方法、装置及电子设备

Legal Events

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

Ref document number: 16914533

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

122 Ep: pct application non-entry in european phase

Ref document number: 16914533

Country of ref document: EP

Kind code of ref document: A1