WO2016090902A1 - 一种操作***热切换的方法、装置及移动终端 - Google Patents

一种操作***热切换的方法、装置及移动终端 Download PDF

Info

Publication number
WO2016090902A1
WO2016090902A1 PCT/CN2015/082859 CN2015082859W WO2016090902A1 WO 2016090902 A1 WO2016090902 A1 WO 2016090902A1 CN 2015082859 W CN2015082859 W CN 2015082859W WO 2016090902 A1 WO2016090902 A1 WO 2016090902A1
Authority
WO
WIPO (PCT)
Prior art keywords
operating system
hot plug
plug device
mobile terminal
hardware
Prior art date
Application number
PCT/CN2015/082859
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 EP15866553.9A priority Critical patent/EP3223151B1/en
Priority to KR1020177019225A priority patent/KR101941618B1/ko
Publication of WO2016090902A1 publication Critical patent/WO2016090902A1/zh
Priority to US15/620,291 priority patent/US10437631B2/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/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/445Program loading or initiating
    • 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/4401Bootstrapping
    • G06F9/4406Loading of operating system
    • G06F9/441Multiboot arrangements, i.e. selecting an operating system to be loaded
    • 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/4401Bootstrapping
    • G06F9/4411Configuring for operating with peripheral devices; Loading of device drivers
    • G06F9/4413Plug-and-play [PnP]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/5044Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering hardware capabilities
    • 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/542Event management; Broadcasting; Multicasting; Notifications

Definitions

  • the present invention relates to the field of computer technologies, and in particular, to a method, an apparatus, and a mobile terminal for operating system hot switching.
  • the current mobile terminal functions are more and more powerful, and more and more functions are supported. It can satisfy multiple operating systems running on one mobile terminal, but the mobile terminal can only be used exclusively by one operating system at the same time, so the current operating system is switched.
  • the method is multi-system cold switching, that is, only one operating system can be started at the same time. If it is necessary to switch to another operating system, the mobile terminal needs to be restarted. If you can boot multiple operating systems at the same time, and you can quickly switch between the two operating systems, you can take the value of multiple operating systems and user experience to a new level, which will attract more users.
  • a mobile terminal has only one set of hardware resources, the hardware resources are hardware resources for interacting with the outside in the mobile terminal; hardware resources for interacting with the outside, such as: display, audio and video, Bluetooth, wireless fidelity (wireless fidelity, Wifi), Global Positioning System (GPS), Universal Serial Bus (USB), Secure Digital (SD) card, etc., currently running multiple operating systems
  • multiple operating systems often use the same hardware resource at the same time, resulting in abnormal use of hardware resources or even damaging hardware resources.
  • multiple operating systems cannot interact with hardware resources of mobile terminals. Reject access and coordinate use.
  • the embodiment of the invention provides a method for hot switching of an operating system, which can ensure the exclusive access and coordinated use of hardware resources by multiple operating systems to a certain extent, thereby ensuring the reliability of the use of hardware resources after the operating system is switched.
  • the embodiments of the present invention also provide corresponding devices and mobile terminals.
  • a first aspect of the present invention provides a method for hot switching of an operating system, the method being applied to a mobile terminal running a plurality of operating systems, the plurality of operating systems including a foreground operating system, and at least one background operating system, each Each operating system corresponds to a resource management namespace, each resource The source management namespace includes operating state information of the operating system corresponding thereto, and the running state information is used to indicate that the operating system is a foreground operating system or a background operating system, and is used to indicate that the hardware in the mobile terminal is open to the foreground operation.
  • an operating system switching instruction where the operating system switching instruction includes an identifier of the second operating system and a switching identifier, where the identifier of the second operating system is used to indicate that the second operating system is switched to a foreground operating system;
  • the hardware resource is a hardware resource used by the mobile terminal to interact with the external device
  • the hardware resource occupied by the first operating system is released according to the switching identifier, where the hardware resource is used in the mobile terminal for external After the interactive hardware resources, the method further includes:
  • the releasing, by the switching identifier, the hardware resources occupied by the first operating system including:
  • the unblocking starting switching identifier is used to instruct the resource management thread to notify the hardware release station in the mobile terminal
  • the hardware resource occupied by the first operating system, the start switch identifier in the blocked state is used to indicate that execution of the operating system switch is prohibited.
  • the method further includes:
  • the unblocking start handover identifier is restored to a blocked state.
  • the performing the foreground operating system from the first operating system to After the switching of the second operating system the method further includes:
  • the in-position flag of the first hot plug device is cleared from the resource management namespace of the first operating system to release the first A binding relationship between the hot plug device and the first operating system, the in-position flag of the first hot plug device is used to indicate that the first hot plug device is used by the first operating system.
  • the method further includes:
  • a second aspect of the present invention provides a method for managing a hot plug device, the method being applied to a mobile terminal running a plurality of operating systems, wherein the mobile terminal provides a hot plug interface, and the hot plug device passes the The hot plug interface is hot swapped with the mobile terminal, and the multiple operating systems include a foreground operating system and at least one background operating system, and each operating system corresponds to a resource management namespace, and each resource management name is The space includes running status information of the operating system corresponding thereto, and the running status information is used to indicate that the operating system is a foreground operating system or a background operating system, and is used to indicate that the hardware in the mobile terminal is open to use by the foreground operating system. Or after shielding The use of the operating system, the hardware is the hardware for interacting with the outside, wherein the current foreground operating system is the first operating system, the at least one background operating system includes the second operating system, and the method includes :
  • the in-position flag of the first hot plug device is added in the resource management namespace of the first operating system to establish the first a binding relationship between the hot plugging device and the first operating system, where the in-position tag of the first hot plug device is used to indicate that the first hot plug device is used by the first operating system;
  • the in-position flag of the second hot plug device is cleared from the resource management namespace of the first operating system to release the The binding relationship between the hot plug device and the first operating system, and the in-position flag of the second hot plug device is used to indicate that the second hot plug device is used by the first operating system.
  • the method when the foreground operating system is from the first operating system to the second operating system, the method further includes:
  • the in-position flag of the first hot plug device is cleared in the resource management namespace of the first operating system to release the a binding relationship between the first hot plugging device and the first operating system, where the in-position tag of the first hot plug device is used to indicate that the first hot plug device is used by the first operating system ;
  • a third aspect of the present invention provides an apparatus for hot switching of an operating system, the apparatus being applied to a mobile terminal running a plurality of operating systems, the plurality of operating systems including a foreground operating system, and at least one background operating system, each Each operating system corresponds to a resource management namespace, and each resource management namespace includes running state information of the operating system corresponding thereto, and the running state information is used to indicate that the operating system is a foreground operating system or a background operating system, and Instructing the hardware in the mobile terminal to open the use of the foreground operating system or to block the use of the background operating system,
  • the hardware is the hardware for interacting with the outside, wherein the current foreground operating system is the first operating system, the at least one background operating system includes the second operating system, and the device includes:
  • An acquiring unit configured to acquire an operating system switching instruction, where the operating system switching instruction includes an identifier of the second operating system and a switching identifier, where the identifier of the second operating system is used to indicate that the second operating system is switched to Front operating system;
  • a releasing unit configured to release, according to the switching identifier acquired by the acquiring unit, a hardware resource occupied by the first operating system, where the hardware resource is a hardware resource used by the mobile terminal to interact with an external device;
  • a switching unit configured to: after the release unit releases the hardware resource, modify the running state information in the resource management namespace of the first operating system to a background state, and name the resource management of the second operating system The running state information in the space is modified to the foreground state, and the switching of the foreground operating system from the first operating system to the second operating system is completed.
  • the apparatus further includes:
  • a determining unit configured to determine, according to the identifier of the second operating system acquired by the acquiring unit, a resource management namespace of the second operating system from a resource global linked list, where the resource global linked list includes an identifier of the operating system The correspondence between the resource management namespaces of the operating system.
  • the releasing unit is configured to: according to the switching identifier, release the blocking state of the starting switching identifier in the blocked state, and obtain an unblocking start switching identifier, where the unblocking start switching identifier is used to indicate the resource management thread notification station
  • the hardware in the mobile terminal releases the hardware resources occupied by the first operating system, and the start switching identifier in the blocking state is used to indicate that the execution of the operating system switching is prohibited.
  • the apparatus further includes:
  • An allocating unit configured to allocate the hardware resource to the second operating system after the switching unit completes the switching of the foreground operating system from the first operating system to the second operating system;
  • a modifying unit configured to restore the unblocking start switching identifier to the blocking state after the allocating unit allocates the hardware resource to the second operating system.
  • the apparatus further includes:
  • a first monitoring unit configured to monitor a hot plug interface of the mobile terminal after the switching unit completes the switching of the foreground operating system from the first operating system to the second operating system;
  • a clearing unit configured to: when the first monitoring unit detects that the first hot plug device is unplugged from the mobile terminal, clear the first heat from a resource management namespace of the first operating system The in-position flag of the device is inserted and removed to release the binding relationship between the first hot plug device and the first operating system, and the in-position flag of the first hot plug device is used to indicate the first hot The plugging device is used by the first operating system.
  • the apparatus further includes:
  • a second monitoring unit configured to monitor a hot plug interface of the mobile terminal
  • adding a unit when the second monitoring unit detects that the second hot plug device is inserted into the mobile terminal, adding the second hot plug device to the resource management namespace of the second operating system a bit flag to establish a binding relationship between the second hot plug device and the second operating system, the in-position mark of the second hot plug device is used to indicate the second hot plug device for the The second operating system is used.
  • a fourth aspect of the present invention provides a device for managing a hot plug device, the device being applied to a mobile terminal running a plurality of operating systems, wherein the mobile terminal provides a hot plug interface, and the hot plug device passes the The hot plug interface is hot swapped with the mobile terminal, and the multiple operating systems include a foreground operating system and at least one background operating system, and each operating system corresponds to a resource management namespace, and each resource management name is The space includes running status information of the operating system corresponding thereto, and the running status information is used to indicate that the operating system is a foreground operating system or a background operating system, and is used to indicate that the hardware in the mobile terminal is open to use by the foreground operating system. Or shielding the use of the background operating system, where the hardware is the hardware for interacting with the outside, wherein the current foreground operating system is the first operating system, and the at least one background operating system includes the second operating system.
  • the device includes:
  • a monitoring unit configured to monitor a hot plug interface of the mobile terminal
  • Adding a unit when the monitoring unit detects that the first hot plug device is inserted into the mobile terminal, adding the first hot plug device in the resource management namespace of the first operating system a bit tag to establish a binding relationship between the first hot plug device and the first operating system, where the in-position mark of the first hot plug device is used to indicate the first hot plug device The first operating system is used;
  • a clearing unit configured to: when the monitoring unit detects that the second hot plug device is unplugged from the mobile terminal, clear the second hot plug device from the resource management namespace of the first operating system
  • the in-position flag is used to release the binding relationship between the second hot plug device and the first operating system, and the in-position flag of the second hot plug device is used to indicate that the second hot plug device is The first operating system is used.
  • the clearing unit is further configured to: after the foreground operating system moves from the first operating system to the second operating system, when the monitoring unit detects that the first hot plug device is pulled from the mobile terminal And clearing the in-position flag of the first hot plug device in the resource management namespace of the first operating system, to release the binding of the first hot plug device to the first operating system Relationship, the in-position mark of the first hot plug device is used to indicate that the first hot plug device is used by the first operating system;
  • the adding unit is further configured to: when the user-oriented operating system switches from the first operating system to the second operating system, when the monitoring unit detects that the second hot plug device inserts the mobile And adding, by the terminal, the in-position flag of the second hot plug device in the resource management namespace of the second operating system, to establish a binding between the second hot plug device and the second operating system
  • the in-place flag of the second hot plug device is used to indicate that the second hot plug device is for use by the second operating system.
  • a fifth aspect of the present invention provides a mobile terminal, where the mobile terminal includes a processor, a memory, and a hardware resource, where the hardware resource is a hardware resource used by the mobile terminal to interact with an external device, where the processor simultaneously Running multiple operating systems, including multiple foreground operating systems And at least one background operating system, each operating system corresponding to a resource management namespace, each resource management namespace includes running state information of an operating system corresponding thereto, and the running state information is used to indicate the operating system a foreground operating system or a background operating system, and configured to indicate that the hardware in the mobile terminal is open to use of the foreground operating system or to shield the use of the background operating system, wherein the hardware is the hardware for interacting with the outside, wherein the hardware is The current foreground operating system is a first operating system, and the at least one background operating system includes a second operating system.
  • processor is configured to:
  • an operating system switching instruction where the operating system switching instruction includes an identifier of the second operating system and a switching identifier, where the identifier of the second operating system is used to indicate that the second operating system is switched to a foreground operating system;
  • a sixth aspect of the present invention provides a mobile terminal, where the mobile terminal includes a processor, a memory, a hardware resource, and a hot plug interface, where the hardware resource is a hardware resource used by the mobile terminal to interact with the outside, and the hot plug
  • the device is hot swapped with the mobile terminal by using the hot plug interface
  • the processor runs multiple operating systems at the same time, the multiple operating systems include a foreground operating system, and at least one background operation
  • Each operating system corresponds to a resource management namespace, and each resource management namespace includes running state information of the operating system corresponding thereto, and the running state information is used to indicate that the operating system is a foreground operating system or a background operation.
  • a system configured to instruct the hardware in the mobile terminal to open the use of the foreground operating system or to shield the use of the background operating system, wherein the hardware is the hardware for interacting with the outside, wherein the current foreground operating system is a first operating system, the at least one background operating system includes a second operating system,
  • processor is configured to:
  • the in-position flag of the second hot plug device is cleared from the resource management namespace of the first operating system to release the The binding relationship between the hot plug device and the first operating system, and the in-position flag of the second hot plug device is used to indicate that the second hot plug device is used by the first operating system.
  • the method for hot switching of an operating system is applied to a mobile terminal running multiple operating systems, where the multiple operating systems include a foreground operating system and at least one background operating system, and each operating system corresponds to each a resource management namespace, each resource management namespace includes running state information of an operating system corresponding thereto, the running state information is used to indicate that the operating system is a foreground operating system or a background operating system, and is used to indicate the mobile
  • the hardware in the terminal is open to the use of the foreground operating system or shields the use of the background operating system, wherein the hardware is the hardware for interacting with the outside, wherein the current foreground operating system is the first operating system, and the at least A background operating system includes a second operating system, and the method includes: acquiring an operating system switching instruction, where the operating system switching instruction includes an identifier of the second operating system and a switching identifier, and the identifier of the second operating system is used for Instructing to switch the second operating system to the foreground operating system
  • the method for hot switching of the operating system may be used when the operating system is hot-switched.
  • the hardware resources occupied by the current foreground operating system are released, and the running status information in the resource management namespace indicates that the hardware resources shield the background operating system from accessing the hardware resources, and to some extent guarantees the operating resources of multiple operating systems.
  • Mutually exclusive access and coordinated use thus ensuring the reliability of the use of hardware resources after the operating system switch.
  • FIG. 1 is a schematic structural diagram of an operating system and hardware resources of a terminal in an embodiment of the present invention
  • FIG. 2 is a schematic diagram of another architecture of an operating system and hardware resources of a terminal in an embodiment of the present invention
  • FIG. 3 is a schematic diagram of another architecture of an operating system and hardware resources of a terminal in an embodiment of the present invention.
  • FIG. 4 is a schematic diagram of an embodiment of a method for hot switching of an operating system according to an embodiment of the present invention
  • FIG. 5 is a schematic diagram of another embodiment of a method for hot switching of an operating system according to an embodiment of the present invention.
  • FIG. 6 is a schematic diagram of another embodiment of a method for hot switching of an operating system according to an embodiment of the present invention.
  • FIG. 7 is a schematic diagram of an embodiment of a method for managing a hot plug device according to an embodiment of the present invention.
  • FIG. 8 is a schematic diagram of an embodiment of an apparatus for hot switching of an operating system according to an embodiment of the present invention.
  • FIG. 9 is a schematic diagram of another embodiment of an apparatus for hot switching of an operating system according to an embodiment of the present invention.
  • FIG. 10 is a schematic diagram of another embodiment of an apparatus for hot switching of an operating system according to an embodiment of the present invention.
  • FIG. 11 is a schematic diagram of another embodiment of an apparatus for hot switching of an operating system according to an embodiment of the present invention.
  • FIG. 12 is a schematic diagram of another embodiment of an apparatus for hot switching of an operating system according to an embodiment of the present invention.
  • FIG. 13 is a schematic diagram of an embodiment of an apparatus for managing a hot plug device according to an embodiment of the present invention.
  • FIG. 14 is a schematic diagram of an embodiment of a mobile terminal according to an embodiment of the present invention.
  • FIG. 15 is a schematic diagram of another embodiment of a mobile terminal according to an embodiment of the present invention.
  • the embodiment of the invention provides a method for hot switching of an operating system, which can ensure mutual access and coordinated use of hardware resources by a plurality of operating systems to a certain extent, thereby ensuring reliability of use of hardware resources after operating system switching.
  • the embodiments of the present invention also provide corresponding devices and mobile terminals. The details are described below separately.
  • FIG. 1 is a schematic diagram of a principle of an operating system and a hardware resource architecture of a mobile terminal according to an embodiment of the present invention, where:
  • the mobile terminal can simultaneously run multiple operating systems, such as: operating system 1, operating system 2, until the operating system n, n is an integer greater than 2, and multiple operating systems included in the mobile terminal are time-multiplexed, in one Only one operating system can run in the foreground during the time period, and other operating systems run in the background. As shown in FIG. 1, the operating system 1 is a foreground operating system, and the operating system 2 is until the operating system n is a background operating system.
  • the foreground operating system in the embodiment of the present invention is an operating system running in the foreground, an operating system that can interact with the user, and the background operating system is an operating system running in the background, and cannot interact with the user.
  • the hardware resources of the mobile terminal include the internal hardware resources of the mobile terminal, and the hot plug hardware resources that are connected to the mobile terminal through the hot plug interface.
  • the hardware resources in the embodiment of the present invention are used to interact with the outside in the mobile terminal.
  • Hardware resources, internal hardware resources may include mobile terminal wifi module, Bluetooth module, Near Field Communication (NFC) module, audio module, video module, display screen, camera and other hardware resources that can interact with the outside
  • hot Plug and play hardware resources may include USB devices connected via a Universal Serial Bus (USB) interface, Secure Digital (SD) cards, and connected via an On-The-Go (OTG) interface. OTG devices and the like are all hot plug hardware resources.
  • FIG. 2 is another schematic diagram of an operating system and a hardware resource architecture of a mobile terminal according to an embodiment of the present invention, where:
  • an internal resource management service for the operating system is maintained at the software level.
  • resource management service programs such as wifi, NFC, and Bluetooth.
  • the internal resource management service corresponding to the operating system 1 is started, and when the operating system 2 to the operating system n are only running in the background, the internals corresponding to the operating system 2 to the operating system n The resource management service is blocked.
  • each internal resource management service has its corresponding resource management thread group.
  • the internal resource management service and resources corresponding to the operating system 1 are The management thread is in the startup state, other operating systems are only running in the background, and the internals corresponding to other operating systems Both the resource management service and the resource management thread are blocked.
  • the resource management namespace corresponding to each operating system is maintained in the kernel, and each resource management namespace includes running state information of the operating system corresponding thereto, and the running state information is used to indicate that the operating system is a foreground operation.
  • a system or a background operating system and is used to indicate that the hardware in the mobile terminal is open to the use of the foreground operating system or to shield the use of the background operating system, for example, the operating system 1 in the resource management namespace of the operating system 1 in FIG.
  • Status The foreground indicates that the operating system 1 is the foreground operating system and the internal hardware resource usage status: available, indicating that the operating system 1 can use internal hardware resources.
  • the resource management thread reads the state of the operating system 1 in the resource management namespace 1 as the foreground, the resource management thread corresponding to the operating system 1 is started, and the resource management thread corresponding to other operating systems is blocked.
  • the internal resource management service corresponding to the operating system 1 is also started, and the internal resource management services corresponding to other operating systems are blocked.
  • the resource management thread When the operating system 1 is the foreground operating system, the resource management thread will allow the operating system 1 to call internal hardware resources, and other operating systems run in the background, and the resource management thread will block other operating system calls to internal hardware resources. It implements the mutual exclusion of hardware resources by multiple operating systems.
  • the operating system hot-switching process of the embodiment of the present invention can be understood by referring to FIG. 3:
  • the embodiment of the present invention is described by using an implementation scheme of an Android mobile phone based on a Linux kernel.
  • the android mobile operating system is a Linux Kernel-based hierarchical smart phone operating system, which is divided into five layers, from top to bottom. Java Application, Frameworks, User Libraries, Linux Kernel, and Hardware Layer.
  • an operating system switching interface (SystemSwitch) is set at the application layer, which is an entry point of the operating system switching, and exists in the form of an Android installation package (AndroidPackage, APK) on the desktop of the mobile terminal, and after clicking the APK, Provide users with an interface for operating system switching.
  • SystemSwitch an operating system switching interface
  • the operating system starts up with each internal resource manager, and the current foreground operating system is obtained by the kernel recording the identifier of the foreground operating system of the resource management namespace, so that the current foreground operating system can use the internal operating system normally.
  • Hardware resources the background operating system cannot use internal hardware resources, and on the other hand, monitors the switching events sent by the operating system switching APK.
  • the current foreground operating system receives the switching event, it first releases the internal hardware resources occupied by the operating system and notifies the kernel.
  • the kernel ensures that all internal hardware resources are released before the operating system is switched.
  • the external resource management service is set up for the hot plug hardware resources, and the service is modified.
  • the hot plug device sent by the kernel is inserted into the Uevent message to intercept and receive the hot.
  • the plug-in device inserts a message, the current foreground operating system is read.
  • the current foreground operating system is bound to the hot-plugged device, and the operating system in the background is shielded.
  • the hot-plugged device sent by the kernel is extracted and the Uevent message is intercepted. Block the operating system that is not bound to the hot-swappable device.
  • a node that needs to be used by multiple operating systems is set up in the kernel layer, and a corresponding node interface is provided, for example, an interface for obtaining the current foreground operating system, an interface for determining whether the operating system is currently being switched, or the like.
  • Step 1 After the mobile terminal is powered on, a foreground operating system is automatically started, for example, operating system 1. After the operating system 1 is started, each resource management thread corresponding to the operating system 1 reads the operating system of the resource management space of the operating system 1. State information and internal hardware resources are used in a delicate system. Open operating system 1 calls for internal hardware resources. The resource management thread calls the start switch node of the kernel. At this time, there is no switch event input, and the switch node is started as a blocked node.
  • Step 2 The user selects to switch the operating system 2 to the foreground through the System Switch on the desktop. This action invokes the switching interface provided by the kernel to notify the kernel operating system of the switching event.
  • Step 3 The kernel receives the switching event sent by the upper layer APK, and releases the start switching node of all resource management threads.
  • Step 4 After the kernel notifies each thread that the operating system switch starts, it enters a wait state and waits for each resource management thread to feedback the release of resources.
  • Step 5 The resource management thread is blocked, starts working, and starts to release the internal hardware resources currently occupied.
  • Step 6 After the release of the hardware resource is completed, the interface provided by the kernel, such as the NFC resource release completion interface, is notified to notify the kernel that the resource monitored by the current thread has been released.
  • the interface provided by the kernel such as the NFC resource release completion interface
  • Step 7 When the resource management thread returns to the kernel, the resource has been released and then enters the blocking state again, waiting for the kernel to notify the system that the handover is completed.
  • Step 8 After the kernel detects that all the resource management threads have returned all the internal hardware resources monitored by the kernel, the current waiting state is released, and the management threads of each management thread are notified to complete the handover.
  • Step 9 The resource management thread is blocked and started to work.
  • the operating system 2 that is switched to the foreground is called to call the internal resources, and re-enters the blocking state, waiting for the next handover.
  • the operating system 1 state in the resource management namespace of the operating system 1 is modified to the background, and the internal hardware resource usage state of the operating system 1 is modified to be disabled. Modify the operating system 2 state in the resource management namespace of the operating system 2 to the foreground, and modify the internal hardware resource usage state of the operating system 2 to be available.
  • the present invention is described by taking an example of a process of managing internal hardware resources by multiple operating systems running on a Linux kernel based on a Linux kernel, which can be understood by referring to FIG. 5:
  • the insertion process of the hot plug device is as follows:
  • Step 1 The user inserts the hot plug device A into the phone.
  • Step 2 The kernel detects that the hot plug device A has been inserted, and sends a Uevent message to the hot plug device A manager of each operating system (the external resource management service of the framework layer in FIG. 3).
  • Step 3 After the hot plug device A manager receives the Uevent message inserted by the hot plug device A sent by the kernel, it determines whether the operating system of the current hot plug device A manager is the background operating system or the background operating system: if it is the background The operating system returns directly to mask this Uevent message; if it is a background operating system, go to step 4.
  • Step 4 After receiving the insertion message of the hot plug device A, the foreground operating system adds the in-position state of the current hot plug device A, and then allows the manager of the peripheral A to continue processing the Uevent message, and then hot plugs the device.
  • A is bound to the currently active operating system and can be used normally by the current system. Even if a system switch occurs, it will not be unbound with the bound system.
  • the hot swap device is pulled out as follows:
  • Step 5 The user pulls the hot plug device A out of the phone.
  • Step 6 The kernel detects that the hot plug device A has been unplugged and sends a Uevent message to the manager of the hot plug device A of each operating system.
  • Step 7 After the hot plug device A of the hot plug device A receives the Uevent message sent by the kernel, it determines whether the hot plug device A of the operating system where the current manager is located is in place: if not, Return directly, mask this Uevent message; if it is in place, go to step 8.
  • Step 8 After the hot-swappable device A receives the hot-plug device A pull-out message, the hot-swappable device A's in-position flag is cleared, and then the hot-swappable device A manager is allowed to continue processing. After the Uevent message, the manager of the hot plug device A is unbound from the originally bound system. After reinsertion, it can be bound to the current foreground operating system and used by the current foreground operating system.
  • the in-place mark can be maintained in the resource management space of each operating system.
  • the method for hot switching of the operating system provided by the embodiment of the present invention may be used when the operating system is hot-switched.
  • the hardware resources occupied by the current foreground operating system are released, and the running status information in the resource management namespace indicates that the hardware resources shield the background operating system from accessing the hardware resources, and to some extent guarantees the operating resources of multiple operating systems.
  • Mutually exclusive access and coordinated use thus ensuring the reliability of the use of hardware resources after the operating system switch.
  • the method for hot-switching of the operating system provided by the embodiment of the present invention can ensure that the internal hardware resources occupied by the foreground operating system before the handover are completed after the hot-switching of the multiple systems running by the mobile terminal, and can be guaranteed after switching to the foreground operating system.
  • the internal hardware resources are normally used by the switched operating system to prevent probabilistic individual resources from being abnormal due to preemptive use.
  • a method for hot switching of an operating system is applied to a mobile terminal running multiple operating systems, where the multiple operating systems include a foreground operating system and at least one background.
  • Each operating system corresponds to a resource management namespace, and each resource management namespace includes running state information of the operating system corresponding thereto, and the running state information is used to indicate that the operating system is a foreground operating system or a background.
  • Operating system and used to refer to The hardware in the mobile terminal is used to open the use of the foreground operating system or to shield the use of the background operating system, where the hardware is the hardware for interacting with the outside, wherein the current foreground operating system is the first operating system.
  • the at least one background operating system includes a second operating system, and the method includes:
  • the operating system switching instruction includes an identifier of the second operating system and a switching identifier, where the identifier of the second operating system is used to indicate that the second operating system is switched to a foreground operating system.
  • the method for hot switching of an operating system is applied to a mobile terminal running multiple operating systems, where the multiple operating systems include a foreground operating system and at least one background operating system, and each operating system corresponds to each a resource management namespace, each resource management namespace includes running state information of an operating system corresponding thereto, the running state information is used to indicate that the operating system is a foreground operating system or a background operating system, and is used to indicate the mobile
  • the hardware in the terminal is open to the use of the foreground operating system or shields the use of the background operating system, wherein the hardware is the hardware for interacting with the outside, wherein the current foreground operating system is the first operating system, and the at least A background operating system includes a second operating system, and the method includes: acquiring an operating system switching instruction, where the operating system switching instruction includes an identifier of the second operating system and a switching identifier, and the identifier of the second operating system is used for Instructing to switch the second operating system to the foreground operating system
  • Modifying the running state information in the background state modifying the running state information in the resource management namespace of the second operating system to the foreground state, and completing the foreground operating system from the first operating system to the second Switching of the operating system.
  • multiple operating systems often appear in the prior art.
  • the hardware resource usage of the operating system is released.
  • the hardware resources occupied by the current foreground operating system are released first.
  • the running status information in the resource management namespace indicates that the hardware resource shields the background operating system from accessing the hardware resources, and ensures the exclusive access and coordinated use of the hardware resources by multiple operating systems to a certain extent, thereby ensuring the operating system switching.
  • the reliability of the use of hardware resources is provided.
  • the resource management namespace corresponding to each operating system is maintained through the resource global linked list, which can speed up the hot switching of the operating system.
  • the switching identifier is used to release the hardware resources occupied by the first operating system, which may include:
  • the hardware releases the hardware resources occupied by the first operating system, and the starting switch identifier in the blocked state is used to indicate that the operating system switching is prohibited.
  • the switch identifier is used to release the hardware to indicate that the hardware resources are released.
  • the method may further include:
  • the unblocking start handover identifier is restored to a blocked state.
  • the unblocking start switch identifier is restored to the blocked state in time, thereby further improving the mutual exclusion of the use of hardware resources by multiple operating systems.
  • the method may further include:
  • the in-position flag of the first hot plug device is cleared from the resource management namespace of the first operating system to release the first A binding relationship between the hot plug device and the first operating system, the in-position flag of the first hot plug device is used to indicate that the first hot plug device is used by the first operating system.
  • the hot swap device can release the binding relationship with the operating system before the switching, and ensure the mutual exclusion of the hot swap device by multiple operating systems.
  • the fifth optional method of the operating system hot switching provided by the embodiment of the present invention is provided on the basis of the foregoing embodiment, the first, the second, the third, or the fourth alternative embodiment.
  • the method may further include:
  • the hot swap device can establish a binding relationship with the switched operating system, thereby ensuring the mutual exclusion of the hot swap device by multiple operating systems.
  • a method for managing a hot plug device is applied to a mobile terminal running a plurality of operating systems, where the mobile terminal provides a hot plug interface, and the hot plug device passes the hot
  • the plugging interface is hot swapped with the mobile terminal
  • the multiple operating systems include a foreground operating system and at least one background operating system, each operating system corresponding to a resource management namespace, and each resource management namespace And including the running status information of the operating system corresponding to the operating system, where the operating status information is used to indicate that the operating system is a foreground operating system or a background operating system, and is used to indicate that the hardware in the mobile terminal is open to use by the foreground operating system or Shielding the use of the background operating system, wherein the hardware is the hardware for interacting with the outside, wherein the current foreground operating system is the first operating system, and the at least one background operating system includes the second operating system,
  • Methods include:
  • the method for managing the hot plug device is applied to a mobile terminal running a plurality of operating systems, where the mobile terminal provides a hot plug interface, and the hot plug device passes the hot plug interface.
  • the mobile terminal is hot swappable, and the multiple operating systems include a foreground operating system and at least one background operating system, each operating system corresponding to a resource management namespace, and each resource management namespace includes a corresponding Running status information of the operating system, the running status information is used to indicate that the operating system is a foreground operating system or a background operating system, and is used to indicate that the hardware in the mobile terminal is open to use of the foreground operating system or to block the background operation.
  • the hardware is the hardware for interacting with the outside, wherein the current foreground operating system is the first operating system, the at least one background operating system includes the second operating system, and the method includes: monitoring the a hot plug interface of the mobile terminal; when it is detected that the first hot plug device is inserted into the mobile terminal, adding the first hot plug device in the resource management namespace of the first operating system Marking, to establish a binding relationship between the first hot plug device and the first operating system, where the in-position mark of the first hot plug device is used to indicate that the first hot plug device is used by the first hot plug device Used by the first operating system; when it is detected that the second hot plug device is unplugged from the mobile terminal, the in-place flag of the second hot plug device is cleared from the resource management namespace of the first operating system The binding relationship between the second hot plug device and the first operating system is released, and the in-position flag of the second hot plug device is used to indicate the second hot plug device for the first Used by an operating system.
  • the method for managing the hot plug device may bind the hot plug device to the current operating system or the current operating system may be compared with the use of the hot swap device in the prior art. Unbind, which avoids conflicts between multiple operating systems on hot-swappable devices and ensures the mutual exclusion of multiple operating systems for hot-swappable devices.
  • the method when the foreground operating system is from the first operating system to the foregoing operating system, the method may further include:
  • the in-position flag of the first hot plug device is cleared in the resource management namespace of the first operating system to release the a binding relationship between the first hot plugging device and the first operating system, where the in-position tag of the first hot plug device is used to indicate that the first hot plug device is used by the first operating system ;
  • the hot-swappable device can establish a binding relationship with the switched operating system, thereby ensuring the mutual exclusion of multiple operating systems for the hot-swappable device.
  • an apparatus 30 for operating system hot switching is applied to a mobile terminal running multiple operating systems, where the multiple operating systems include a foreground operating system and at least one background.
  • Each operating system corresponds to a resource management namespace, and each resource management namespace includes running state information of the operating system corresponding thereto, and the running state information is used to indicate that the operating system is a foreground operating system or a background.
  • An operating system configured to instruct the hardware in the mobile terminal to open the use of the foreground operating system or to shield the use of the background operating system, wherein the hardware is the hardware for interacting with the outside, wherein the current foreground operating system
  • the at least one background operating system includes a second operating system
  • the device 30 includes:
  • the obtaining unit 301 is configured to acquire an operating system switching instruction, where the operating system switching instruction includes an identifier of the second operating system and a switching identifier, where the identifier of the second operating system is used to indicate that the second operating system is to be switched For the foreground operating system;
  • the releasing unit 302 is configured to release the hardware resources occupied by the first operating system according to the switching identifier acquired by the acquiring unit 301, where the hardware resource is a hardware resource used by the mobile terminal to interact with the outside;
  • the switching unit 303 is configured to: after the release unit 302 releases the hardware resource, modify the running state information in the resource management namespace of the first operating system to a background state, and use the resource of the second operating system The running state information in the management namespace is modified to the foreground state, and the switching of the foreground operating system from the first operating system to the second operating system is completed.
  • the apparatus 30 for operating system hot switching is applied to a mobile terminal running multiple operating systems, where the multiple operating systems include a foreground operating system and at least one background operating system.
  • Each operating system corresponds to a resource management namespace, and each resource management namespace includes running state information of the operating system corresponding thereto, and the running state information is used to indicate that the operating system is a foreground operating system or a background operating system, and Instructing the hardware in the mobile terminal to open the use of the foreground operating system or to shield the use of the background operating system, the hardware being the hardware for interacting with the outside, wherein the current foreground operating system is the first operation
  • the system, the at least one background operating system includes a second operating system, and the device 30 includes: the obtaining unit 301 acquires an operating system switching instruction, and the operating system switching instruction includes the second operating system
  • the identifier of the second operating system is used to indicate that the second operating system is switched to the foreground operating system; the releasing unit 302 releases the first operation according to the
  • the device is hot-switched by the operating system.
  • the hardware resources occupied by the current foreground operating system are released, and the running status information in the resource management namespace indicates that the hardware resources shield the background operating system from accessing the hardware resources, and to some extent guarantees the operating resources of multiple operating systems.
  • Mutually exclusive access and coordinated use thus ensuring the reliability of the use of hardware resources after the operating system switch.
  • the device 30 further includes:
  • a determining unit 304 configured to determine, according to the identifier of the second operating system acquired by the acquiring unit 301, a resource management namespace of the second operating system from a resource global linked list, where the resource global linked list includes an operating system Identifies the correspondence with the resource management namespace of the operating system.
  • the resource management namespace corresponding to each operating system is maintained through the resource global linked list, which can speed up the hot switching of the operating system.
  • the releasing unit 302 is specifically configured to: according to the switching identifier, release the blocking state of the starting switching identifier in the blocked state, and obtain an unblocking start switching identifier, where the unblocking start switching identifier is used to indicate the resource management thread notification
  • the hardware in the mobile terminal releases the hardware resources occupied by the first operating system, and the start switching identifier in the blocked state is used to indicate that the execution of the operating system switching is prohibited.
  • the switch identifier is removed from the beginning of the unblocking to indicate that the hardware resource is released, and the The efficiency of hardware resource release.
  • the device 30 further includes:
  • the allocating unit 305 is configured to allocate the hardware resource to the second operating system after the switching unit 303 completes the switching of the foreground operating system from the first operating system to the second operating system. ;
  • the modifying unit 306 is configured to restore the unblocking start switching identifier to the blocking state after the allocating unit 305 allocates the hardware resource to the second operating system.
  • the unblocking start switch identifier is restored to the blocked state in time, thereby further improving the mutual exclusion of the use of hardware resources by multiple operating systems.
  • the embodiment of the present invention provides in a fourth alternative embodiment of the apparatus 30 for operating system hot swap, the apparatus 30 further includes:
  • a first monitoring unit 307 configured to monitor a hot plug interface of the mobile terminal after the switching unit 303 completes the switching of the foreground operating system from the first operating system to the second operating system;
  • the clearing unit 308 is configured to: when the first monitoring unit 307 detects that the first hot plug device is pulled out from the mobile terminal, clear the first part from a resource management namespace of the first operating system An in-position flag of a hot plug device to release a binding relationship between the first hot plug device and the first operating system, where the in-position flag of the first hot plug device is used to indicate the A hot plug device is used by the first operating system.
  • the hot swap device can release the binding relationship with the operating system before the switching, and ensure the mutual exclusion of the hot swap device by multiple operating systems.
  • the device 30 further includes:
  • a second monitoring unit 309 configured to monitor a hot plug interface of the mobile terminal
  • the adding unit 311 is configured to add the second hot plug in the resource management namespace of the second operating system when the second monitoring unit 309 detects that the second hot plug device is inserted into the mobile terminal.
  • the in-position tag of the device is used to establish a binding relationship between the second hot plug device and the second operating system, and the in-position tag of the second hot plug device is used to indicate that the second hot plug device is available The second operating system is used.
  • the hot swap device can establish a binding relationship with the switched operating system, thereby ensuring the mutual exclusion of the hot swap device by multiple operating systems.
  • the apparatus 30 for hot-switching of the operating system provided by the embodiment of the present invention can be understood by referring to the description in the parts of FIG. 1 to FIG. 6 , and no further description is made herein.
  • a device 40 for managing a hot-swappable device is applied to a mobile terminal running a plurality of operating systems, where the mobile terminal provides a hot plug interface, and the hot plug device passes The hot plug interface is hot swapped with the mobile terminal, and the multiple operating systems include a foreground operating system and at least one background operating system, and each operating system corresponds to a resource management namespace, and each resource
  • the management namespace includes running status information of the operating system corresponding thereto, and the running status information is used to indicate that the operating system is a foreground operating system or a background operating system, and is used to indicate that the hardware in the mobile terminal is open to the foreground operating system.
  • the device 40 includes:
  • a monitoring unit 401 configured to monitor a hot plug interface of the mobile terminal
  • the adding unit 402 is configured to: when the monitoring unit 401 detects that the first hot plug device is inserted into the mobile terminal, add the first hot plug device in a resource management namespace of the first operating system.
  • the in-position flag is used to establish a binding relationship between the first hot plug device and the first operating system, and the in-position flag of the first hot plug device is used to indicate the first hot plug device Used by the first operating system;
  • a clearing unit 403 configured to: when the monitoring unit 401 detects the second hot plugging device from the moving If the terminal is unplugged, the in-position flag of the second hot plug device is cleared from the resource management namespace of the first operating system to release the second hot plug device from the first operating system. a binding relationship, the in-place flag of the second hot plug device is used to indicate that the second hot plug device is used by the first operating system.
  • the apparatus 40 for managing hot-swappable devices is applied to a mobile terminal running a plurality of operating systems, wherein the mobile terminal provides a hot plug interface, and the hot plug device passes the hot plug
  • the interface is hot swappable with the mobile terminal
  • the multiple operating systems include a foreground operating system and at least one background operating system, each operating system corresponding to a resource management namespace, and each resource management namespace includes
  • the running status information of the operating system is used to indicate that the operating system is a foreground operating system or a background operating system, and is used to indicate that the hardware in the mobile terminal is open to use or shield the foreground operating system.
  • the hardware is the hardware for interacting with the outside, wherein the current foreground operating system is the first operating system, and the at least one background operating system includes the second operating system, the device 40 includes: a monitoring unit 401, configured to monitor a hot plug interface of the mobile terminal; adding a unit 402. When the monitoring unit 401 detects that the first hot plug device is inserted into the mobile terminal, adding the first hot plug device in the resource management namespace of the first operating system.
  • the clearing unit 403 is configured to: when the monitoring unit 401 detects that the second hot plug device is unplugged from the mobile terminal, clearing from the resource management namespace of the first operating system The in-position flag of the second hot plug device is used to release the binding relationship between the second hot plug device and the first operating system, and the in-position flag of the second hot plug device is used to indicate The second hot plug device is used by the first operating system.
  • the device for managing the hot plug device can bind the hot plug device to the current operating system or the device may be in conflict with the use of the hot plug device in the prior art. Unbind, which avoids conflicts between multiple operating systems on hot-swappable devices and ensures the mutual exclusion of multiple operating systems for hot-swappable devices.
  • the clearing unit 403 is further configured to: when the foreground operating system is from the first operating system to the second operating system, when the monitoring unit detects that the first hot plug device is from the mobile terminal
  • the in-position flag of the first hot plug device is cleared in the resource management namespace of the first operating system to release the binding of the first hot plug device to the first operating system.
  • the in-position flag of the first hot plug device is used to indicate that the first hot plug device is used by the first operating system;
  • the adding unit 402 is further configured to: when the user-oriented operating system switches from the first operating system to the second operating system, when the monitoring unit detects that the second hot plug device inserts the Adding, by the mobile terminal, the in-position flag of the second hot plug device in the resource management namespace of the second operating system, to establish the binding of the second hot plug device to the second operating system
  • the in-place flag of the second hot plug device is used to indicate that the second hot plug device is used by the second operating system.
  • the hot-swappable device can establish a binding relationship with the switched operating system, thereby ensuring the mutual exclusion of multiple operating systems for the hot-swappable device.
  • the apparatus for managing the hot-swappable device provided by the embodiment of the present invention can be understood by referring to the description in the parts of FIG. 5 and FIG. 7.
  • FIG. 14 illustrates a structure of a mobile terminal 600 according to an embodiment of the present invention.
  • the mobile terminal 600 includes at least one processor 601, at least one network interface 604 or other user interface 603, a memory 605, and at least one communication bus 602.
  • Communication bus 602 is used to implement connection communication between these components.
  • the mobile terminal 600 optionally includes a user interface 603, including a display (eg, a touch screen, LCD, CRT, Holographic or Projector, etc.), a keyboard or a pointing device (eg, a mouse, a trackball) , touch panel or touch screen, etc.).
  • a display eg, a touch screen, LCD, CRT, Holographic or Projector, etc.
  • a keyboard or a pointing device eg, a mouse, a trackball
  • Memory 605 can include read only memory and random access memory and provides instructions and data to processor 601. A portion of the memory 605 may also include non-volatile random access memory (NVRAM).
  • NVRAM non-volatile random access memory
  • the memory 605 stores the following elements, executable modules or data. Structures, or their subsets, or their extension set:
  • the operating system 6051 includes various system programs, such as the framework layer, the system runtime layer, the kernel layer, and the like shown in FIG. 3, for implementing various basic services and processing hardware-based tasks;
  • the application module 6052 includes various applications, such as the telephone, information, data connection, operating system switching interface, and the like shown in FIG. 3, for implementing various application services.
  • the processor 601 by calling a program or instruction stored in the memory 605, the processor 601 simultaneously runs a plurality of operating systems, the plurality of operating systems including a foreground operating system, and at least one background operating system, each operation
  • the system corresponds to a resource management namespace, and each resource management namespace includes running state information of the operating system corresponding thereto, and the running state information is used to indicate that the operating system is a foreground operating system or a background operating system, and is used to indicate
  • the hardware in the mobile terminal is open to the use of the foreground operating system or the use of the background operating system is blocked.
  • the hardware is the hardware for interacting with the outside, wherein the current foreground operating system is the first operating system.
  • the at least one background operating system includes a second operating system,
  • processor 601 is configured to:
  • an operating system switching instruction where the operating system switching instruction includes an identifier of the second operating system and a switching identifier, where the identifier of the second operating system is used to indicate that the second operating system is switched to a foreground operating system;
  • the method for hot switching of the operating system may be used when the operating system is hot-switched.
  • the hardware resources occupied by the current foreground operating system are released, and the running status information in the resource management namespace indicates that the hardware resources shield the background operating system from accessing the hardware resources, and to some extent guarantees the operating resources of multiple operating systems.
  • Mutually exclusive access and coordinated use thus ensuring the reliability of the use of hardware resources after the operating system switch.
  • the processor 601 is further configured to determine, according to the identifier of the second operating system, a resource management namespace of the second operating system from a resource global linked list, where the resource global linked list It includes the correspondence between the identifier of the operating system and the resource management namespace of the operating system.
  • the resource management namespace corresponding to each operating system is maintained through the resource global linked list, which can speed up the hot switching of the operating system.
  • the processor 601 is specifically configured to: according to the switching identifier, release a blocking state of a start switching identifier in a blocked state, and obtain an unblocking start switching identifier, where the unblocking starts to switch.
  • the identifier is used to instruct the resource management thread to notify the hardware in the mobile terminal to release the hardware resources occupied by the first operating system, where the start switch identifier in the blocked state is used to indicate that the execution of the operating system switch is prohibited.
  • the switch identifier is used to release the hardware to indicate that the hardware resources are released.
  • the processor 601 is further configured to: after the handover of the foreground operating system from the first operating system to the second operating system, allocate the hardware resource to the The second operating system uses; after the hardware resource is allocated to the second operating system, the unblocking start switching identifier is restored to a blocked state.
  • the unblocking start switch identifier is restored to the blocked state in time, thereby further improving the mutual exclusion of the use of hardware resources by multiple operating systems.
  • the processor 601 is further configured to monitor hot plugging of the mobile terminal after completing the handover of the foreground operating system from the first operating system to the second operating system. And removing the in-position mark of the first hot plug device from the resource management namespace of the first operating system to remove the first hot plug device from the mobile terminal a binding relationship between the first hot plug device and the first operating system, where the in-position tag of the first hot plug device is used to indicate that the first hot plug device is used by the first operating system .
  • the hot swap device can release the binding relationship with the operating system before the switching, and the mutual exclusion of the hot swap device by multiple operating systems is ensured. Sex.
  • the processor 601 is further configured to monitor hot plugging of the mobile terminal after completing the handover of the foreground operating system from the first operating system to the second operating system. Adding an in-position flag of the second hot plug device to the resource management namespace of the second operating system to detect the second hot plug device inserted into the mobile terminal The binding relationship between the hot plug device and the second operating system, and the in-position flag of the second hot plug device is used to indicate that the second hot plug device is used by the second operating system.
  • the hot swap device can establish a binding relationship with the switched operating system, thereby ensuring the mutual exclusion of the hot swap device by multiple operating systems.
  • the mobile terminal 600 can also perform the method and the embodiment of FIG. 1 to FIG. 6 , and details are not described herein again.
  • the mobile terminal provided by the embodiment of the present invention may first release the hardware resources occupied by the current foreground operating system when the operating system is hot-switched, and indicate the hardware resource shielding background operating system by using the running status information in the resource management namespace.
  • the access of hardware resources ensures the exclusive access and coordinated use of hardware resources by multiple operating systems to a certain extent, thereby ensuring the reliability of the use of hardware resources after the operating system is switched.
  • the mobile terminal implemented by the embodiment of the present invention implements a connection with a hot plug device through a hot plug interface, where the processor 601 runs multiple operating systems simultaneously, and the multiple operating systems include a foreground operating system, and At least one background operating system, each operating system corresponding to a resource management namespace, each resource management namespace includes operating state information of an operating system corresponding thereto, and the running state information is used to indicate that the operating system is a foreground operation a system or a background operating system, and configured to instruct the hardware in the mobile terminal to open the use of the foreground operating system or to shield the use of the background operating system, wherein the hardware is the hardware for interacting with the outside, wherein the current
  • the foreground operating system is a first operating system
  • the at least one background operating system includes a second operating system
  • the processor 601 is configured to:
  • the in-position flag of the first hot plug device is added in the resource management namespace of the first operating system to establish the first Hot a binding relationship between the plugging device and the first operating system, where the in-position tag of the first hot plug device is used to indicate that the first hot plug device is used by the first operating system;
  • the in-position flag of the second hot plug device is cleared from the resource management namespace of the first operating system to release the The binding relationship between the hot plug device and the first operating system, and the in-position flag of the second hot plug device is used to indicate that the second hot plug device is used by the first operating system.
  • the processor 601 is further configured to: when the foreground operating system is from the first operating system to the second operating system;
  • the in-position flag of the first hot plug device is cleared in the resource management namespace of the first operating system to release the a binding relationship between the first hot plugging device and the first operating system, where the in-position tag of the first hot plug device is used to indicate that the first hot plug device is used by the first operating system ;
  • the mobile device provided by the embodiment of the present invention can bind or unbind the hot-plugging device to the current operating system, thereby avoiding conflicts between multiple operating systems for hot-plugging devices, and ensuring multiple operating system pairs.
  • mutually exclusive use of hot-swappable devices can be used.
  • FIG. 15 is a block diagram showing a partial structure of a mobile terminal provided by an embodiment of the present invention.
  • the mobile terminal includes: a radio frequency (RF) circuit 710, a memory 720, an input unit 730, a display unit 740, a sensor 750, an audio circuit 760, a wireless fidelity (WiFi) module 770, and a processor. 780, and power supply 790 and other components.
  • RF radio frequency
  • the mobile terminal structure shown in FIG. 15 does not constitute a limitation of the mobile terminal, and may include more or less components than those illustrated, or combine some components, or different component arrangements.
  • the RF circuit 710 can be used for receiving and transmitting information during the transmission or reception of information or during a call. In particular, after receiving the downlink information of the base station, it is processed by the processor 780. In addition, the uplink data is designed to be sent. To the base station. Generally, RF circuit 710 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, and the like. In addition, RF circuitry 710 can also communicate with the network and other devices via wireless communication.
  • LNA Low Noise Amplifier
  • the above wireless communication may use any communication standard or protocol, including but not limited to Global System of Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (Code Division). Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), E-mail, Short Messaging Service (SMS), and the like.
  • GSM Global System of Mobile communication
  • GPRS General Packet Radio Service
  • CDMA Code Division Multiple Access
  • WCDMA Wideband Code Division Multiple Access
  • LTE Long Term Evolution
  • E-mail Short Messaging Service
  • the memory 720 can be used to store software programs and modules, and the processor 780 executes various functional applications and data processing of the mobile terminal by running software programs and modules stored in the memory 720.
  • the memory 720 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application required for at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may be stored according to Data created by the use of the mobile terminal (such as audio data, phone book, etc.).
  • memory 720 can include high speed random access memory, and can also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
  • the input unit 730 can be configured to receive input numeric or character information and to generate key signal inputs related to user settings and function control of the mobile terminal.
  • the input unit 730 may include a touch panel 731 and other input devices 732.
  • the touch panel 731 also referred to as a touch screen, can collect touch operations on or near the user (such as the user using a finger, a stylus, or the like on the touch panel 731 or near the touch panel 731. Operation), and drive the corresponding connecting device according to a preset program.
  • the touch panel 731 can include two parts: a touch detection device and a touch controller.
  • the touch detection device detects the touch orientation of the user, and detects a signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts the touch information into contact coordinates, and sends the touch information.
  • the processor 780 is provided and can receive commands from the processor 780 and execute them.
  • the touch panel 731 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves.
  • the input unit 730 may also include other input devices 732.
  • other input devices 732 may include, but are not limited to, physical keyboards, function keys (ratio One or more of a volume control button, a switch button, etc., a trackball, a mouse, a joystick, and the like.
  • the display unit 740 can be used to display information input by the user or information provided to the user as well as various menus of the mobile terminal.
  • the display unit 740 can include a display panel 741.
  • the display panel 741 can be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.
  • the touch panel 731 can cover the display panel 741. When the touch panel 731 detects a touch operation on or near the touch panel 731, it transmits to the processor 780 to determine the type of the touch event, and then the processor 780 according to the touch event. The type provides a corresponding visual output on display panel 741.
  • the touch panel 731 and the display panel 741 are two independent components to implement the input and input functions of the mobile terminal in FIG. 15, in some embodiments, the touch panel 731 can be integrated with the display panel 741. And realize the input and output functions of the mobile terminal.
  • the mobile terminal can also include at least one type of sensor 750, such as a light sensor, motion sensor, and other sensors.
  • the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 741 according to the brightness of the ambient light, and the proximity sensor may close the display panel 741 when the mobile terminal moves to the ear. / or backlight.
  • the accelerometer sensor can detect the magnitude of acceleration in all directions (usually three axes). When it is stationary, it can detect the magnitude and direction of gravity.
  • attitude of the mobile terminal such as horizontal and vertical screen switching, Related games, magnetometer attitude calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as well as other sensors such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., which can be configured in mobile terminals, No longer.
  • An audio circuit 760, a speaker 761, and a microphone 762 can provide an audio interface between the user and the mobile terminal.
  • the audio circuit 760 can transmit the converted electrical data of the received audio data to the speaker 761 for conversion to the sound signal output by the speaker 761; on the other hand, the microphone 762 converts the collected sound signal into an electrical signal by the audio circuit 760. After receiving, it is converted to audio data, processed by the audio data output processor 780, transmitted via the RF circuit 710 to, for example, another mobile terminal, or outputted to the memory 720 for further processing.
  • WiFi is a short-range wireless transmission technology
  • the mobile terminal can help users to send and receive emails, browse web pages, and access streaming media through the WiFi module 770, which provides wireless broadband Internet access for users.
  • FIG. 15 shows the WiFi module 770, it can be understood that it does not belong to The necessary configuration of the mobile terminal can be omitted as needed within the scope of not changing the essence of the invention.
  • Processor 780 is the control center of the mobile terminal, connecting various portions of the entire mobile terminal using various interfaces and lines, by running or executing software programs and/or modules stored in memory 720, and recalling data stored in memory 720.
  • the mobile terminal performs various functions and processing data to perform overall monitoring on the mobile terminal.
  • the processor 780 may include one or more processing units; preferably, the processor 780 may integrate an application processor and a modem processor, where the application processor mainly processes an operating system, a user interface, an application, and the like.
  • the modem processor primarily handles wireless communications. It will be appreciated that the above described modem processor may also not be integrated into the processor 780.
  • the mobile terminal also includes a power source 790 (such as a battery) that supplies power to the various components.
  • a power source 790 such as a battery
  • the power source can be logically coupled to the processor 780 through the power management system to manage functions such as charging, discharging, and power management through the power management system.
  • the mobile terminal may further include a camera, a Bluetooth module, and the like, and details are not described herein again.
  • the processor 780 provided by the embodiment of the present invention simultaneously runs multiple operating systems, where the multiple operating systems include a foreground operating system and at least one background operating system, and each operating system corresponds to a resource management namespace, and each operating system corresponds to a resource management namespace.
  • the resource management namespace includes running status information of the operating system corresponding thereto, and the running status information is used to indicate that the operating system is a foreground operating system or a background operating system, and is used to indicate that the hardware in the mobile terminal is open to the foreground operation.
  • processor 780 is configured to:
  • an operating system switching instruction where the operating system switching instruction includes an identifier of the second operating system and a switching identifier, where the identifier of the second operating system is used to indicate that the second operating system is switched to a foreground operating system;
  • the method for hot switching of the operating system may be used when the operating system is hot-switched.
  • the hardware resources occupied by the current foreground operating system are released, and the running status information in the resource management namespace indicates that the hardware resources shield the background operating system from accessing the hardware resources, and to some extent guarantees the operating resources of multiple operating systems.
  • Mutually exclusive access and coordinated use thus ensuring the reliability of the use of hardware resources after the operating system switch.
  • the processor 780 is further configured to determine, according to the identifier of the second operating system, a resource management namespace of the second operating system from a resource global linked list, where the resource global linked list It includes the correspondence between the identifier of the operating system and the resource management namespace of the operating system.
  • the resource management namespace corresponding to each operating system is maintained through the resource global linked list, which can speed up the hot switching of the operating system.
  • the processor 780 is specifically configured to: according to the switching identifier, release a blocking state of a start switching identifier in a blocked state, and obtain an unblocking start switching identifier, where the unblocking starts to switch.
  • the identifier is used to instruct the resource management thread to notify the hardware in the mobile terminal to release the hardware resources occupied by the first operating system, where the start switch identifier in the blocked state is used to indicate that the execution of the operating system switch is prohibited.
  • the switch identifier is used to release the hardware to indicate that the hardware resources are released.
  • the processor 780 is further configured to: after completing the handover of the foreground operating system from the first operating system to the second operating system, allocate the hardware resource to the The second operating system uses; after the hardware resource is allocated to the second operating system, the unblocking start switching identifier is restored to a blocked state.
  • the unblocking start switch identifier is restored to the blocked state in time, thereby further improving the mutual exclusion of the use of hardware resources by multiple operating systems.
  • the processor 780 is further configured to monitor hot plugging of the mobile terminal after completing the handover of the foreground operating system from the first operating system to the second operating system. And removing the in-position mark of the first hot plug device from the resource management namespace of the first operating system to remove the first hot plug device from the mobile terminal a binding relationship between the first hot plug device and the first operating system, where the in-position tag of the first hot plug device is used to indicate that the first hot plug device is used by the first operating system .
  • the hot swap device can release the binding relationship with the operating system before the switching, and ensure the mutual exclusion of the hot swap device by multiple operating systems.
  • the processor 780 is further configured to monitor hot plugging of the mobile terminal after completing the handover of the foreground operating system from the first operating system to the second operating system. Adding an in-position flag of the second hot plug device to the resource management namespace of the second operating system to detect the second hot plug device inserted into the mobile terminal The binding relationship between the hot plug device and the second operating system, and the in-position flag of the second hot plug device is used to indicate that the second hot plug device is used by the second operating system.
  • the hot swap device can establish a binding relationship with the switched operating system, thereby ensuring the mutual exclusion of the hot swap device by multiple operating systems.
  • the mobile terminal can also perform the method and the embodiment of FIG. 1 to FIG. 6 , and details are not described herein again.
  • the mobile terminal provided by the embodiment of the present invention may first release the hardware resources occupied by the current foreground operating system when the operating system is hot-switched, and indicate the hardware resource shielding background operating system by using the running status information in the resource management namespace.
  • the access of hardware resources ensures the exclusive access and coordinated use of hardware resources by multiple operating systems to a certain extent, thereby ensuring the reliability of the use of hardware resources after the operating system is switched.
  • the mobile terminal provided by the embodiment of the present invention implements a connection with a hot plug device through a hot plug interface, and the processor 780 simultaneously runs multiple operating systems, where the multiple operating systems include a foreground operating system, and At least one background operating system, each operating system corresponding to a resource management namespace, and each resource management namespace includes a running status letter of the corresponding operating system
  • the operation status information is used to indicate that the operating system is a foreground operating system or a background operating system, and is used to indicate that the hardware in the mobile terminal is open to the use of the foreground operating system or to block the use of the background operating system.
  • the hardware is the hardware for interacting with the outside, wherein the current foreground operating system is a first operating system, the at least one background operating system includes a second operating system, and the processor 780 is configured to :
  • the in-position flag of the first hot plug device is added in the resource management namespace of the first operating system to establish the first a binding relationship between the hot plugging device and the first operating system, where the in-position tag of the first hot plug device is used to indicate that the first hot plug device is used by the first operating system;
  • the in-position flag of the second hot plug device is cleared from the resource management namespace of the first operating system to release the The binding relationship between the hot plug device and the first operating system, and the in-position flag of the second hot plug device is used to indicate that the second hot plug device is used by the first operating system.
  • the processor 780 is further configured to: when the foreground operating system is from the first operating system to the second operating system;
  • the in-position flag of the first hot plug device is cleared in the resource management namespace of the first operating system to release the a binding relationship between the first hot plugging device and the first operating system, where the in-position tag of the first hot plug device is used to indicate that the first hot plug device is used by the first operating system ;
  • the mobile device provided by the embodiment of the present invention can bind or unbind the hot-plugging device to the current operating system, thereby avoiding conflicts between multiple operating systems for hot-plugging devices, and ensuring multiple operating system pairs.
  • mutually exclusive use of hot-swappable devices can be used.
  • the program may be implemented by instructing related hardware (for example, a processor), and the program may be stored in a computer readable storage medium, and the storage medium may include: a ROM, a RAM, a magnetic disk, or an optical disk.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Multimedia (AREA)
  • Telephone Function (AREA)
  • Stored Programmes (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

一种操作***热切换的方法,应用于运行有多个操作***的移动终端,多个操作***包括一个前台操作***,以及至少一个后台操作***,其中,当前的前台操作***为第一操作***,所述至少一个后台操作***包括第二操作***,所述方法包括:获取操作***切换指令,所述操作***切换指令包含所述第二操作***的标识和切换标识,根据所述切换标识,释放所述第一操作***所占用的硬件资源,将所述前台操作***从所述第一操作***到所述第二操作***的切换。操作***热切换的方法,一定程度上保证多个操作***对硬件资源的互斥访问和协调使用,从而保证了操作***切换后硬件资源使用的可靠性。

Description

一种操作***热切换的方法、装置及移动终端
本申请要求于2014年12月12日提交中国专利局、申请号为201410767954.5、发明名称为“一种操作***热切换的方法、装置及移动终端”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本发明涉及计算机技术领域,具体涉及一种操作***热切换的方法、装置及移动终端。
背景技术
当前移动终端功能越来越强大,支持的功能也越来越多,可以满足一个移动终端上运行多个操作***,但移动终端同一时间只能被一个操作***独占使用,因此目前切换操作***的方式是多***冷切换,即同时只能启动一个操作***,如果需要切换到另一个操作***,则需要重新启动移动终端。如果能同时启动多个操作***,并且可以在两个操作***之间快速热切换,就可以将多操作***的价值和用户体验提升要一个新的层次,也就能够吸引更多的用户。
一个移动终端只有一套硬件资源,所述硬件资源为所述移动终端中用于与外部交互的硬件资源;用于与外部交互的硬件资源,如:显示屏、音视频、蓝牙、无线保真(wireless fidelity,Wifi)、全球定位***(Global Positioning System,GPS)、通用串行总线(Universal Serial Bus,USB)、安全数码(Secure Digital,SD)卡等,目前在运行有多个操作***的移动终端中,经常会出现多个操作***同时对同一硬件资源进行使用的情况,导致硬件资源使用异常,甚至损坏硬件资源,现有技术中无法做到多个操作***对移动终端硬件资源的互斥访问和协调使用。
发明内容
本发明实施例提供一种操作***热切换的方法,能一定程度上保证多个操作***对硬件资源的互斥访问和协调使用,从而保证了操作***切换后硬件资源使用的可靠性。本发明实施例还提供了相应的装置及移动终端。
本发明第一方面提供一种操作***热切换的方法,所述方法应用于运行有多个操作***的移动终端,所述多个操作***包括一个前台操作***,以及至少一个后台操作***,每个操作***各自对应一个资源管理命名空间,每个资 源管理命名空间包括与其对应的操作***的运行状态信息,所述运行状态信息用于指示所述操作***为前台操作***或后台操作***,并用于指示所述移动终端中的硬件开放对前台操作***的使用或屏蔽对后台操作***的使用,所述硬件为所述用于与外部交互的硬件,其中,当前的前台操作***为第一操作***,所述至少一个后台操作***包括第二操作***,所述方法包括:
获取操作***切换指令,所述操作***切换指令包含所述第二操作***的标识和切换标识,所述第二操作***的标识用于指示将所述第二操作***切换为前台操作***;
根据所述切换标识,释放所述第一操作***所占用的硬件资源,所述硬件资源为所述移动终端中用于与外部交互的硬件资源;
将所述第一操作***的资源管理命名空间中的运行状态信息修改到后台状态,将所述第二操作***的资源管理命名空间中的运行状态信息修改到前台状态,完成所述前台操作***从所述第一操作***到所述第二操作***的切换。
结合第一方面,在第一种可能的实现方式中,所述根据所述切换标识,释放所述第一操作***所占用的硬件资源,所述硬件资源为所述移动终端中用于与外部交互的硬件资源之后,所述方法还包括:
根据所述第二操作***的标识,从资源全局链表中确定所述第二操作***的资源管理命名空间,所述资源全局链表包括操作***的标识与操作***的资源管理命名空间的对应关系。
结合第一方面或第一方面第一种可能的实现方式,在第二种可能的实现方式中,所述根据所述切换标识,释放所述第一操作***所占用的硬件资源,包括:
根据所述切换标识,解除处于阻塞状态的开始切换标识的阻塞状态,得到解除阻塞的开始切换标识,所述解除阻塞的开始切换标识用于指示资源管理线程通知所述移动终端中的硬件释放所述第一操作***所占用的硬件资源,所述处于阻塞状态的开始切换标识用于指示禁止执行操作***切换。
结合第一方面第二种可能的实现方式,在第三种可能的实现方式中,所述 完成所述前台操作***从所述第一操作***到所述第二操作***的切换之后,所述方法还包括:
将所述硬件资源分配给所述第二操作***使用;
在将所述硬件资源分配给所述第二操作***使用后,将所述解除阻塞的开始切换标识恢复到阻塞状态。
结合第一方面、第一方面第一种、第二种或第三种可能的实现方式,在第四种可能的实现方式中,所述完成所述前台操作***从所述第一操作***到所述第二操作***的切换之后,所述方法还包括:
监测所述移动终端的热插拔接口;
当监测到第一热插拔设备从所述移动终端拔出,则从所述第一操作***的资源管理命名空间中清除所述第一热插拔设备的在位标记,以解除所述第一热插拔设备与所述第一操作***的绑定关系,所述第一热插拔设备的在位标记用于指示所述第一热插拔设备供所述第一操作***使用。
结合第一方面、第一方面第一种、第二种、第三种或第四种可能的实现方式,在第五种可能的实现方式中,所述完成所述前台操作***从所述第一操作***到所述第二操作***的切换之后,所述方法还包括:
监测所述移动终端的热插拔接口;
当监测到第二热插拔设备***所述移动终端,则在所述第二操作***的资源管理命名空间中添加所述第二热插拔设备的在位标记,以建立所述第二热插拔设备与所述第二操作***的绑定关系,所述第二热插拔设备的在位标记用于指示第二热插拔设备供所述第二操作***使用。
本发明第二方面提供一种热插拔设备管理的方法,所述方法应用于运行有多个操作***的移动终端,所述移动终端提供热插拔接口,所述热插拔设备通过所述热插拔接口与所述移动终端实现热插拔,所述多个操作***包括一个前台操作***,以及至少一个后台操作***,每个操作***各自对应一个资源管理命名空间,每个资源管理命名空间包括与其对应的操作***的运行状态信息,所述运行状态信息用于指示所述操作***为前台操作***或后台操作***,并用于指示所述移动终端中的硬件开放对前台操作***的使用或屏蔽对后 台操作***的使用,所述硬件为所述用于与外部交互的硬件,其中,当前的前台操作***为第一操作***,所述至少一个后台操作***包括第二操作***,所述方法包括:
监测所述移动终端的热插拔接口;
当监测到第一热插拔设备***所述移动终端时,则在所述第一操作***的资源管理命名空间中添加所述第一热插拔设备的在位标记,以建立所述第一热拔插设备与所述第一操作***的绑定关系,所述第一热插拔设备的在位标记用于指示所述第一热插拔设备供所述第一操作***使用;
当监测到第二热插拔设备从所述移动终端拔出,则从所述第一操作***的资源管理命名空间中清除所述第二热插拔设备的在位标记,以解除所述第二热插拔设备与所述第一操作***的绑定关系,所述第二热插拔设备的在位标记用于指示所述第二热插拔设备供所述第一操作***使用。
结合第二方面,在第一种可能的实现方式中,当所述前台操作***从所述第一操作***到所述第二操作***,所述方法还包括:
当监测到所述第一热插拔设备从所述移动终端拔出,则在所述第一操作***的资源管理命名空间中清除所述第一热插拔设备的在位标记,以解除所述第一热拔插设备与所述第一操作***的绑定关系,所述第一热插拔设备的在位标记用于指示所述第一热插拔设备供所述第一操作***使用;
当监测到所述第二热插拔设备***所述移动终端,则在所述第二操作***的资源管理命名空间中添加所述第二热插拔设备的在位标记,以建立所述第二热插拔设备与所述第二操作***的绑定关系,所述第二热插拔设备的在位标记用于指示所述第二热插拔设备供所述第二操作***使用。
本发明第三方面提供一种操作***热切换的装置,所述装置应用于运行有多个操作***的移动终端,所述多个操作***包括一个前台操作***,以及至少一个后台操作***,每个操作***各自对应一个资源管理命名空间,每个资源管理命名空间包括与其对应的操作***的运行状态信息,所述运行状态信息用于指示所述操作***为前台操作***或后台操作***,并用于指示所述移动终端中的硬件开放对前台操作***的使用或屏蔽对后台操作***的使用,所述 硬件为所述用于与外部交互的硬件,其中,当前的前台操作***为第一操作***,所述至少一个后台操作***包括第二操作***,所述装置包括:
获取单元,用于获取操作***切换指令,所述操作***切换指令包含所述第二操作***的标识和切换标识,所述第二操作***的标识用于指示将所述第二操作***切换为前台操作***;
释放单元,用于根据所述获取单元获取的切换标识,释放所述第一操作***所占用的硬件资源,所述硬件资源为所述移动终端中用于与外部交互的硬件资源;
切换单元,用于在所述释放单元释放所述硬件资源后,将所述第一操作***的资源管理命名空间中的运行状态信息修改到后台状态,将所述第二操作***的资源管理命名空间中的运行状态信息修改到前台状态,完成所述前台操作***从所述第一操作***到所述第二操作***的切换。
结合第三方面,在第一种可能的实现方式中,所述装置还包括:
确定单元,用于根据所述获取单元获取的所述第二操作***的标识,从资源全局链表中确定所述第二操作***的资源管理命名空间,所述资源全局链表包括操作***的标识与操作***的资源管理命名空间的对应关系。
结合第三方面或第三方面第一种可能的实现方式,在第二种可能的实现方式中,
所述释放单元,具体用于根据所述切换标识,解除处于阻塞状态的开始切换标识的阻塞状态,得到解除阻塞的开始切换标识,所述解除阻塞的开始切换标识用于指示资源管理线程通知所述移动终端中的硬件释放所述第一操作***所占用的硬件资源,所述处于阻塞状态的开始切换标识用于指示禁止执行操作***切换。
结合第三方面第二种可能的实现方式,在第三种可能的实现方式中,所述装置还包括:
分配单元,用于在所述切换单元完成所述前台操作***从所述第一操作***到所述第二操作***的切换之后,将所述硬件资源分配给所述第二操作***使用;
修改单元,用于在所述分配单元将所述硬件资源分配给所述第二操作***使用后,将所述解除阻塞的开始切换标识恢复到阻塞状态。
结合第三方面、第三方面第一种、第二种或第三种可能的实现方式,在第四种可能的实现方式中,所述装置还包括:
第一监测单元,用于在所述切换单元完成所述前台操作***从所述第一操作***到所述第二操作***的切换之后,监测所述移动终端的热插拔接口;
清除单元,用于当所述第一监测单元监测到所述第一热插拔设备从所述移动终端拔出,则从所述第一操作***的资源管理命名空间中清除所述第一热插拔设备的在位标记,以解除所述第一热插拔设备与所述第一操作***的绑定关系,所述第一热插拔设备的在位标记用于指示所述第一热插拔设备供所述第一操作***使用。
结合第三方面、第三方面第一种、第二种、第三种或第四种可能的实现方式,在第五种可能的实现方式中,所述装置还包括:
第二监测单元,用于监测所述移动终端的热插拔接口;
添加单元,用于当所述第二监测单元监测到第二热插拔设备***所述移动终端,则在所述第二操作***的资源管理命名空间中添加所述第二热插拔设备的在位标记,以建立所述第二热插拔设备与所述第二操作***的绑定关系,所述第二热插拔设备的在位标记用于指示第二热插拔设备供所述第二操作***使用。
本发明第四方面提供一种热插拔设备管理的装置,所述装置应用于运行有多个操作***的移动终端,所述移动终端提供热插拔接口,所述热插拔设备通过所述热插拔接口与所述移动终端实现热插拔,所述多个操作***包括一个前台操作***,以及至少一个后台操作***,每个操作***各自对应一个资源管理命名空间,每个资源管理命名空间包括与其对应的操作***的运行状态信息,所述运行状态信息用于指示所述操作***为前台操作***或后台操作***,并用于指示所述移动终端中的硬件开放对前台操作***的使用或屏蔽对后台操作***的使用,所述硬件为所述用于与外部交互的硬件,其中,当前的前台操作***为第一操作***,所述至少一个后台操作***包括第二操作***, 所述装置包括:
监测单元,用于监测所述移动终端的热插拔接口;
添加单元,用于当所述监测单元监测到第一热插拔设备***所述移动终端时,则在所述第一操作***的资源管理命名空间中添加所述第一热插拔设备的在位标记,以建立所述第一热拔插设备与所述第一操作***的绑定关系,所述第一热插拔设备的在位标记用于指示所述第一热插拔设备供所述第一操作***使用;
清除单元,用于当所述监测单元监测到第二热插拔设备从所述移动终端拔出,则从所述第一操作***的资源管理命名空间中清除所述第二热插拔设备的在位标记,以解除所述第二热插拔设备与所述第一操作***的绑定关系,所述第二热插拔设备的在位标记用于指示所述第二热插拔设备供所述第一操作***使用。
结合第四方面,在第一种可能的实现方式中,
所述清除单元,还用于所述前台操作***从所述第一操作***到所述第二操作***后,当所述监测单元监测到所述第一热插拔设备从所述移动终端拔出,则在所述第一操作***的资源管理命名空间中清除所述第一热插拔设备的在位标记,以解除所述第一热拔插设备与所述第一操作***的绑定关系,所述第一热插拔设备的在位标记用于指示所述第一热插拔设备供所述第一操作***使用;
所述添加单元,还用于当所述面向用户的操作***从第一操作***切换到所述第二操作***后,当所述监测单元监测到所述第二热插拔设备***所述移动终端,则在所述第二操作***的资源管理命名空间中添加所述第二热插拔设备的在位标记,以建立所述第二热插拔设备与所述第二操作***的绑定关系,所述第二热插拔设备的在位标记用于指示所述第二热插拔设备供所述第二操作***使用。
本发明第五方面提供一种移动终端,所述移动终端包括处理器,存储器和硬件资源,所述硬件资源为所述移动终端中用于与外部交互的硬件资源,其中,所述处理器同时运行有多个操作***,所述多个操作***包括一个前台操作系 统,以及至少一个后台操作***,每个操作***各自对应一个资源管理命名空间,每个资源管理命名空间包括与其对应的操作***的运行状态信息,所述运行状态信息用于指示所述操作***为前台操作***或后台操作***,并用于指示所述移动终端中的硬件开放对前台操作***的使用或屏蔽对后台操作***的使用,所述硬件为所述用于与外部交互的硬件,其中,当前的前台操作***为第一操作***,所述至少一个后台操作***包括第二操作***,
以及,所述处理器,被配置成:
获取操作***切换指令,所述操作***切换指令包含所述第二操作***的标识和切换标识,所述第二操作***的标识用于指示将所述第二操作***切换为前台操作***;
根据所述切换标识,释放所述第一操作***所占用的所述硬件资源;
将所述第一操作***的资源管理命名空间中的运行状态信息修改到后台状态,将所述第二操作***的资源管理命名空间中的运行状态信息修改到前台状态,完成所述前台操作***从所述第一操作***到所述第二操作***的切换。
本发明第六方面提供一种移动终端,所述移动终端包括处理器,存储器、硬件资源和热插拔接口,所述硬件资源为所述移动终端中用于与外部交互的硬件资源,热插拔设备通过所述热插拔接口与所述移动终端实现热插拔,其中,所述处理器同时运行有多个操作***,所述多个操作***包括一个前台操作***,以及至少一个后台操作***,每个操作***各自对应一个资源管理命名空间,每个资源管理命名空间包括与其对应的操作***的运行状态信息,所述运行状态信息用于指示所述操作***为前台操作***或后台操作***,并用于指示所述移动终端中的硬件开放对前台操作***的使用或屏蔽对后台操作***的使用,所述硬件为所述用于与外部交互的硬件,其中,当前的前台操作***为第一操作***,所述至少一个后台操作***包括第二操作***,
以及,所述处理器,被配置成:
监测所述移动终端的热插拔接口;
当监测到第一热插拔设备***所述移动终端时,则在所述第一操作***的 资源管理命名空间中添加所述第一热插拔设备的在位标记,以建立所述第一热拔插设备与所述第一操作***的绑定关系,所述第一热插拔设备的在位标记用于指示所述第一热插拔设备供所述第一操作***使用;
当监测到第二热插拔设备从所述移动终端拔出,则从所述第一操作***的资源管理命名空间中清除所述第二热插拔设备的在位标记,以解除所述第二热插拔设备与所述第一操作***的绑定关系,所述第二热插拔设备的在位标记用于指示所述第二热插拔设备供所述第一操作***使用。
本发明实施例提供的操作***热切换的方法,应用于运行有多个操作***的移动终端,所述多个操作***包括一个前台操作***,以及至少一个后台操作***,每个操作***各自对应一个资源管理命名空间,每个资源管理命名空间包括与其对应的操作***的运行状态信息,所述运行状态信息用于指示所述操作***为前台操作***或后台操作***,并用于指示所述移动终端中的硬件开放对前台操作***的使用或屏蔽对后台操作***的使用,所述硬件为所述用于与外部交互的硬件,其中,当前的前台操作***为第一操作***,所述至少一个后台操作***包括第二操作***,所述方法包括:获取操作***切换指令,所述操作***切换指令包含所述第二操作***的标识和切换标识,所述第二操作***的标识用于指示将所述第二操作***切换为前台操作***;根据所述切换标识,释放所述第一操作***所占用的硬件资源,所述硬件资源为所述移动终端中用于与外部交互的硬件资源;将所述第一操作***的资源管理命名空间中的运行状态信息修改到后台状态,将所述第二操作***的资源管理命名空间中的运行状态信息修改到前台状态,完成所述前台操作***从所述第一操作***到所述第二操作***的切换。与现有技术中经常会出现多个操作***同时对同一硬件资源进行使用的情况,导致硬件资源使用异常相比,本发明实施例提供的操作***热切换的方法,可以在操作***热切换时,先释放掉当前的前台操作***所占用的硬件资源,并通过资源管理命名空间中的运行状态信息指示硬件资源屏蔽后台操作***对硬件资源的访问,一定程度上保证多个操作***对硬件资源的互斥访问和协调使用,从而保证了操作***切换后硬件资源使用的可靠性。
附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是本发明实施例中终端的操作***和硬件资源一架构示意图;
图2是本发明实施例中终端的操作***和硬件资源另一架构示意图;
图3是本发明实施例中终端的操作***和硬件资源另一架构示意图;
图4是本发明实施例中操作***热切换的方法的一实施例示意图;
图5是本发明实施例中操作***热切换的方法的另一实施例示意图;
图6是本发明实施例中操作***热切换的方法的另一实施例示意图;
图7是本发明实施例中热插拔设备管理的方法的一实施例示意图;
图8是本发明实施例中操作***热切换的装置的一实施例示意图;
图9是本发明实施例中操作***热切换的装置的另一实施例示意图;
图10是本发明实施例中操作***热切换的装置的另一实施例示意图;
图11是本发明实施例中操作***热切换的装置的另一实施例示意图;
图12是本发明实施例中操作***热切换的装置的另一实施例示意图;
图13是本发明实施例中热插拔设备管理的装置的一实施例示意图;
图14是本发明实施例中移动终端的一实施例示意图;
图15是本发明实施例中移动终端的另一实施例示意图。
具体实施方式
本发明实施例提一种操作***热切换的方法,能一定程度上保证多个操作***对硬件资源的互斥访问和协调使用,从而保证了操作***切换后硬件资源使用的可靠性。本发明实施例还提供了相应的装置及移动终端。以下分别进行详细说明。
为了使本技术领域的人员更好地理解本发明方案,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分的实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所 有其他实施例,都应当属于本发明保护的范围。
参阅图1,为本发明实施例提供的移动终端的操作***和硬件资源架构的原理示意图,其中:
移动终端同时可以运行多个操作***,如:操作***1、操作***2,直至操作***n,n为大于2的整数,移动终端中包含的多个操作***是分时复用的,在一个时间段内只能有一个操作***在前台运行,其他操作***都在后台运行。如图1中,操作***1为前台操作***,操作***2,直至操作***n都为后台操作***。
本发明实施例中的前台操作***为运行在前台的操作***,可以与用户交互的操作***,后台操作***为运行在后台的操作***,不能与用户进行交互。
移动终端的硬件资源包括移动终端的内部硬件资源,以及与移动终端通过热插拔接口建立连接的热插拔硬件资源,本发明实施例中的硬件资源为所述移动终端中用于与外部交互的硬件资源,内部硬件资源可以包括移动终端wifi模块、蓝牙模块、近距离无线通信(NFC,Near Field Communication)模块、音频模块、视频模块、显示屏、摄像头等可与外部交互的硬件资源,热插拔硬件资源可以包括通过通用串行总线(Universal Serial Bus,USB)接口连接的USB设备、安全数码(Secure Digital,SD)卡,通过在线直传(OTG,On-The-Go)接口连接的OTG设备等都属于热插拔硬件资源。
参阅图2,为本发明实施例提供的移动终端的操作***和硬件资源架构的另一原理示意图,其中:
针对每个操作***对应的硬件资源,在软件层面会维护一个针对该操作***的内部资源管理服务,如针对操作***1至操作***n都对应有wifi、NFC、蓝牙等资源管理服务程序,在操作***1为当前的前台操作***时,与该操作***1对应的内部资源管理服务启动,在操作***2至操作***n都只在后台运行时,与操作***2至操作***n对应的内部资源管理服务阻塞,同时,针对每个内部资源管理服务都有其对应的资源管理线程组,如:操作***1为当前的前台操作***时,则与操作***1对应的内部资源管理服务和资源管理线程都处于启动状态,其他操作***都只在后台运行,则与其他操作***对应的内部 资源管理服务和资源管理线程都处于阻塞状态。
在内核中会维护每个操作***各自对应的资源管理命名空间,在每个资源管理命名空间包括与其对应的操作***的运行状态信息,所述运行状态信息用于指示所述操作***为前台操作***或后台操作***,并用于指示所述移动终端中的硬件开放对前台操作***的使用或屏蔽对后台操作***的使用,例如:图2中操作***1的资源管理命名空间中操作***1的状态:前台,则表示该操作***1为前台操作***,内部硬件资源使用状态:可用,则表示操作***1可以使用内部硬件资源。图2中操作***2的资源管理命名空间中操作***2的状态:后台,则表示该操作***2为后台操作***,内部硬件资源使用状态:禁用,则表示操作***2不可以使用内部硬件资源。
这样,各资源管理线程读取到资源管理命名空间1中的操作***1的状态为前台后,与操作***1对应的资源管理线程就会启动,与其他操作***对应的资源管理线程都会阻塞,与操作***1对应的内部资源管理服务也会启动,与其他操作***对应的内部资源管理服务都会阻塞。
在操作***1为前台操作***时,资源管理线程会允许操作***1调用内部硬件资源,其他操作***运行在后台,资源管理线程会阻塞其他操作***对内部硬件资源的调用。则实现了多个操作***对硬件资源的互斥使用。
在操作***热切换时,可以参阅图3理解本发明实施例的操作***热切换过程:
本发明实施例以基于Linux内核的Android手机上运用的实施方案为例进行说明,android手机操作***是一个基于Linux Kernel的分层智能手机操作***,其分为5层,从上到下分别是应用层(Java Application)、框架层(Frameworks)、***运行库层(User Libraries)、内核层(Linux Kernel)和硬件层。
在本发明实施例中,在应用层设置了操作***切换接口(SystemSwitch),为操作***切换的入口,以安卓安装包(AndroidPackage,APK)的形式存在于移动终端的桌面上,点击APK后可以为用户提供操作***切换的界面。
在框架层,针对内部资源服务设置内部资源管理线程(Resource  management thread),操作***启动时跟随各个内部资源管理器而启动,一方面通过内核记录资源管理命名空间的前台操作***的标识来获取当前的前台操作***,使当前的前台操作***能够正常使用内部硬件资源,后台操作***无法使用内部硬件资源,另一方面监控操作***切换APK发送的切换事件,当当前的前台操作***收到切换事件时,首先释放本操作***占用的内部硬件资源并通知内核,内核确保所有内部硬件资源释放完成后再进行操作***切换。
在框架层,针对热插拔硬件资源,设置外部资源管理服务,对服务进行修改,当有热插拔设备***移动终端时,对kernel发送的热插拔设备***Uevent消息进行截取,接收到热插拔设备***消息时读取当前的前台操作***,当前的前台操作***绑定***的热插拔设备,后台的操作***进行屏蔽,对内核发送的热插拔设备拔出Uevent消息进行截取,对未绑定该热插拔设备的操作***进行屏蔽。
在内核层建立多操作***需要使用的节点,并对外提供相应的节点接口,如用于获取当前的前台操作***的接口、用于判断当前是否正在切换操作***的接口等。
本发明运用在基于Linux内核的Android手机上多个操作***切换时,对内部硬件资源管理的过程可以参阅图4进行理解:
步骤1:移动终端开机后,会自动启动一个前台操作***,例如:操作***1,操作***1启动之后,与操作***1对应的各个资源管理线程读取操作***1的资源管理空间的操作***状态信息和内部硬件资源使用细腻系,开放操作***1对于内部硬件资源的调用,资源管理线程调用kernel的开始切换节点,此时没有切换事件输入,开始切换节点为阻塞节点。
步骤2:用户通过桌面上的System Switch,选择将操作***2切换到前台,这个动作会调用内核提供的切换接口,通知内核操作***切换事件发生。
步骤3:内核接收到上层APK发下来的切换事件,将所有资源管理线程的开始切换节点释放。
步骤4:内核通知完各个线程操作***切换开始后,进入等待状态,等待各个资源管理线程反馈资源释放情况。
步骤5:资源管理线程阻塞解除,开始工作,开始释放当前占用的内部硬件资源。
步骤6:硬件资源释放完成后,调用内核提供的接口,如NFC资源释放完成接口,通知内核当前线程监控的资源已经释放完毕。
步骤7:当资源管理线程向内核反馈资源已释放完成之后再次进入阻塞状态,等待内核通知***切换完成。
步骤8:当内核检测到所有资源管理线程全部反馈其所监控的内部硬件资源释放完毕之后,解除当前等待状态,通知各个管理线程操作***切换完成。
步骤9:资源管理线程阻塞解除,开始工作,开放切换到前台的操作***2对于内部资源的调用,并重新进入阻塞状态,等待下一次切换的到来。
在操作***1到操作***2的切换过程中,将操作***1的资源管理命名空间中的操作***1状态修改为后台,将操作***1的内部硬件资源使用状态修改为禁用。将操作***2的资源管理命名空间中的操作***2状态修改为前台,将操作***2的内部硬件资源使用状态修改为可用。
本发明以运行在基于Linux内核的Android手机上多个操作***对内部硬件资源管理的过程为例进行说明,可以参阅图5进行理解:
热插拔设备的***流程如下:
步骤1:用户将热插拔设备A***手机。
步骤2:内核检测到热插拔设备A已***,发送Uevent消息给各个操作***的热插拔设备A管理器(图3中框架层的外部资源管理服务)。
步骤3:热插拔设备A管理器接收到内核发送的热插拔设备A***的Uevent消息之后,判断当前热插拔设备A管理器所在的操作***前台操作***还是后台操作***:如果是后台操作***,则直接返回,屏蔽这个Uevent消息;如果是后台操作***,则进入步骤4。
步骤4:前台操作***接收到热插拔设备A的***消息后,添加当前热插拔设备A的在位状态,然后允许外设A的管理器继续处理这条Uevent消息,之后热插拔设备A与当前处于激活状态的操作***绑定了,可以被当前***正常使用,即使发生了***切换也不会与绑定的***解除绑定。
热插拔设备的拔出流程如下:
步骤5:用户将热插拔设备A拔出手机。
步骤6:内核检测到热插拔设备A已拔出,发送Uevent消息给各个操作***的热插拔设备A的管理器。
步骤7:热插拔设备A的管理器接收到内核发送的热插拔设备A拔出Uevent消息之后,判断当前管理器所在的操作***的热插拔设备A是否在位:如果不在位,则直接返回,屏蔽这个Uevent消息;如果在位,则进入步骤8。
步骤8:热插拔设备A在位的操作***接收到热插拔设备A的拔出消息后,将热插拔设备A的在位标记清除,然后允许热插拔设备A的管理器继续处理这条Uevent消息,之后热插拔设备A的管理器与原来绑定的***解除绑定了,重新***后就可以与当前的前台操作***绑定了,并供当前的前台操作***正常使用。
本发明实施例中,在位标记可以维护在各个操作***的资源管理空间中。与现有技术中经常会出现多个操作***同时对同一硬件资源进行使用的情况,导致硬件资源使用异常相比,本发明实施例提供的操作***热切换的方法,可以在操作***热切换时,先释放掉当前的前台操作***所占用的硬件资源,并通过资源管理命名空间中的运行状态信息指示硬件资源屏蔽后台操作***对硬件资源的访问,一定程度上保证多个操作***对硬件资源的互斥访问和协调使用,从而保证了操作***切换后硬件资源使用的可靠性。
本发明实施例提供的操作***热切换的方法,移动终端运行的多套***热切换时,能确保切换前的前台操作***所占用的内部硬件资源释放完成,在切换到前台操作***后可以保证内部硬件资源被切换后的操作***的正常使用,防止出现概率性个别资源由于抢占使用导致功能异常。
参阅图6,本发明实施例提供的一种操作***热切换的方法,所述方法应用于运行有多个操作***的移动终端,所述多个操作***包括一个前台操作***,以及至少一个后台操作***,每个操作***各自对应一个资源管理命名空间,每个资源管理命名空间包括与其对应的操作***的运行状态信息,所述运行状态信息用于指示所述操作***为前台操作***或后台操作***,并用于指 示所述移动终端中的硬件开放对前台操作***的使用或屏蔽对后台操作***的使用,所述硬件为所述用于与外部交互的硬件,其中,当前的前台操作***为第一操作***,所述至少一个后台操作***包括第二操作***,所述方法包括:
101、获取操作***切换指令,所述操作***切换指令包含所述第二操作***的标识和切换标识,所述第二操作***的标识用于指示将所述第二操作***切换为前台操作***。
102、根据所述切换标识,释放所述第一操作***所占用的硬件资源,所述硬件资源为所述移动终端中用于与外部交互的硬件资源。
103、将所述第一操作***的资源管理命名空间中的运行状态信息修改到后台状态,将所述第二操作***的资源管理命名空间中的运行状态信息修改到前台状态,完成所述前台操作***从所述第一操作***到所述第二操作***的切换。
本发明实施例提供的操作***热切换的方法,应用于运行有多个操作***的移动终端,所述多个操作***包括一个前台操作***,以及至少一个后台操作***,每个操作***各自对应一个资源管理命名空间,每个资源管理命名空间包括与其对应的操作***的运行状态信息,所述运行状态信息用于指示所述操作***为前台操作***或后台操作***,并用于指示所述移动终端中的硬件开放对前台操作***的使用或屏蔽对后台操作***的使用,所述硬件为所述用于与外部交互的硬件,其中,当前的前台操作***为第一操作***,所述至少一个后台操作***包括第二操作***,所述方法包括:获取操作***切换指令,所述操作***切换指令包含所述第二操作***的标识和切换标识,所述第二操作***的标识用于指示将所述第二操作***切换为前台操作***;根据所述切换标识,释放所述第一操作***所占用的硬件资源,所述硬件资源为所述移动终端中用于与外部交互的硬件资源;将所述第一操作***的资源管理命名空间中的运行状态信息修改到后台状态,将所述第二操作***的资源管理命名空间中的运行状态信息修改到前台状态,完成所述前台操作***从所述第一操作***到所述第二操作***的切换。与现有技术中经常会出现多个操作***同时对 同一硬件资源进行使用的情况,导致硬件资源使用异常相比,本发明实施例提供的操作***热切换的方法,可以在操作***热切换时,先释放掉当前的前台操作***所占用的硬件资源,并通过资源管理命名空间中的运行状态信息指示硬件资源屏蔽后台操作***对硬件资源的访问,一定程度上保证多个操作***对硬件资源的互斥访问和协调使用,从而保证了操作***切换后硬件资源使用的可靠性。
可选地,在上述图6对应的实施例的基础上,本发明实施例提供的操作***热切换的方法的第一个可选实施例中,所述根据所述切换标识,释放所述第一操作***所占用的硬件资源,所述硬件资源为所述移动终端中用于与外部交互的硬件资源之后,所述方法还可以包括:
根据所述第二操作***的标识,从资源全局链表中确定所述第二操作***的资源管理命名空间,所述资源全局链表包括操作***的标识与操作***的资源管理命名空间的对应关系。
本发明实施例中,通过资源全局链表维护与每个操作***对应的各资源管理命名空间,可以加快操作***热切换的速度。
可选地,在上述图6对应的实施例或第一个可选实施例的基础上,本发明实施例提供的操作***热切换的方法的第二个可选实施例中,所述根据所述切换标识,释放所述第一操作***所占用的硬件资源,可以包括:
根据所述切换标识,解除处于阻塞状态的开始切换标识的阻塞状态,得到解除阻塞的开始切换标识,所述解除阻塞的开始切换标识用于指示资源管理线程通知所述移动终端中与外部交互的硬件释放所述第一操作***所占用的硬件资源,所述处于阻塞状态的开始切换标识用于指示禁止执行操作***切换。
本发明实施例中,由解除阻塞的开始切换标识来指示释放硬件资源,提高了硬件资源释放的效率。
可选地,在上述操作***热切换的第二个可选实施例的基础上,本发明实施例提供的操作***热切换的方法的第三个可选实施例中,所述完成所述前台操作***从所述第一操作***到所述第二操作***的切换之后,所述方法还可以包括:
将所述硬件资源分配给所述第二操作***使用;
在将所述硬件资源分配给所述第二操作***使用后,将所述解除阻塞的开始切换标识恢复到阻塞状态。
本发明实施例中,在操作***切换完毕后,及时将解除阻塞的开始切换标识恢复到阻塞状态,从而进一步提高了多个操作***对硬件资源使用的互斥性。
可选地,在上述图6对应实施例、第一、第二或第三个可选实施例的基础上,本发明实施例提供的操作***热切换的方法的第四个可选实施例中,所述完成所述前台操作***从所述第一操作***到所述第二操作***的切换之后,所述方法还可以包括:
监测所述移动终端的热插拔接口;
当监测到第一热插拔设备从所述移动终端拔出,则从所述第一操作***的资源管理命名空间中清除所述第一热插拔设备的在位标记,以解除所述第一热插拔设备与所述第一操作***的绑定关系,所述第一热插拔设备的在位标记用于指示所述第一热插拔设备供所述第一操作***使用。
本发明实施例中,在当前操作***发生切换后,热插拔设备可及时解除与切换前的操作***的绑定关系,保证了多个操作***对热插拔设备使用的互斥性。
可选地,在上述图6对应实施例、第一、第二、第三或第四个可选实施例的基础上,本发明实施例提供的操作***热切换的方法的第五个可选实施例中,所述方法还可以包括:
监测所述移动终端的热插拔接口;
当监测到第二热插拔设备***所述移动终端,则在所述第二操作***的资源管理命名空间中添加所述第二热插拔设备的在位标记,以建立所述第二热插拔设备与所述第二操作***的绑定关系,所述第二热插拔设备的在位标记用于指示第二热插拔设备供所述第二操作***使用。
本发明实施例中,当前操作***切换后,热插拔设备可以与切换后的操作***建立绑定关系,从而保证了多个操作***对热插拔设备使用的互斥性。
本发明图6对应的实施例或可选实施例所提供的操作***热切换的方法,可以参阅图1至图5部分的描述进行理解,本处不做过多赘述。
参阅图7,本发明实施例提供的热插拔设备管理的方法,应用于运行有多个操作***的移动终端,所述移动终端提供热插拔接口,所述热插拔设备通过所述热插拔接口与所述移动终端实现热插拔,所述多个操作***包括一个前台操作***,以及至少一个后台操作***,每个操作***各自对应一个资源管理命名空间,每个资源管理命名空间包括与其对应的操作***的运行状态信息,所述运行状态信息用于指示所述操作***为前台操作***或后台操作***,并用于指示所述移动终端中的硬件开放对前台操作***的使用或屏蔽对后台操作***的使用,所述硬件为所述用于与外部交互的硬件,其中,当前的前台操作***为第一操作***,所述至少一个后台操作***包括第二操作***,所述方法包括:
201、监测所述移动终端的热插拔接口。
202、当监测到第一热插拔设备***所述移动终端时,则在所述第一操作***的资源管理命名空间中添加所述第一热插拔设备的在位标记,以建立所述第一热拔插设备与所述第一操作***的绑定关系,所述第一热插拔设备的在位标记用于指示所述第一热插拔设备供所述第一操作***使用。
203、当监测到第二热插拔设备从所述移动终端拔出,则从所述第一操作***的资源管理命名空间中清除所述第二热插拔设备的在位标记,以解除所述第二热插拔设备与所述第一操作***的绑定关系,所述第二热插拔设备的在位标记用于指示所述第二热插拔设备供所述第一操作***使用。
本发明实施例提供的热插拔设备管理的方法,应用于运行有多个操作***的移动终端,所述移动终端提供热插拔接口,所述热插拔设备通过所述热插拔接口与所述移动终端实现热插拔,所述多个操作***包括一个前台操作***,以及至少一个后台操作***,每个操作***各自对应一个资源管理命名空间,每个资源管理命名空间包括与其对应的操作***的运行状态信息,所述运行状态信息用于指示所述操作***为前台操作***或后台操作***,并用于指示所述移动终端中的硬件开放对前台操作***的使用或屏蔽对后台操作***的使 用,所述硬件为所述用于与外部交互的硬件,其中,当前的前台操作***为第一操作***,所述至少一个后台操作***包括第二操作***,所述方法包括:监测所述移动终端的热插拔接口;当监测到第一热插拔设备***所述移动终端时,则在所述第一操作***的资源管理命名空间中添加所述第一热插拔设备的在位标记,以建立所述第一热拔插设备与所述第一操作***的绑定关系,所述第一热插拔设备的在位标记用于指示所述第一热插拔设备供所述第一操作***使用;当监测到第二热插拔设备从所述移动终端拔出,则从所述第一操作***的资源管理命名空间中清除所述第二热插拔设备的在位标记,以解除所述第二热插拔设备与所述第一操作***的绑定关系,所述第二热插拔设备的在位标记用于指示所述第二热插拔设备供所述第一操作***使用。与现有技术中多个操作***对热插拔设备的使用会发生冲突相比,本发明实施例提供的热插拔设备管理的方法,可以将热拔插设备与当前操作***进行绑定或者解除绑定,从而避免了多个操作***对热插拔设备使用的冲突,保证了多个操作***对热插拔设备使用的互斥性。
可选地,在上述图7对应的实施例的基础上,本发明实施例提供的热插拔设备管理的方法的另一实施例中,当所述前台操作***从所述第一操作***到所述第二操作***,所述方法还可以包括:
当监测到所述第一热插拔设备从所述移动终端拔出,则在所述第一操作***的资源管理命名空间中清除所述第一热插拔设备的在位标记,以解除所述第一热拔插设备与所述第一操作***的绑定关系,所述第一热插拔设备的在位标记用于指示所述第一热插拔设备供所述第一操作***使用;
当监测到所述第二热插拔设备***所述移动终端,则在所述第二操作***的资源管理命名空间中添加所述第二热插拔设备的在位标记,以建立所述第二热插拔设备与所述第二操作***的绑定关系,所述第二热插拔设备的在位标记用于指示所述第二热插拔设备供所述第二操作***使用。
本发明实施例中,在当前操作***发生热切换后,热插拔设备可以与切换后的操作***建立绑定关系,从而保证了多个操作***对热插拔设备使用的互斥性。
参阅图8,本发明实施例提供的操作***热切换的装置30,所述装置30应用于运行有多个操作***的移动终端,所述多个操作***包括一个前台操作***,以及至少一个后台操作***,每个操作***各自对应一个资源管理命名空间,每个资源管理命名空间包括与其对应的操作***的运行状态信息,所述运行状态信息用于指示所述操作***为前台操作***或后台操作***,并用于指示所述移动终端中的硬件开放对前台操作***的使用或屏蔽对后台操作***的使用,所述硬件为所述用于与外部交互的硬件,其中,当前的前台操作***为第一操作***,所述至少一个后台操作***包括第二操作***,所述装置30包括:
获取单元301,用于获取操作***切换指令,所述操作***切换指令包含所述第二操作***的标识和切换标识,所述第二操作***的标识用于指示将所述第二操作***切换为前台操作***;
释放单元302,用于根据所述获取单元301获取的切换标识,释放所述第一操作***所占用的硬件资源,所述硬件资源为所述移动终端中用于与外部交互的硬件资源;
切换单元303,用于在所述释放单元302释放所述硬件资源后,将所述第一操作***的资源管理命名空间中的运行状态信息修改到后台状态,将所述第二操作***的资源管理命名空间中的运行状态信息修改到前台状态,完成所述前台操作***从所述第一操作***到所述第二操作***的切换。
本发明实施例提供的操作***热切换的装置30,所述装置30应用于运行有多个操作***的移动终端,所述多个操作***包括一个前台操作***,以及至少一个后台操作***,每个操作***各自对应一个资源管理命名空间,每个资源管理命名空间包括与其对应的操作***的运行状态信息,所述运行状态信息用于指示所述操作***为前台操作***或后台操作***,并用于指示所述移动终端中的硬件开放对前台操作***的使用或屏蔽对后台操作***的使用,所述硬件为所述用于与外部交互的硬件,其中,当前的前台操作***为第一操作***,所述至少一个后台操作***包括第二操作***,所述装置30包括:获取单元301获取操作***切换指令,所述操作***切换指令包含所述第二操作*** 的标识和切换标识,所述第二操作***的标识用于指示将所述第二操作***切换为前台操作***;释放单元302根据所述获取单元301获取的切换标识,释放所述第一操作***所占用的硬件资源,所述硬件资源为所述移动终端中用于与外部交互的硬件资源;切换单元303在所述释放单元302释放所述硬件资源后,将所述第一操作***的资源管理命名空间中的运行状态信息修改到后台状态,将所述第二操作***的资源管理命名空间中的运行状态信息修改到前台状态,完成所述前台操作***从所述第一操作***到所述第二操作***的切换。与现有技术中经常会出现多个操作***同时对同一硬件资源进行使用的情况,导致硬件资源使用异常相比,本发明实施例提供的操作***热切换的装置,可以在操作***热切换时,先释放掉当前的前台操作***所占用的硬件资源,并通过资源管理命名空间中的运行状态信息指示硬件资源屏蔽后台操作***对硬件资源的访问,一定程度上保证多个操作***对硬件资源的互斥访问和协调使用,从而保证了操作***切换后硬件资源使用的可靠性。
可选地,在上述图8对应的实施例的基础上,参阅图9,本发明实施例提供的操作***热切换的装置30的第一个可选实施例中,所述装置30还包括:
确定单元304,用于根据所述获取单元301获取的所述第二操作***的标识,从资源全局链表中确定所述第二操作***的资源管理命名空间,所述资源全局链表包括操作***的标识与操作***的资源管理命名空间的对应关系。
本发明实施例中,通过资源全局链表维护与每个操作***对应的各资源管理命名空间,可以加快操作***热切换的速度。
可选地,在上述图8对应的实施例或图9对应的第一个可选实施例的基础上,本发明实施例提供的操作***热切换的装置30的第二个可选实施例中,
所述释放单元302,具体用于根据所述切换标识,解除处于阻塞状态的开始切换标识的阻塞状态,得到解除阻塞的开始切换标识,所述解除阻塞的开始切换标识用于指示资源管理线程通知所述移动终端中的硬件释放所述第一操作***所占用的硬件资源,所述处于阻塞状态的开始切换标识用于指示禁止执行操作***切换。
本发明实施例中,由解除阻塞的开始切换标识来指示释放硬件资源,提高 了硬件资源释放的效率。
可选地,在上述热切换的装置30的第二个可选实施例的基础上,参阅图10,本发明实施例提供的操作***热切换的装置30的第三个可选实施例中,所述装置30还包括:
分配单元305,用于在所述切换单元303完成所述前台操作***从所述第一操作***到所述第二操作***的切换之后,将所述硬件资源分配给所述第二操作***使用;
修改单元306,用于在所述分配单元305将所述硬件资源分配给所述第二操作***使用后,将所述解除阻塞的开始切换标识恢复到阻塞状态。
本发明实施例中,在操作***切换完毕后,及时将解除阻塞的开始切换标识恢复到阻塞状态,从而进一步提高了多个操作***对硬件资源使用的互斥性。
可选地,在上述图8对应的热切换的装置30的实施例以及装置30的第一个、第二个或第三个可选实施例的基础上,参阅图11,本发明实施例提供的操作***热切换的装置30的第四个可选实施例中,所述装置30还包括:
第一监测单元307,用于在所述切换单元303完成所述前台操作***从所述第一操作***到所述第二操作***的切换之后,监测所述移动终端的热插拔接口;
清除单元308,用于当所述第一监测单元307监测到所述第一热插拔设备从所述移动终端拔出,则从所述第一操作***的资源管理命名空间中清除所述第一热插拔设备的在位标记,以解除所述第一热插拔设备与所述第一操作***的绑定关系,所述第一热插拔设备的在位标记用于指示所述第一热插拔设备供所述第一操作***使用。
本发明实施例中,在当前操作***发生切换后,热插拔设备可及时解除与切换前的操作***的绑定关系,保证了多个操作***对热插拔设备使用的互斥性。
可选地,在上述图8对应的热切换的装置30的实施例以及装置30的第一个、第二个、第三个或第四个可选实施例的基础上,参阅图12,本发明实施例提供 的操作***热切换的装置30的第五个可选实施例中,所述装置30还包括:
第二监测单元309,用于监测所述移动终端的热插拔接口;
添加单元311,用于当所述第二监测单元309监测到第二热插拔设备***所述移动终端,则在所述第二操作***的资源管理命名空间中添加所述第二热插拔设备的在位标记,以建立所述第二热插拔设备与所述第二操作***的绑定关系,所述第二热插拔设备的在位标记用于指示第二热插拔设备供所述第二操作***使用。
本发明实施例中,当前操作***切换后,热插拔设备可以与切换后的操作***建立绑定关系,从而保证了多个操作***对热插拔设备使用的互斥性。
本发明实施例提供的操作***热切换的装置30可以参阅图1至图6部分的描述进行理解,本处不做过多赘述。
参阅图13,本发明实施例提供的一种热插拔设备管理的装置40,应用于运行有多个操作***的移动终端,所述移动终端提供热插拔接口,所述热插拔设备通过所述热插拔接口与所述移动终端实现热插拔,所述多个操作***包括一个前台操作***,以及至少一个后台操作***,每个操作***各自对应一个资源管理命名空间,每个资源管理命名空间包括与其对应的操作***的运行状态信息,所述运行状态信息用于指示所述操作***为前台操作***或后台操作***,并用于指示所述移动终端中的硬件开放对前台操作***的使用或屏蔽对后台操作***的使用,所述硬件为所述用于与外部交互的硬件,其中,当前的前台操作***为第一操作***,所述至少一个后台操作***包括第二操作***,所述装置40包括:
监测单元401,用于监测所述移动终端的热插拔接口;
添加单元402,用于当所述监测单元401监测到第一热插拔设备***所述移动终端时,则在所述第一操作***的资源管理命名空间中添加所述第一热插拔设备的在位标记,以建立所述第一热拔插设备与所述第一操作***的绑定关系,所述第一热插拔设备的在位标记用于指示所述第一热插拔设备供所述第一操作***使用;
清除单元403,用于当所述监测单元401监测到第二热插拔设备从所述移动 终端拔出,则从所述第一操作***的资源管理命名空间中清除所述第二热插拔设备的在位标记,以解除所述第二热插拔设备与所述第一操作***的绑定关系,所述第二热插拔设备的在位标记用于指示所述第二热插拔设备供所述第一操作***使用。
本发明实施例提供的一种热插拔设备管理的装置40,应用于运行有多个操作***的移动终端,所述移动终端提供热插拔接口,所述热插拔设备通过所述热插拔接口与所述移动终端实现热插拔,所述多个操作***包括一个前台操作***,以及至少一个后台操作***,每个操作***各自对应一个资源管理命名空间,每个资源管理命名空间包括与其对应的操作***的运行状态信息,所述运行状态信息用于指示所述操作***为前台操作***或后台操作***,并用于指示所述移动终端中的硬件开放对前台操作***的使用或屏蔽对后台操作***的使用,所述硬件为所述用于与外部交互的硬件,其中,当前的前台操作***为第一操作***,所述至少一个后台操作***包括第二操作***,所述装置40包括:监测单元401,用于监测所述移动终端的热插拔接口;添加单元402,用于当所述监测单元401监测到第一热插拔设备***所述移动终端时,则在所述第一操作***的资源管理命名空间中添加所述第一热插拔设备的在位标记,以建立所述第一热拔插设备与所述第一操作***的绑定关系,所述第一热插拔设备的在位标记用于指示所述第一热插拔设备供所述第一操作***使用;清除单元403,用于当所述监测单元401监测到第二热插拔设备从所述移动终端拔出,则从所述第一操作***的资源管理命名空间中清除所述第二热插拔设备的在位标记,以解除所述第二热插拔设备与所述第一操作***的绑定关系,所述第二热插拔设备的在位标记用于指示所述第二热插拔设备供所述第一操作***使用。与现有技术中多个操作***对热插拔设备的使用会发生冲突相比,本发明实施例提供的热插拔设备管理的装置,可以将热拔插设备与当前操作***进行绑定或者解除绑定,从而避免了多个操作***对热插拔设备使用的冲突,保证了多个操作***对热插拔设备使用的互斥性。
可选地,在上述图13对应的实施例的基础上,本发明实施例提供的热插拔设备管理的装置40的另一实施例中,
所述清除单元403,还用于所述前台操作***从所述第一操作***到所述第二操作***后,当所述监测单元监测到所述第一热插拔设备从所述移动终端拔出,则在所述第一操作***的资源管理命名空间中清除所述第一热插拔设备的在位标记,以解除所述第一热拔插设备与所述第一操作***的绑定关系,所述第一热插拔设备的在位标记用于指示所述第一热插拔设备供所述第一操作***使用;
所述添加单元402,还用于当所述面向用户的操作***从第一操作***切换到所述第二操作***后,当所述监测单元监测到所述第二热插拔设备***所述移动终端,则在所述第二操作***的资源管理命名空间中添加所述第二热插拔设备的在位标记,以建立所述第二热插拔设备与所述第二操作***的绑定关系,所述第二热插拔设备的在位标记用于指示所述第二热插拔设备供所述第二操作***使用。
本发明实施例中,在当前操作***发生热切换后,热插拔设备可以与切换后的操作***建立绑定关系,从而保证了多个操作***对热插拔设备使用的互斥性。
本发明实施例提供的热插拔设备管理的装置40可以参阅图5、图7部分的描述进行理解,本处不做过多赘述。
图14描述了本发明实施例提供的一种移动终端600的结构,该移动终端600包括:至少一个处理器601,至少一个网络接口604或者其他用户接口603,存储器605,至少一个通信总线602。通信总线602用于实现这些组件之间的连接通信。该移动终端600可选的包含用户接口603,包括显示器(例如,触摸屏、LCD、CRT、全息成像(Holographic)或者投影(Projector)等),键盘或者点击设备(例如,鼠标,轨迹球(trackball),触感板或者触摸屏等)。
存储器605可以包括只读存储器和随机存取存储器,并向处理器601提供指令和数据。存储器605的一部分还可以包括非易失性随机存取存储器(NVRAM)。
在一些实施方式中,存储器605存储了如下的元素,可执行模块或者数据 结构,或者他们的子集,或者他们的扩展集:
操作***6051,包含各种***程序,例如图3所示的框架层、***运行库层、内核层等,用于实现各种基础业务以及处理基于硬件的任务;
应用程序模块6052,包含各种应用程序,例如图3所示的电话、信息、数据连接、操作***切换接口等,用于实现各种应用业务。
在本发明实施例中,通过调用存储器605存储的程序或指令,处理器601同时运行有多个操作***,所述多个操作***包括一个前台操作***,以及至少一个后台操作***,每个操作***各自对应一个资源管理命名空间,每个资源管理命名空间包括与其对应的操作***的运行状态信息,所述运行状态信息用于指示所述操作***为前台操作***或后台操作***,并用于指示所述移动终端中的硬件开放对前台操作***的使用或屏蔽对后台操作***的使用,所述硬件为所述用于与外部交互的硬件,其中,当前的前台操作***为第一操作***,所述至少一个后台操作***包括第二操作***,
以及,所述处理器601,被配置成:
获取操作***切换指令,所述操作***切换指令包含所述第二操作***的标识和切换标识,所述第二操作***的标识用于指示将所述第二操作***切换为前台操作***;
根据所述切换标识,释放所述第一操作***所占用的所述硬件资源;
将所述第一操作***的资源管理命名空间中的运行状态信息修改到后台状态,将所述第二操作***的资源管理命名空间中的运行状态信息修改到前台状态,完成所述前台操作***从所述第一操作***到所述第二操作***的切换。
与现有技术中经常会出现多个操作***同时对同一硬件资源进行使用的情况,导致硬件资源使用异常相比,本发明实施例提供的操作***热切换的方法,可以在操作***热切换时,先释放掉当前的前台操作***所占用的硬件资源,并通过资源管理命名空间中的运行状态信息指示硬件资源屏蔽后台操作***对硬件资源的访问,一定程度上保证多个操作***对硬件资源的互斥访问和协调使用,从而保证了操作***切换后硬件资源使用的可靠性。
可选地,作为一个实施例,所述处理器601还用于根据所述第二操作***的标识,从资源全局链表中确定所述第二操作***的资源管理命名空间,所述资源全局链表包括操作***的标识与操作***的资源管理命名空间的对应关系。
本发明实施例中,通过资源全局链表维护与每个操作***对应的各资源管理命名空间,可以加快操作***热切换的速度。
可选地,作为一个实施例,所述处理器601具体用于根据所述切换标识,解除处于阻塞状态的开始切换标识的阻塞状态,得到解除阻塞的开始切换标识,所述解除阻塞的开始切换标识用于指示资源管理线程通知所述移动终端中的硬件释放所述第一操作***所占用的硬件资源,所述处于阻塞状态的开始切换标识用于指示禁止执行操作***切换。
本发明实施例中,由解除阻塞的开始切换标识来指示释放硬件资源,提高了硬件资源释放的效率。
可选地,作为一个实施例,所述处理器601还用于完成所述前台操作***从所述第一操作***到所述第二操作***的切换之后,将所述硬件资源分配给所述第二操作***使用;在将所述硬件资源分配给所述第二操作***使用后,将所述解除阻塞的开始切换标识恢复到阻塞状态。
本发明实施例中,在操作***切换完毕后,及时将解除阻塞的开始切换标识恢复到阻塞状态,从而进一步提高了多个操作***对硬件资源使用的互斥性。
可选地,作为一个实施例,所述处理器601还用于完成所述前台操作***从所述第一操作***到所述第二操作***的切换之后,监测所述移动终端的热插拔接口;当监测到第一热插拔设备从所述移动终端拔出,则从所述第一操作***的资源管理命名空间中清除所述第一热插拔设备的在位标记,以解除所述第一热插拔设备与所述第一操作***的绑定关系,所述第一热插拔设备的在位标记用于指示所述第一热插拔设备供所述第一操作***使用。
本发明实施例中,在当前操作***发生切换后,热插拔设备可及时解除与切换前的操作***的绑定关系,保证了多个操作***对热插拔设备使用的互斥 性。
可选地,作为一个实施例,所述处理器601还用于完成所述前台操作***从所述第一操作***到所述第二操作***的切换之后,监测所述移动终端的热插拔接口;当监测到第二热插拔设备***所述移动终端,则在所述第二操作***的资源管理命名空间中添加所述第二热插拔设备的在位标记,以建立所述第二热插拔设备与所述第二操作***的绑定关系,所述第二热插拔设备的在位标记用于指示第二热插拔设备供所述第二操作***使用。
本发明实施例中,当前操作***切换后,热插拔设备可以与切换后的操作***建立绑定关系,从而保证了多个操作***对热插拔设备使用的互斥性。
另外,移动终端600还可执行图1至图6的方法及实施例,本发明实施例在此不再赘述。
本发明实施例提供的移动终端,可以在操作***热切换时,先释放掉当前的前台操作***所占用的硬件资源,并通过资源管理命名空间中的运行状态信息指示硬件资源屏蔽后台操作***对硬件资源的访问,一定程度上保证多个操作***对硬件资源的互斥访问和协调使用,从而保证了操作***切换后硬件资源使用的可靠性。
另外,本发明实施例提供的移动终端通过热插拔接口实现与热插拔设备的连接,所述处理器601同时运行有多个操作***,所述多个操作***包括一个前台操作***,以及至少一个后台操作***,每个操作***各自对应一个资源管理命名空间,每个资源管理命名空间包括与其对应的操作***的运行状态信息,所述运行状态信息用于指示所述操作***为前台操作***或后台操作***,并用于指示所述移动终端中的硬件开放对前台操作***的使用或屏蔽对后台操作***的使用,所述硬件为所述用于与外部交互的硬件,其中,当前的前台操作***为第一操作***,所述至少一个后台操作***包括第二操作***,以及,所述处理器601,被配置成:
监测所述移动终端的热插拔接口;
当监测到第一热插拔设备***所述移动终端时,则在所述第一操作***的资源管理命名空间中添加所述第一热插拔设备的在位标记,以建立所述第一热 拔插设备与所述第一操作***的绑定关系,所述第一热插拔设备的在位标记用于指示所述第一热插拔设备供所述第一操作***使用;
当监测到第二热插拔设备从所述移动终端拔出,则从所述第一操作***的资源管理命名空间中清除所述第二热插拔设备的在位标记,以解除所述第二热插拔设备与所述第一操作***的绑定关系,所述第二热插拔设备的在位标记用于指示所述第二热插拔设备供所述第一操作***使用。
可选地,作为一个实施例,所述处理器601还用于:当所述前台操作***从所述第一操作***到所述第二操作***;
当监测到所述第一热插拔设备从所述移动终端拔出,则在所述第一操作***的资源管理命名空间中清除所述第一热插拔设备的在位标记,以解除所述第一热拔插设备与所述第一操作***的绑定关系,所述第一热插拔设备的在位标记用于指示所述第一热插拔设备供所述第一操作***使用;
当监测到所述第二热插拔设备***所述移动终端,则在所述第二操作***的资源管理命名空间中添加所述第二热插拔设备的在位标记,以建立所述第二热插拔设备与所述第二操作***的绑定关系,所述第二热插拔设备的在位标记用于指示所述第二热插拔设备供所述第二操作***使用。
本发明实施例提供的移动设备,可以将热拔插设备与当前操作***进行绑定或者解除绑定,从而避免了多个操作***对热插拔设备使用的冲突,保证了多个操作***对热插拔设备使用的互斥性。
图15示出的是与本发明实施例提供的移动终端的部分结构的框图。参考图15,移动终端包括:射频(Radio Frequency,RF)电路710、存储器720、输入单元730、显示单元740、传感器750、音频电路760、无线保真(wireless fidelity,WiFi)模块770、处理器780、以及电源790等部件。本领域技术人员可以理解,图15中示出的移动终端结构并不构成对移动终端的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。
下面结合图15对移动终端的各个构成部件进行具体的介绍:
RF电路710可用于收发信息或通话过程中,信号的接收和发送,特别地,将基站的下行信息接收后,给处理器780处理;另外,将设计上行的数据发送 给基站。通常,RF电路710包括但不限于天线、至少一个放大器、收发信机、耦合器、低噪声放大器(Low Noise Amplifier,LNA)、双工器等。此外,RF电路710还可以通过无线通信与网络和其他设备通信。上述无线通信可以使用任一通信标准或协议,包括但不限于全球移动通讯***(Global System of Mobile communication,GSM)、通用分组无线服务(General Packet Radio Service,GPRS)、码分多址(Code Division Multiple Access,CDMA)、宽带码分多址(Wideband Code Division Multiple Access,WCDMA)、长期演进(Long Term Evolution,LTE)、电子邮件、短消息服务(Short Messaging Service,SMS)等。
存储器720可用于存储软件程序以及模块,处理器780通过运行存储在存储器720的软件程序以及模块,从而执行移动终端的各种功能应用以及数据处理。存储器720可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作***、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据移动终端的使用所创建的数据(比如音频数据、电话本等)等。此外,存储器720可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。
输入单元730可用于接收输入的数字或字符信息,以及产生与移动终端的用户设置以及功能控制有关的键信号输入。具体地,输入单元730可包括触控面板731以及其他输入设备732。触控面板731,也称为触摸屏,可收集用户在其上或附近的触摸操作(比如用户使用手指、触笔等任何适合的物体或附件在触控面板731上或在触控面板731附近的操作),并根据预先设定的程式驱动相应的连接装置。可选的,触控面板731可包括触摸检测装置和触摸控制器两个部分。其中,触摸检测装置检测用户的触摸方位,并检测触摸操作带来的信号,将信号传送给触摸控制器;触摸控制器从触摸检测装置上接收触摸信息,并将它转换成触点坐标,再送给处理器780,并能接收处理器780发来的命令并加以执行。此外,可以采用电阻式、电容式、红外线以及表面声波等多种类型实现触控面板731。除了触控面板731,输入单元730还可以包括其他输入设备732。具体地,其他输入设备732可以包括但不限于物理键盘、功能键(比 如音量控制按键、开关按键等)、轨迹球、鼠标、操作杆等中的一种或多种。
显示单元740可用于显示由用户输入的信息或提供给用户的信息以及移动终端的各种菜单。显示单元740可包括显示面板741,可选的,可以采用液晶显示器(Liquid Crystal Display,LCD)、有机发光二极管(Organic Light-Emitting Diode,OLED)等形式来配置显示面板741。进一步的,触控面板731可覆盖显示面板741,当触控面板731检测到在其上或附近的触摸操作后,传送给处理器780以确定触摸事件的类型,随后处理器780根据触摸事件的类型在显示面板741上提供相应的视觉输出。虽然在图15中,触控面板731与显示面板741是作为两个独立的部件来实现移动终端的输入和输入功能,但是在某些实施例中,可以将触控面板731与显示面板741集成而实现移动终端的输入和输出功能。
移动终端还可包括至少一种传感器750,比如光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节显示面板741的亮度,接近传感器可在移动终端移动到耳边时,关闭显示面板741和/或背光。作为运动传感器的一种,加速计传感器可检测各个方向上(一般为三轴)加速度的大小,静止时可检测出重力的大小及方向,可用于识别移动终端姿态的应用(比如横竖屏切换、相关游戏、磁力计姿态校准)、振动识别相关功能(比如计步器、敲击)等;至于移动终端还可配置的陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器,在此不再赘述。
音频电路760、扬声器761,传声器762可提供用户与移动终端之间的音频接口。音频电路760可将接收到的音频数据转换后的电信号,传输到扬声器761,由扬声器761转换为声音信号输出;另一方面,传声器762将收集的声音信号转换为电信号,由音频电路760接收后转换为音频数据,再将音频数据输出处理器780处理后,经RF电路710以发送给比如另一移动终端,或者将音频数据输出至存储器720以便进一步处理。
WiFi属于短距离无线传输技术,移动终端通过WiFi模块770可以帮助用户收发电子邮件、浏览网页和访问流式媒体等,它为用户提供了无线的宽带互联网访问。虽然图15示出了WiFi模块770,但是可以理解的是,其并不属于 移动终端的必须构成,完全可以根据需要在不改变发明的本质的范围内而省略。
处理器780是移动终端的控制中心,利用各种接口和线路连接整个移动终端的各个部分,通过运行或执行存储在存储器720内的软件程序和/或模块,以及调用存储在存储器720内的数据,执行移动终端的各种功能和处理数据,从而对移动终端进行整体监控。可选的,处理器780可包括一个或多个处理单元;优选的,处理器780可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作***、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器780中。
移动终端还包括给各个部件供电的电源790(比如电池),优选的,电源可以通过电源管理***与处理器780逻辑相连,从而通过电源管理***实现管理充电、放电、以及功耗管理等功能。
尽管未示出,移动终端还可以包括摄像头、蓝牙模块等,在此不再赘述。
本发明实施例提供的处理器780同时运行有多个操作***,所述多个操作***包括一个前台操作***,以及至少一个后台操作***,每个操作***各自对应一个资源管理命名空间,每个资源管理命名空间包括与其对应的操作***的运行状态信息,所述运行状态信息用于指示所述操作***为前台操作***或后台操作***,并用于指示所述移动终端中的硬件开放对前台操作***的使用或屏蔽对后台操作***的使用,所述硬件为所述用于与外部交互的硬件,其中,当前的前台操作***为第一操作***,所述至少一个后台操作***包括第二操作***,
以及,所述处理器780,被配置成:
获取操作***切换指令,所述操作***切换指令包含所述第二操作***的标识和切换标识,所述第二操作***的标识用于指示将所述第二操作***切换为前台操作***;
根据所述切换标识,释放所述第一操作***所占用的所述硬件资源;
将所述第一操作***的资源管理命名空间中的运行状态信息修改到后台状态,将所述第二操作***的资源管理命名空间中的运行状态信息修改到前台 状态,完成所述前台操作***从所述第一操作***到所述第二操作***的切换。
与现有技术中经常会出现多个操作***同时对同一硬件资源进行使用的情况,导致硬件资源使用异常相比,本发明实施例提供的操作***热切换的方法,可以在操作***热切换时,先释放掉当前的前台操作***所占用的硬件资源,并通过资源管理命名空间中的运行状态信息指示硬件资源屏蔽后台操作***对硬件资源的访问,一定程度上保证多个操作***对硬件资源的互斥访问和协调使用,从而保证了操作***切换后硬件资源使用的可靠性。
可选地,作为一个实施例,所述处理器780还用于根据所述第二操作***的标识,从资源全局链表中确定所述第二操作***的资源管理命名空间,所述资源全局链表包括操作***的标识与操作***的资源管理命名空间的对应关系。
本发明实施例中,通过资源全局链表维护与每个操作***对应的各资源管理命名空间,可以加快操作***热切换的速度。
可选地,作为一个实施例,所述处理器780具体用于根据所述切换标识,解除处于阻塞状态的开始切换标识的阻塞状态,得到解除阻塞的开始切换标识,所述解除阻塞的开始切换标识用于指示资源管理线程通知所述移动终端中的硬件释放所述第一操作***所占用的硬件资源,所述处于阻塞状态的开始切换标识用于指示禁止执行操作***切换。
本发明实施例中,由解除阻塞的开始切换标识来指示释放硬件资源,提高了硬件资源释放的效率。
可选地,作为一个实施例,所述处理器780还用于完成所述前台操作***从所述第一操作***到所述第二操作***的切换之后,将所述硬件资源分配给所述第二操作***使用;在将所述硬件资源分配给所述第二操作***使用后,将所述解除阻塞的开始切换标识恢复到阻塞状态。
本发明实施例中,在操作***切换完毕后,及时将解除阻塞的开始切换标识恢复到阻塞状态,从而进一步提高了多个操作***对硬件资源使用的互斥性。
可选地,作为一个实施例,所述处理器780还用于完成所述前台操作***从所述第一操作***到所述第二操作***的切换之后,监测所述移动终端的热插拔接口;当监测到第一热插拔设备从所述移动终端拔出,则从所述第一操作***的资源管理命名空间中清除所述第一热插拔设备的在位标记,以解除所述第一热插拔设备与所述第一操作***的绑定关系,所述第一热插拔设备的在位标记用于指示所述第一热插拔设备供所述第一操作***使用。
本发明实施例中,在当前操作***发生切换后,热插拔设备可及时解除与切换前的操作***的绑定关系,保证了多个操作***对热插拔设备使用的互斥性。
可选地,作为一个实施例,所述处理器780还用于完成所述前台操作***从所述第一操作***到所述第二操作***的切换之后,监测所述移动终端的热插拔接口;当监测到第二热插拔设备***所述移动终端,则在所述第二操作***的资源管理命名空间中添加所述第二热插拔设备的在位标记,以建立所述第二热插拔设备与所述第二操作***的绑定关系,所述第二热插拔设备的在位标记用于指示第二热插拔设备供所述第二操作***使用。
本发明实施例中,当前操作***切换后,热插拔设备可以与切换后的操作***建立绑定关系,从而保证了多个操作***对热插拔设备使用的互斥性。
另外,移动终端还可执行图1至图6的方法及实施例,本发明实施例在此不再赘述。
本发明实施例提供的移动终端,可以在操作***热切换时,先释放掉当前的前台操作***所占用的硬件资源,并通过资源管理命名空间中的运行状态信息指示硬件资源屏蔽后台操作***对硬件资源的访问,一定程度上保证多个操作***对硬件资源的互斥访问和协调使用,从而保证了操作***切换后硬件资源使用的可靠性。
另外,本发明实施例提供的移动终端通过热插拔接口实现与热插拔设备的连接,所述处理器780同时运行有多个操作***,所述多个操作***包括一个前台操作***,以及至少一个后台操作***,每个操作***各自对应一个资源管理命名空间,每个资源管理命名空间包括与其对应的操作***的运行状态信 息,所述运行状态信息用于指示所述操作***为前台操作***或后台操作***,并用于指示所述移动终端中的硬件开放对前台操作***的使用或屏蔽对后台操作***的使用,所述硬件为所述用于与外部交互的硬件,其中,当前的前台操作***为第一操作***,所述至少一个后台操作***包括第二操作***,以及,所述处理器780,被配置成:
监测所述移动终端的热插拔接口;
当监测到第一热插拔设备***所述移动终端时,则在所述第一操作***的资源管理命名空间中添加所述第一热插拔设备的在位标记,以建立所述第一热拔插设备与所述第一操作***的绑定关系,所述第一热插拔设备的在位标记用于指示所述第一热插拔设备供所述第一操作***使用;
当监测到第二热插拔设备从所述移动终端拔出,则从所述第一操作***的资源管理命名空间中清除所述第二热插拔设备的在位标记,以解除所述第二热插拔设备与所述第一操作***的绑定关系,所述第二热插拔设备的在位标记用于指示所述第二热插拔设备供所述第一操作***使用。
可选地,作为一个实施例,所述处理器780还用于:当所述前台操作***从所述第一操作***到所述第二操作***;
当监测到所述第一热插拔设备从所述移动终端拔出,则在所述第一操作***的资源管理命名空间中清除所述第一热插拔设备的在位标记,以解除所述第一热拔插设备与所述第一操作***的绑定关系,所述第一热插拔设备的在位标记用于指示所述第一热插拔设备供所述第一操作***使用;
当监测到所述第二热插拔设备***所述移动终端,则在所述第二操作***的资源管理命名空间中添加所述第二热插拔设备的在位标记,以建立所述第二热插拔设备与所述第二操作***的绑定关系,所述第二热插拔设备的在位标记用于指示所述第二热插拔设备供所述第二操作***使用。
本发明实施例提供的移动设备,可以将热拔插设备与当前操作***进行绑定或者解除绑定,从而避免了多个操作***对热插拔设备使用的冲突,保证了多个操作***对热插拔设备使用的互斥性。
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步 骤是可以通过程序来指令相关的硬件(例如处理器)来完成,该程序可以存储于一计算机可读存储介质中,存储介质可以包括:ROM、RAM、磁盘或光盘等。
以上对本发明实施例所提供的操作***热切换的方法、装置以及移动终端进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。

Claims (24)

  1. 一种操作***热切换的方法,其特征在于,所述方法应用于运行有多个操作***的移动终端,所述多个操作***包括一个前台操作***,以及至少一个后台操作***,每个操作***各自对应一个资源管理命名空间,每个资源管理命名空间包括与其对应的操作***的运行状态信息,所述运行状态信息用于指示所述操作***为前台操作***或后台操作***,并用于指示所述移动终端中的硬件开放对前台操作***的使用或屏蔽对后台操作***的使用,所述硬件为所述用于与外部交互的硬件,其中,当前的前台操作***为第一操作***,所述至少一个后台操作***包括第二操作***,所述方法包括:
    获取操作***切换指令,所述操作***切换指令包含所述第二操作***的标识和切换标识,所述第二操作***的标识用于指示将所述第二操作***切换为前台操作***;
    根据所述切换标识,释放所述第一操作***所占用的硬件资源,所述硬件资源为所述移动终端中用于与外部交互的硬件资源;
    将所述第一操作***的资源管理命名空间中的运行状态信息修改到后台状态,将所述第二操作***的资源管理命名空间中的运行状态信息修改到前台状态,完成所述前台操作***从所述第一操作***到所述第二操作***的切换。
  2. 根据权利要求1所述的方法,其特征在于,所述根据所述切换标识,释放所述第一操作***所占用的硬件资源,所述硬件资源为所述移动终端中用于与外部交互的硬件资源之后,所述方法还包括:
    根据所述第二操作***的标识,从资源全局链表中确定所述第二操作***的资源管理命名空间,所述资源全局链表包括操作***的标识与操作***的资源管理命名空间的对应关系。
  3. 根据权利要求1或2所述的方法,其特征在于,所述根据所述切换标识,释放所述第一操作***所占用的硬件资源,包括:
    根据所述切换标识,解除处于阻塞状态的开始切换标识的阻塞状态,得到解除阻塞的开始切换标识,所述解除阻塞的开始切换标识用于指示资源管理线 程通知所述移动终端中的硬件释放所述第一操作***所占用的硬件资源,所述处于阻塞状态的开始切换标识用于指示禁止执行操作***切换。
  4. 根据权利要求3所述的方法,其特征在于,所述完成所述前台操作***从所述第一操作***到所述第二操作***的切换之后,所述方法还包括:
    将所述硬件资源分配给所述第二操作***使用;
    在将所述硬件资源分配给所述第二操作***使用后,将所述解除阻塞的开始切换标识恢复到阻塞状态。
  5. 根据权利要求1-4任一项所述的方法,其特征在于,所述完成所述前台操作***从所述第一操作***到所述第二操作***的切换之后,所述方法还包括:
    监测所述移动终端的热插拔接口;
    当监测到第一热插拔设备从所述移动终端拔出,则从所述第一操作***的资源管理命名空间中清除所述第一热插拔设备的在位标记,以解除所述第一热插拔设备与所述第一操作***的绑定关系,所述第一热插拔设备的在位标记用于指示所述第一热插拔设备供所述第一操作***使用。
  6. 根据权利要求1-5任一项所述的方法,其特征在于,所述完成所述前台操作***从所述第一操作***到所述第二操作***的切换之后,所述方法还包括:
    监测所述移动终端的热插拔接口;
    当监测到第二热插拔设备***所述移动终端,则在所述第二操作***的资源管理命名空间中添加所述第二热插拔设备的在位标记,以建立所述第二热插拔设备与所述第二操作***的绑定关系,所述第二热插拔设备的在位标记用于指示第二热插拔设备供所述第二操作***使用。
  7. 一种热插拔设备管理的方法,其特征在于,所述方法应用于运行有多个操作***的移动终端,所述移动终端提供热插拔接口,所述热插拔设备通过所述热插拔接口与所述移动终端实现热插拔,所述多个操作***包括一个前台操作***,以及至少一个后台操作***,每个操作***各自对应一个资源管理命名空间,每个资源管理命名空间包括与其对应的操作***的运行状态信息, 所述运行状态信息用于指示所述操作***为前台操作***或后台操作***,并用于指示所述移动终端中的硬件开放对前台操作***的使用或屏蔽对后台操作***的使用,所述硬件为所述用于与外部交互的硬件,其中,当前的前台操作***为第一操作***,所述至少一个后台操作***包括第二操作***,所述方法包括:
    监测所述移动终端的热插拔接口;
    当监测到第一热插拔设备***所述移动终端时,则在所述第一操作***的资源管理命名空间中添加所述第一热插拔设备的在位标记,以建立所述第一热拔插设备与所述第一操作***的绑定关系,所述第一热插拔设备的在位标记用于指示所述第一热插拔设备供所述第一操作***使用;
    当监测到第二热插拔设备从所述移动终端拔出,则从所述第一操作***的资源管理命名空间中清除所述第二热插拔设备的在位标记,以解除所述第二热插拔设备与所述第一操作***的绑定关系,所述第二热插拔设备的在位标记用于指示所述第二热插拔设备供所述第一操作***使用。
  8. 根据权利要求7所述的方法,其特征在于,当所述前台操作***从所述第一操作***到所述第二操作***,所述方法还包括:
    当监测到所述第一热插拔设备从所述移动终端拔出,则在所述第一操作***的资源管理命名空间中清除所述第一热插拔设备的在位标记,以解除所述第一热拔插设备与所述第一操作***的绑定关系,所述第一热插拔设备的在位标记用于指示所述第一热插拔设备供所述第一操作***使用;
    当监测到所述第二热插拔设备***所述移动终端,则在所述第二操作***的资源管理命名空间中添加所述第二热插拔设备的在位标记,以建立所述第二热插拔设备与所述第二操作***的绑定关系,所述第二热插拔设备的在位标记用于指示所述第二热插拔设备供所述第二操作***使用。
  9. 一种操作***热切换的装置,其特征在于,所述装置应用于运行有多个操作***的移动终端,所述多个操作***包括一个前台操作***,以及至少一个后台操作***,每个操作***各自对应一个资源管理命名空间,每个资源管理命名空间包括与其对应的操作***的运行状态信息,所述运行状态信息用 于指示所述操作***为前台操作***或后台操作***,并用于指示所述移动终端中的硬件开放对前台操作***的使用或屏蔽对后台操作***的使用,所述硬件为所述用于与外部交互的硬件,其中,当前的前台操作***为第一操作***,所述至少一个后台操作***包括第二操作***,所述装置包括:
    获取单元,用于获取操作***切换指令,所述操作***切换指令包含所述第二操作***的标识和切换标识,所述第二操作***的标识用于指示将所述第二操作***切换为前台操作***;
    释放单元,用于根据所述获取单元获取的切换标识,释放所述第一操作***所占用的硬件资源,所述硬件资源为所述移动终端中用于与外部交互的硬件资源;
    切换单元,用于在所述释放单元释放所述硬件资源后,将所述第一操作***的资源管理命名空间中的运行状态信息修改到后台状态,将所述第二操作***的资源管理命名空间中的运行状态信息修改到前台状态,完成所述前台操作***从所述第一操作***到所述第二操作***的切换。
  10. 根据权利要求9所述的装置,其特征在于,所述装置还包括:
    确定单元,用于根据所述获取单元获取的所述第二操作***的标识,从资源全局链表中确定所述第二操作***的资源管理命名空间,所述资源全局链表包括操作***的标识与操作***的资源管理命名空间的对应关系。
  11. 根据权利要求9或10所述的装置,其特征在于,
    所述释放单元,具体用于根据所述切换标识,解除处于阻塞状态的开始切换标识的阻塞状态,得到解除阻塞的开始切换标识,所述解除阻塞的开始切换标识用于指示资源管理线程通知所述移动终端中的硬件释放所述第一操作***所占用的硬件资源,所述处于阻塞状态的开始切换标识用于指示禁止执行操作***切换。
  12. 根据权利要求11所述的装置,其特征在于,所述装置还包括:
    分配单元,用于在所述切换单元完成所述前台操作***从所述第一操作***到所述第二操作***的切换之后,将所述硬件资源分配给所述第二操作***使用;
    修改单元,用于在所述分配单元将所述硬件资源分配给所述第二操作***使用后,将所述解除阻塞的开始切换标识恢复到阻塞状态。
  13. 根据权利要求9-12任一项所述的装置,其特征在于,所述装置还包括:
    第一监测单元,用于在所述切换单元完成所述前台操作***从所述第一操作***到所述第二操作***的切换之后,监测所述移动终端的热插拔接口;
    清除单元,用于当所述第一监测单元监测到所述第一热插拔设备从所述移动终端拔出,则从所述第一操作***的资源管理命名空间中清除所述第一热插拔设备的在位标记,以解除所述第一热插拔设备与所述第一操作***的绑定关系,所述第一热插拔设备的在位标记用于指示所述第一热插拔设备供所述第一操作***使用。
  14. 根据权利要求9-13任一项所述的装置,其特征在于,所述装置还包括:
    第二监测单元,用于监测所述移动终端的热插拔接口;
    添加单元,用于当所述第二监测单元监测到第二热插拔设备***所述移动终端,则在所述第二操作***的资源管理命名空间中添加所述第二热插拔设备的在位标记,以建立所述第二热插拔设备与所述第二操作***的绑定关系,所述第二热插拔设备的在位标记用于指示第二热插拔设备供所述第二操作***使用。
  15. 一种热插拔设备管理的装置,其特征在于,所述装置应用于运行有多个操作***的移动终端,所述移动终端提供热插拔接口,所述热插拔设备通过所述热插拔接口与所述移动终端实现热插拔,所述多个操作***包括一个前台操作***,以及至少一个后台操作***,每个操作***各自对应一个资源管理命名空间,每个资源管理命名空间包括与其对应的操作***的运行状态信息,所述运行状态信息用于指示所述操作***为前台操作***或后台操作***,并用于指示所述移动终端中的硬件开放对前台操作***的使用或屏蔽对后台操作***的使用,所述硬件为所述用于与外部交互的硬件,其中,当前的前台操作***为第一操作***,所述至少一个后台操作***包括第二操作***,所述装置包括:
    监测单元,用于监测所述移动终端的热插拔接口;
    添加单元,用于当所述监测单元监测到第一热插拔设备***所述移动终端时,则在所述第一操作***的资源管理命名空间中添加所述第一热插拔设备的在位标记,以建立所述第一热拔插设备与所述第一操作***的绑定关系,所述第一热插拔设备的在位标记用于指示所述第一热插拔设备供所述第一操作***使用;
    清除单元,用于当所述监测单元监测到第二热插拔设备从所述移动终端拔出,则从所述第一操作***的资源管理命名空间中清除所述第二热插拔设备的在位标记,以解除所述第二热插拔设备与所述第一操作***的绑定关系,所述第二热插拔设备的在位标记用于指示所述第二热插拔设备供所述第一操作***使用。
  16. 根据权利要求15所述的装置,其特征在于,
    所述清除单元,还用于所述前台操作***从所述第一操作***到所述第二操作***后,当所述监测单元监测到所述第一热插拔设备从所述移动终端拔出,则在所述第一操作***的资源管理命名空间中清除所述第一热插拔设备的在位标记,以解除所述第一热拔插设备与所述第一操作***的绑定关系,所述第一热插拔设备的在位标记用于指示所述第一热插拔设备供所述第一操作***使用;
    所述添加单元,还用于当所述面向用户的操作***从第一操作***切换到所述第二操作***后,当所述监测单元监测到所述第二热插拔设备***所述移动终端,则在所述第二操作***的资源管理命名空间中添加所述第二热插拔设备的在位标记,以建立所述第二热插拔设备与所述第二操作***的绑定关系,所述第二热插拔设备的在位标记用于指示所述第二热插拔设备供所述第二操作***使用。
  17. 一种移动终端,其特征在于,所述移动终端包括处理器,存储器和硬件资源,所述硬件资源为所述移动终端中用于与外部交互的硬件资源,其中,所述处理器同时运行有多个操作***,所述多个操作***包括一个前台操作***,以及至少一个后台操作***,每个操作***各自对应一个资源管理命名空间,每个资源管理命名空间包括与其对应的操作***的运行状态信息,所述运 行状态信息用于指示所述操作***为前台操作***或后台操作***,并用于指示所述移动终端中的硬件开放对前台操作***的使用或屏蔽对后台操作***的使用,所述硬件为所述用于与外部交互的硬件,其中,当前的前台操作***为第一操作***,所述至少一个后台操作***包括第二操作***,
    以及,所述处理器,被配置成:
    获取操作***切换指令,所述操作***切换指令包含所述第二操作***的标识和切换标识,所述第二操作***的标识用于指示将所述第二操作***切换为前台操作***;
    根据所述切换标识,释放所述第一操作***所占用的所述硬件资源;
    将所述第一操作***的资源管理命名空间中的运行状态信息修改到后台状态,将所述第二操作***的资源管理命名空间中的运行状态信息修改到前台状态,完成所述前台操作***从所述第一操作***到所述第二操作***的切换。
  18. 根据权利要求17所述的移动终端,其特征在于,
    所述处理器,还被配置成:
    根据所述第二操作***的标识,从资源全局链表中确定所述第二操作***的资源管理命名空间,所述资源全局链表包括操作***的标识与操作***的资源管理命名空间的对应关系。
  19. 根据权利要求17或18所述的移动终端,其特征在于,
    所述处理器,具体被配置成:
    根据所述切换标识,解除处于阻塞状态的开始切换标识的阻塞状态,得到解除阻塞的开始切换标识,所述解除阻塞的开始切换标识用于指示资源管理线程通知所述移动终端中的硬件释放所述第一操作***所占用的硬件资源,所述处于阻塞状态的开始切换标识用于指示禁止执行操作***切换。
  20. 根据权利要求19所述的移动终端,其特征在于,
    所述处理器,还被配置成:
    将所述硬件资源分配给所述第二操作***使用;
    在将所述硬件资源分配给所述第二操作***使用后,将所述解除阻塞的开 始切换标识恢复到阻塞状态。
  21. 根据权利要求17-20任一所述的移动终端,其特征在于,
    所述处理器,还被配置成:
    监测所述移动终端的热插拔接口;
    当监测到第一热插拔设备从所述移动终端拔出,则从所述第一操作***的资源管理命名空间中清除所述第一热插拔设备的在位标记,以解除所述第一热插拔设备与所述第一操作***的绑定关系,所述第一热插拔设备的在位标记用于指示所述第一热插拔设备供所述第一操作***使用。
  22. 根据权利要求17-21任一所述的移动终端,其特征在于,
    所述处理器,还被配置成:
    监测所述移动终端的热插拔接口;
    当监测到第二热插拔设备***所述移动终端,则在所述第二操作***的资源管理命名空间中添加所述第二热插拔设备的在位标记,以建立所述第二热插拔设备与所述第二操作***的绑定关系,所述第二热插拔设备的在位标记用于指示第二热插拔设备供所述第二操作***使用。
  23. 一种移动终端,其特征在于,所述移动终端包括处理器,存储器、硬件资源和热插拔接口,所述硬件资源为所述移动终端中用于与外部交互的硬件资源,热插拔设备通过所述热插拔接口与所述移动终端实现热插拔,其中,所述处理器同时运行有多个操作***,所述多个操作***包括一个前台操作***,以及至少一个后台操作***,每个操作***各自对应一个资源管理命名空间,每个资源管理命名空间包括与其对应的操作***的运行状态信息,所述运行状态信息用于指示所述操作***为前台操作***或后台操作***,并用于指示所述移动终端中的硬件开放对前台操作***的使用或屏蔽对后台操作***的使用,所述硬件为所述用于与外部交互的硬件,其中,当前的前台操作***为第一操作***,所述至少一个后台操作***包括第二操作***,
    以及,所述处理器,被配置成:
    监测所述移动终端的热插拔接口;
    当监测到第一热插拔设备***所述移动终端时,则在所述第一操作***的 资源管理命名空间中添加所述第一热插拔设备的在位标记,以建立所述第一热拔插设备与所述第一操作***的绑定关系,所述第一热插拔设备的在位标记用于指示所述第一热插拔设备供所述第一操作***使用;
    当监测到第二热插拔设备从所述移动终端拔出,则从所述第一操作***的资源管理命名空间中清除所述第二热插拔设备的在位标记,以解除所述第二热插拔设备与所述第一操作***的绑定关系,所述第二热插拔设备的在位标记用于指示所述第二热插拔设备供所述第一操作***使用。
  24. 根据权利要求23所述的移动终端,其特征在于,当所述前台操作***从所述第一操作***到所述第二操作***,
    所述处理器,还被配置成:
    当监测到所述第一热插拔设备从所述移动终端拔出,则在所述第一操作***的资源管理命名空间中清除所述第一热插拔设备的在位标记,以解除所述第一热拔插设备与所述第一操作***的绑定关系,所述第一热插拔设备的在位标记用于指示所述第一热插拔设备供所述第一操作***使用;
    当监测到所述第二热插拔设备***所述移动终端,则在所述第二操作***的资源管理命名空间中添加所述第二热插拔设备的在位标记,以建立所述第二热插拔设备与所述第二操作***的绑定关系,所述第二热插拔设备的在位标记用于指示所述第二热插拔设备供所述第二操作***使用。
PCT/CN2015/082859 2014-12-12 2015-06-30 一种操作***热切换的方法、装置及移动终端 WO2016090902A1 (zh)

Priority Applications (3)

Application Number Priority Date Filing Date Title
EP15866553.9A EP3223151B1 (en) 2014-12-12 2015-06-30 Hot-switching method and device for operating systems, and mobile terminal
KR1020177019225A KR101941618B1 (ko) 2014-12-12 2015-06-30 운영체제 핫-스위칭 방법 및 장치 및 이동 단말
US15/620,291 US10437631B2 (en) 2014-12-12 2017-06-12 Operating system hot-switching method and apparatus and mobile terminal

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410767954.5 2014-12-12
CN201410767954.5A CN104516760B (zh) 2014-12-12 2014-12-12 一种操作***热切换的方法、装置及移动终端

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US15/620,291 Continuation US10437631B2 (en) 2014-12-12 2017-06-12 Operating system hot-switching method and apparatus and mobile terminal

Publications (1)

Publication Number Publication Date
WO2016090902A1 true WO2016090902A1 (zh) 2016-06-16

Family

ID=52792123

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/082859 WO2016090902A1 (zh) 2014-12-12 2015-06-30 一种操作***热切换的方法、装置及移动终端

Country Status (5)

Country Link
US (1) US10437631B2 (zh)
EP (1) EP3223151B1 (zh)
KR (1) KR101941618B1 (zh)
CN (1) CN104516760B (zh)
WO (1) WO2016090902A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10849053B2 (en) 2016-05-27 2020-11-24 Huawei Technologies Co., Ltd. Method and apparatus for accessing WI-FI Network

Families Citing this family (39)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104516760B (zh) * 2014-12-12 2018-01-09 华为技术有限公司 一种操作***热切换的方法、装置及移动终端
CN106155670A (zh) * 2015-04-22 2016-11-23 宇龙计算机通信科技(深圳)有限公司 一种移动终端及其刷机方法和装置
CN106201565A (zh) * 2015-05-08 2016-12-07 宇龙计算机通信科技(深圳)有限公司 一种多操作***终端挂载sd卡的方法、装置及终端
KR102322033B1 (ko) * 2015-07-21 2021-11-04 삼성전자주식회사 운영 체제 간 디스크 이미지를 공유하는 방법 및 디바이스
CN104991811B (zh) * 2015-08-07 2019-07-26 北京元心科技有限公司 隔离***切换时进程运行状态的调整方法以及智能终端
CN105045669A (zh) * 2015-08-26 2015-11-11 北京元心科技有限公司 容器***的管理服务方法以及智能终端
CN105204932A (zh) * 2015-08-26 2015-12-30 北京元心科技有限公司 智能终端及其应用程序状态控制方法
CN105183558B (zh) * 2015-08-26 2018-11-16 北京元心科技有限公司 智能终端及其容器***的管理方法
CN105204925A (zh) * 2015-08-26 2015-12-30 北京元心科技有限公司 在多操作***中管理音视频设备的方法及装置
CN105472843A (zh) * 2015-12-08 2016-04-06 北京元心科技有限公司 一种基于容器的多***移动设备的背光灯控制方法和装置
CN105528320B (zh) * 2015-12-11 2020-02-07 北京元心科技有限公司 主设备通过usb与从设备建立连接的方法及装置
CN105511970A (zh) * 2015-12-11 2016-04-20 北京元心科技有限公司 智能终端及其传感器控制方法
CN105573934B (zh) * 2015-12-11 2019-11-12 北京元心科技有限公司 运行多***的从设备通过usb连接接入主设备的方法及装置
CN105929426B (zh) * 2016-04-21 2019-04-02 北京元心科技有限公司 多***中gps定位的方法及装置
CN105912954A (zh) * 2016-05-16 2016-08-31 北京珠穆朗玛移动通信有限公司 一种适用于移动终端的私密信息保护方法及***
JP6783382B2 (ja) 2016-09-09 2020-11-11 華為技術有限公司Huawei Technologies Co.,Ltd. 通知メッセージを関連付けるための方法、装置、およびモバイル端末
CN107959872A (zh) 2016-10-18 2018-04-24 杭州海康威视***技术有限公司 一种视频切换方法、装置及视频巡逻***
CN106776065B (zh) * 2016-11-29 2020-09-08 北京元心科技有限公司 多***使用Mtp功能的方法及装置
CN106681817B (zh) * 2016-12-27 2021-01-15 宇龙计算机通信科技(深圳)有限公司 一种终端控制方法以及终端
CN108255683B (zh) * 2016-12-29 2021-06-22 华为技术有限公司 终端中消息提示的方法和终端
CN109408134B (zh) * 2017-08-16 2022-04-08 阿里巴巴集团控股有限公司 模型文件的处理方法、装置、***以及处理设备
CN108491272B (zh) * 2018-03-29 2022-08-19 青岛海信传媒网络技术有限公司 资源控制方法、装置及终端设备
WO2020102982A1 (zh) * 2018-11-20 2020-05-28 深圳市欢太科技有限公司 通话处理方法、计算机可读存储介质和电子设备
CN111290792A (zh) * 2018-12-07 2020-06-16 成都鼎桥通信技术有限公司 一种多容器域极速进行***切换的方法
CN111736452B (zh) * 2019-03-25 2023-04-07 成都鼎桥通信技术有限公司 多***控制方法、装置、设备以及存储介质
CN112948003B (zh) * 2019-11-26 2022-07-29 成都鼎桥通信技术有限公司 双安卓终端进行操作***切换的方法和设备
CN112860322B (zh) * 2019-11-26 2022-04-26 成都鼎桥通信技术有限公司 操作***切换方法、装置、设备和存储介质
CN112905275A (zh) * 2019-12-03 2021-06-04 斑马智行网络(香港)有限公司 用于多操作***的显示方法和显示设备
CN113127069B (zh) * 2019-12-31 2023-08-22 成都鼎桥通信技术有限公司 基于双***的位置服务管理方法、装置和终端设备
CN113467838B (zh) * 2020-03-30 2023-07-28 成都鼎桥通信技术有限公司 一种双***切换方法和装置
CN111796939B (zh) * 2020-06-30 2024-05-24 联想(北京)有限公司 一种处理方法、装置及电子设备
CN114691219A (zh) * 2020-12-31 2022-07-01 成都鼎桥通信技术有限公司 ***切换方法、装置、穿戴设备及用户终端
CN115080126A (zh) * 2021-03-12 2022-09-20 Oppo广东移动通信有限公司 共用硬件的切换方法、装置、电子设备及存储介质
CN113176899A (zh) * 2021-03-15 2021-07-27 西安神鸟软件科技有限公司 一种多安卓操作***的运行方法及终端设备
CN113407318B (zh) * 2021-06-04 2023-06-23 Oppo广东移动通信有限公司 操作***切换方法及装置、计算机可读介质和电子设备
CN113391864A (zh) * 2021-06-09 2021-09-14 锐捷网络(苏州)有限公司 云桌面切换方法及***
CN114047964B (zh) * 2022-01-13 2022-05-10 麒麟软件有限公司 一种在Linux兼容Android***时使Android支持摄像头热插拔的方法
CN116278744B (zh) * 2023-05-18 2023-09-12 小米汽车科技有限公司 数据显示方法、装置、车辆及存储介质
US11983541B1 (en) * 2023-05-19 2024-05-14 Lowe's Companies, Inc. Operation-specific device configuration

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102135910A (zh) * 2011-03-03 2011-07-27 威盛电子股份有限公司 切换操作***的方法及使用此方法的电子装置
WO2013101139A1 (en) * 2011-12-30 2013-07-04 Intel Corporation Providing an asymmetric multicore processor system transparently to an operating system
CN103309737A (zh) * 2012-03-07 2013-09-18 联想(北京)有限公司 一种切换操作***的方法及设备
CN104516760A (zh) * 2014-12-12 2015-04-15 华为技术有限公司 一种操作***热切换的方法、装置及移动终端

Family Cites Families (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9098437B2 (en) * 2010-10-01 2015-08-04 Z124 Cross-environment communication framework
JP4342576B2 (ja) * 2006-07-25 2009-10-14 株式会社エヌ・ティ・ティ・ドコモ 複数オペレーティングシステム切替制御装置及びコンピュータシステム
CN100552633C (zh) * 2006-07-25 2009-10-21 株式会社Ntt都科摩 多个操作***切换控制装置以及计算机***
JP4233585B2 (ja) * 2006-07-25 2009-03-04 株式会社エヌ・ティ・ティ・ドコモ ペリフェラル切替装置及びペリフェラル切替制御装置
US9176765B2 (en) * 2006-09-25 2015-11-03 Lenovo (Beijing) Limited Virtual machine system and a method for sharing a graphics card amongst virtual machines
US8286195B2 (en) * 2007-10-31 2012-10-09 Microsoft Corporation Controlling hardware across two or more simultaneously running operating systems
US8239667B2 (en) * 2008-11-13 2012-08-07 Intel Corporation Switching between multiple operating systems (OSes) using sleep state management and sequestered re-baseable memory
CN101620471B (zh) * 2009-08-07 2011-06-15 福建升腾资讯有限公司 一种单主机多***的实现方法
US8433889B2 (en) * 2010-04-28 2013-04-30 Acer Cloud Technology, Inc. Operating system context switching
US9804857B2 (en) * 2010-12-17 2017-10-31 Intel Corporation Method and apparatus for multi-mode mobile computing devices and peripherals
KR101780052B1 (ko) * 2011-08-24 2017-09-19 한국전자통신연구원 정보처리 시스템에서 운영체제 전환방법
CN102420911A (zh) 2011-12-31 2012-04-18 深圳市金立通信设备有限公司 智能手机双***切换装置及切换方法
CN103294545B (zh) * 2012-02-23 2017-07-04 纬创资通股份有限公司 切换双操作***的方法以及电子装置
CN103294970B (zh) * 2012-02-23 2015-12-09 纬创资通股份有限公司 双操作***共用加密设定的方法以及电子装置
KR20130104958A (ko) 2012-03-16 2013-09-25 삼성전자주식회사 다중 운영체제들을 실행하는 장치 및 방법
CN102638728A (zh) 2012-03-30 2012-08-15 江苏幻影视讯科技有限公司 一种多***切换的方法与数字家庭智能终端
CN103425520B (zh) * 2012-05-21 2019-03-08 联想(北京)有限公司 事件响应方法和电子设备
CN103744729B (zh) * 2014-01-24 2017-03-29 福州瑞芯微电子股份有限公司 可切换操作***的电脑***
US9830178B2 (en) * 2014-03-06 2017-11-28 Intel Corporation Dynamic reassignment for multi-operating system devices

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102135910A (zh) * 2011-03-03 2011-07-27 威盛电子股份有限公司 切换操作***的方法及使用此方法的电子装置
WO2013101139A1 (en) * 2011-12-30 2013-07-04 Intel Corporation Providing an asymmetric multicore processor system transparently to an operating system
CN103309737A (zh) * 2012-03-07 2013-09-18 联想(北京)有限公司 一种切换操作***的方法及设备
CN104516760A (zh) * 2014-12-12 2015-04-15 华为技术有限公司 一种操作***热切换的方法、装置及移动终端

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10849053B2 (en) 2016-05-27 2020-11-24 Huawei Technologies Co., Ltd. Method and apparatus for accessing WI-FI Network
US11330510B2 (en) 2016-05-27 2022-05-10 Huawei Technologies Co., Ltd. Method and apparatus for accessing WiFi network to support a terminal connected to two or more WiFi networks at the same time

Also Published As

Publication number Publication date
EP3223151A4 (en) 2017-12-06
US20170277561A1 (en) 2017-09-28
EP3223151A1 (en) 2017-09-27
KR101941618B1 (ko) 2019-01-23
CN104516760B (zh) 2018-01-09
CN104516760A (zh) 2015-04-15
US10437631B2 (en) 2019-10-08
KR20170093960A (ko) 2017-08-16
EP3223151B1 (en) 2021-04-21

Similar Documents

Publication Publication Date Title
WO2016090902A1 (zh) 一种操作***热切换的方法、装置及移动终端
US10635449B2 (en) Method and apparatus for running game client
CN107276789B (zh) 日志上传方法、装置及计算机可读存储介质
KR102148948B1 (ko) 전자 장치의 멀티 태스킹 방법 및 그 전자 장치
EP3342172B1 (en) Method of controlling the sharing of videos and electronic device adapted thereto
CN107861817B (zh) 基于线程阻塞的内存优化方法、移动终端及可读存储介质
US10474507B2 (en) Terminal application process management method and apparatus
EP3531290A1 (en) Data backup method, apparatus, electronic device, storage medium, and system
KR102107132B1 (ko) 전자 장치의 억세스 포인트 접속 방법 및 그 전자 장치
EP3471450B1 (en) Network bandwidth management method, terminal and computer storage medium
WO2019015395A1 (zh) 内存管理方法、装置、电子设备及存储介质
US20150128068A1 (en) Method for operating message application and electronic device implementing the same
WO2018077041A1 (zh) 应用运行的方法及装置
CN108052390B (zh) 基于线程阻塞的内存清理方法、移动终端及可读存储介质
US9588757B2 (en) Data update method, user terminal, and data update system
CN110865884A (zh) 一种内存管理方法及装置
CN108090345B (zh) linux***外部命令执行方法及装置
WO2017206901A1 (zh) 进程控制方法及相关设备
WO2015034246A1 (en) Electronic device and method of processing user input by electronic device
CN106919458B (zh) Hook目标内核函数的方法及装置
CN114218560A (zh) 资源访问方法、装置、电子设备及存储介质
CN110023907B (zh) 一种处理方法及装置
CN113039517B (zh) 一种音频资源调用的方法、装置及电子设备
US11550461B2 (en) Screen locking method and apparatus
CN110677456A (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: 15866553

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

REEP Request for entry into the european phase

Ref document number: 2015866553

Country of ref document: EP

ENP Entry into the national phase

Ref document number: 20177019225

Country of ref document: KR

Kind code of ref document: A