WO2016145728A1 - 在多系统中分配多核中央处理器的方法、装置及终端 - Google Patents

在多系统中分配多核中央处理器的方法、装置及终端 Download PDF

Info

Publication number
WO2016145728A1
WO2016145728A1 PCT/CN2015/078074 CN2015078074W WO2016145728A1 WO 2016145728 A1 WO2016145728 A1 WO 2016145728A1 CN 2015078074 W CN2015078074 W CN 2015078074W WO 2016145728 A1 WO2016145728 A1 WO 2016145728A1
Authority
WO
WIPO (PCT)
Prior art keywords
workload
cpu core
oss
cpu
core
Prior art date
Legal status (The legal status 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 status listed.)
Ceased
Application number
PCT/CN2015/078074
Other languages
English (en)
French (fr)
Inventor
尹德益
叶瑞权
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Yulong Computer Telecommunication Scientific Shenzhen Co Ltd
Original Assignee
Yulong Computer Telecommunication Scientific Shenzhen Co Ltd
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 Yulong Computer Telecommunication Scientific Shenzhen Co Ltd filed Critical Yulong Computer Telecommunication Scientific Shenzhen Co Ltd
Publication of WO2016145728A1 publication Critical patent/WO2016145728A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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]
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the present invention relates to the field of communications, and in particular, to a method, apparatus, and terminal for allocating a multi-core central processor in multiple systems.
  • the intelligent terminal has a multi-core CPU (Central Processing Unit), and the frequencies of different cores may be different.
  • the multi-core CPU is usually used as one.
  • the whole system is scheduled according to the time slice. For example, the existing 4-core mobile phone and 8-core mobile phone are all scheduled as a whole for each system according to the time slice, and each CPU core processes the work of one system at the same time.
  • the multi-core CPU as a whole is allocated to each operating system by time slice, and the isolation of multiple OS (Operating System) and CPU core cannot be well performed.
  • OS Operating System
  • the multi-core CPU runs simultaneously as a whole.
  • the performance demand is low, the multi-core CPU runs at the same time, there is also a certain waste of resources, and it consumes a lot of power.
  • the invention provides a method, a device and a terminal for allocating a multi-core central processor in a multi-system, so as to at least solve the prior art, the multi-core CPU runs simultaneously as a whole, and when the performance requirement is low, the multi-core CPU runs simultaneously. A certain amount of resources is wasted, and it consumes a lot of power.
  • the present invention provides a method for allocating a multi-core central processing unit in a multi-system, comprising: acquiring a current workload of each OS in a plurality of operating system OSs; The size of the workload is assigned to a CPU core with corresponding processing capabilities to handle the work of the various OSs.
  • allocating a CPU core having a corresponding processing capability includes: sorting the plurality of OSs according to the size of the workload, and dividing the plurality of CPU cores according to the frequency. Sorting; according to the order of the CPU core frequency from large to small, the CPU cores are sequentially assigned to the OSs sorted by the workload from large to small.
  • allocating a CPU core having a corresponding processing capability includes: setting different priorities for the plurality of OSs; determining whether there is an OS having the same workload; In the case of an OS having the same workload, the CPU core is allocated according to the priority.
  • the method further includes: allocating the CPU core according to the workload size in the case where there is no OS having the same workload.
  • the method further includes: after the allocation of one CPU core cannot complete the corresponding OS operation, further continuing to allocate a CPU core having a corresponding processing capability to the OS.
  • the present invention provides an apparatus for allocating a multi-core central processing unit in a multi-system, comprising: an obtaining module, configured to acquire a current workload of each OS of the plurality of operating system OSs; and an allocation module, configured to The size of the current workload of each OS is allocated to a CPU core having a corresponding processing capability to process the operations of the respective OSs.
  • the allocating module includes: a sorting unit, configured to sort the plurality of OSs according to the size of the workload, and sort the plurality of CPU cores according to the frequency; the first allocating unit is configured to follow the CPU core frequency. From the largest to the smallest, the CPU cores are sequentially assigned to the OSs sorted by the workload from large to small.
  • the allocation module includes: a setting unit configured to set different priorities for the plurality of OSs; a determining unit configured to determine whether an OS having the same workload exists; and a second allocation unit configured to have In the case of an OS of the same workload, the CPU core is allocated according to the priority.
  • the allocating module further includes: a third allocating unit, configured to have the same work in the absence of the same work In the case of an OS, the CPU core is allocated according to the workload.
  • the present invention also provides a terminal, including:
  • a processor and a memory are included, wherein the memory stores a set of program codes, and the processor is configured to call program code stored in the memory for performing the following operations:
  • a CPU core having a corresponding processing capability is allocated to process the operations of the respective OSs.
  • the processor allocates a CPU core having a corresponding processing capability according to the current workload of each OS, including:
  • the CPU cores are sequentially assigned to the OSs sorted by the workload from large to small.
  • the processor allocates a CPU core having a corresponding processing capability according to the current workload of each OS, including:
  • the CPU core is allocated according to the priority.
  • the CPU core is allocated according to the workload.
  • the present invention can determine which OS has a larger workload, which OS has a smaller workload, and then assign different CPU cores to different ones according to the workload.
  • OS processing work reasonable allocation and utilization of the CPU core, does not require all CPU cores to work at the same time, rational use of system resources, and solve the multi-core CPU as a whole
  • the multi-core CPU runs at the same time, there is a certain waste of resources, and it consumes a lot of power.
  • FIG. 1 is a flow chart of a method for allocating a multi-core central processor in multiple systems in an embodiment of the present invention
  • FIG. 2 is a schematic structural diagram of an apparatus for allocating a multi-core central processing unit in multiple systems according to an embodiment of the present invention
  • FIG. 3 is a first schematic structural diagram of an apparatus for allocating a multi-core central processing unit in multiple systems according to an embodiment of the present invention
  • FIG. 4 is a second schematic structural diagram of an apparatus for allocating a multi-core central processing unit in a multi-system according to an embodiment of the present invention
  • FIG. 5 is a schematic diagram of a multi-system multi-core CPU operation framework in a preferred embodiment 1 of the present invention
  • FIG. 6 is a schematic structural diagram of a terminal according to an embodiment of the present invention.
  • the present invention provides a multi-system. Method, device and terminal for allocating multi-core central processing unit The invention will be further described in detail with reference to the drawings and embodiments. It is understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
  • the embodiment of the invention provides a method for allocating a multi-core central processing unit in a multi-system.
  • the flow is shown in FIG. 1 and includes steps S102 to S104:
  • the implementation of the process can be performed by the virtual layer.
  • the virtual layer can allocate a virtual CPU core to each OS.
  • the actual function of the virtual CPU core is to count the workload of each OS. In this embodiment, it is called a virtual CPU.
  • the core is designed by a person skilled in the art as long as it can implement the function of statistical workload.
  • the number of CPU cores may be more than the number of systems.
  • a 4-core dual-system intelligent terminal if one CPU core is allocated to each of the two OSs, the corresponding workload can be completed, and the other two.
  • the CPU core does not need to work; if the number of CPU cores is the same as the number of systems, for example, dual-core dual-system intelligent terminals, when only one system works and the working system is running at a small amount, a smaller CPU is used.
  • the core can complete its work, and the CPU core with strong processing power does not need to work.
  • the present invention after obtaining the workload of each OS, it can be determined which OS has a larger workload, which OS has a smaller workload, and then allocates different CPU cores according to the workload. Handling work for different OSs, rationally allocating and utilizing CPU cores, not requiring all CPU cores to work at the same time, rationally utilizing system resources, solving multi-core CPUs running as a whole at the same time, when performance requirements are low, multi-core The CPU runs at the same time, there is a certain waste of resources, and it consumes a lot of power.
  • the CPU core is allocated according to the workload of the OS.
  • the CPU core may be allocated only according to the workload, or other auxiliary parameters and workload may be set to jointly allocate the CPU core.
  • the plurality of OSs may be sorted according to the size of the workload, and the plurality of CPU cores are sorted according to the frequency, and then the CPU core frequency is in descending order.
  • the CPU cores are sequentially assigned to the OSs sorted by the workload from large to small. Under this kind of distribution mode, the CPU core can fully exert its own ability. When one CPU core can complete an OS workload, other unassigned CPU cores do not work, saving system resources and reducing power consumption. the amount.
  • the CPU core can be allocated more accurately. For example, if the auxiliary parameter is set to the priority of each OS in multiple OSs, it is necessary to set different priorities for multiple OSs first.
  • the priority of the OS can be set when the terminal is shipped from the factory. For example, when the system of the terminal is divided into a common system and a security system, the priority level of the security system can be set higher than that of the ordinary system, and the frequency is processed. A higher CPU core can be assigned to the security system; the OS priority can also be set to the system settings of the terminal, and the user sets the priority of different OS according to the requirements.
  • the priority After setting the priority, determine whether there is an OS with the same workload (which can also be the workload interval), and if the OS workload is not the same size, allocate the CPU core according to the workload size, and have the same work in existence. In the case of a quantity of OS, the CPU core is allocated according to the priority.
  • An embodiment of the present invention further provides an apparatus for allocating a multi-core central processing unit in a multi-system.
  • the structure of the apparatus is as shown in FIG. 2, and includes: an obtaining module 10, configured to acquire current OSs of multiple operating system OSs.
  • the workload module is coupled to the acquisition module 10 for allocating a CPU core having a corresponding processing capability according to the current workload of each OS to process the work of each OS.
  • FIG. 3 is a schematic structural diagram of the distribution module 20 in the above apparatus, which includes: a sorting unit 201, The plurality of CPUs are sorted according to the size of the workload, and the plurality of CPU cores are sorted according to the size of the frequency; the first allocating unit 202 is coupled with the sorting unit 201 for using the CPU core frequency from large to small. In the order, the CPU cores are sequentially assigned to the OSs sorted by the workload from large to small.
  • the distribution module 20 can also be configured as shown in FIG. 4, including: a setting unit 203 for setting different priorities for the plurality of OSs; and a determining unit 204 coupled with the setting unit 203 for Determining whether there is an OS having the same workload; the second allocating unit 205 is coupled to the determining unit 204 for allocating the CPU core according to the priority in the presence of an OS having the same workload; the third allocating unit 206, Coupled with the determining unit 204 for allocating the CPU core according to the workload size in the absence of an OS having the same workload.
  • the allocation module is further configured to continue to allocate a CPU core with corresponding processing capability to the OS if a CPU core cannot be allocated to perform corresponding OS operations.
  • the embodiment of the invention further provides a terminal comprising the above-mentioned device for allocating a multi-core central processor in a multi-system.
  • a terminal comprising the above-mentioned device for allocating a multi-core central processor in a multi-system.
  • the multi-core CPU operates as a whole at the same time.
  • the multi-CPU core runs at the same time, which has a certain waste of resources and consumes a large amount of power.
  • the embodiment of the present invention provides a method for allocating a multi-core central processing unit in multiple systems.
  • the virtual layer uniformly controls the allocation of the CPU core, and the virtual layer is used for control, in order to facilitate understanding.
  • it is extracted and presented in the form of a virtual layer.
  • a schematic diagram of a multi-system multi-core CPU running framework is shown in FIG. 5, and there are two CPU cores and two OSs.
  • the dynamic allocation of the workload of each OS and the dynamic allocation of different core frequencies of the CPU core are performed by the virtual layer. For example, the workload of OS1 is relatively small, the frequency of CPU core 1 is low, and the workload of OS2 is large, and the frequency of CPU core 2 is relatively high. Then, the virtual layer allocates CPU core 1 to OS1 and CPU core 2 to OS2. When the workload of the OS changes, it is dynamically adjusted according to the workload.
  • OS1 is a normal system
  • OS2 is a security system. It only processes some jobs with high security requirements.
  • OS2 only handles jobs with higher security levels and works less
  • OS1 When the normal system is used, various tasks need to be processed and work more. Therefore, when the virtual layer performs CPU core allocation, the lower frequency CPU core is allocated to OS2, and the higher frequency CPU core is allocated to OS1.
  • the OS1 When the user finishes the event in the normal system OS1 and switches into the OS2, the OS1 enters the standby state. At this time, the OS1 is basically not working, and the OS2 handles the security event, and the workload increases. At this time, the virtual layer will have a higher frequency.
  • the CPU core is assigned to OS2. With the method provided in this embodiment, the performance of CPU cores of different frequencies can be fully utilized.
  • the CPU core can be allocated according to the size of each OS running workload and the different core frequencies of the CPU core.
  • the workload of the OS1 is relatively small, and the frequency of the first CPU core is low, and the OS1 is running.
  • the OS2 workload is large, and the second CPU core frequency is high, the OS2 runs on the second CPU core.
  • the CPU core is dynamically allocated according to the workload. Using different frequency CPU core performance, according to the workload allocation, if the CPU core still has spare, the remaining CPU core can temporarily be inactive, saving power and other resources.
  • the embodiment of the invention provides a method for allocating a multi-core central processing unit in a multi-system.
  • the terminal controlled by the method comprises four CPU cores and two OSs, and the frequency of the CPU core 1 and the CPU core 2 is 1.2 GHz, and the CPU core The frequency of 3 and CPU core 4 is 2.0 GHz, and OS1 and OS2 are two independent systems.
  • OS1 When the system is running, OS1 is the system running in the foreground, OS2 is the system running in the background.
  • the current workload of OS1 is large, and the current workload of OS2 is small. Therefore, a 2.0GHz CPU core is allocated for OS1, which is OS2. Assign a 1.2GHz CPU core, then the other two CPU cores are not used.
  • a 2.0GHz CPU core can no longer meet the processing needs of the system, and then continue to allocate a 2.0GHz to the OS1 according to its current work requirements.
  • CPU core or 1.2GHz CPU core
  • OS1 When the system switches. When OS2 is switched to the system running in the foreground, OS1 is converted to a system running in the background. At this time, OS2 handles more work, and OS1 handles less work. Therefore, a smaller 1.2GHz CPU core can be allocated for OS1. At this time, because the OS2 processing work becomes more and more, it is necessary to allocate a CPU core with strong processing capability, and then other CPU cores can be allocated on the basis of the 1.2 GHz CPU core, or the current processing capability can be directly reduced. The 1.2GHz CPU core is replaced and replaced with a 2.0GHz CPU core with strong processing power.
  • the CPU cores of the matching frequency are allocated to different OSs according to the workload of the OS.
  • the workload of the OS changes, the workload is dynamically adjusted according to the workload, and the performance of the CPU core is fully utilized to achieve the effect of properly scheduling the CPU core.
  • FIG. 6 is a schematic structural diagram of a terminal according to an embodiment of the present invention.
  • the terminal 6 may include at least one processor 61, such as a CPU, at least one communication bus 62, and a memory 63.
  • the communication bus 62 is used.
  • the connection communication between these components is implemented;
  • the memory 63 may be a high speed RAM memory or a non-volatile memory such as at least one disk memory.
  • a set of program codes is stored in the memory 63, and the processor 61 is configured to call the program code stored in the memory 63 for performing the following operations:
  • a CPU core having a corresponding processing capability is allocated to process the operations of the respective OSs.
  • the processor 61 may allocate a CPU core having a corresponding processing capability according to the current workload of each OS.
  • the CPU cores are sequentially assigned to the OSs sorted by the workload from large to small.
  • the processor 61 may allocate a CPU core having a corresponding processing capability according to the current workload of each OS.
  • the CPU core is allocated according to the priority.
  • processor 61 determines whether there is an OS having the same workload, the following operations may also be performed:
  • the CPU core is allocated according to the workload.
  • processor 61 can also call the stored code in the memory 63 to perform the following operations:
  • the OS continues to be assigned a CPU core with corresponding processing capability.
  • the processor allocates CPU cores with matching frequencies to different OSs according to the workload of the OS.
  • the workload of the OS changes, the workload is dynamically adjusted according to the workload, and the performance of the CPU core is fully utilized to achieve reasonable scheduling of the CPU core. effect.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Multi Processors (AREA)
  • Power Sources (AREA)

Abstract

本发明公开了一种在多系统中分配多核中央处理器的方法、装置及终端,其中,该方法包括:获取多个操作系统OS中各个OS当前的工作量;根据各个OS当前的工作量的大小,分配具有相应处理能力的CPU核,以处理各个OS的工作。本发明在获取了各个OS的工作量后,能够确定哪一个OS当前的工作量较大,哪一个OS当前的工作量较小,然后根据工作量的情况,将不同的CPU核分配给不同的OS处理工作,合理的分配和利用了CPU核,不需要所有的CPU核同时工作,合理的利用了系统资源,解决了多核CPU作为一个整体同时运行,在性能需求较低时,多核CPU同时运行存在一定的资源浪费,且耗费较多电量的问题。

Description

在多系统中分配多核中央处理器的方法、装置及终端
本申请要求于2015年03月13日提交中国专利局,申请号为CN 201510111882.3、发明名称为“在多系统中分配多核中央处理器的方法、装置及终端”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本发明涉及通讯领域,特别是涉及一种在多系统中分配多核中央处理器的方法、装置及终端。
背景技术
在一台智能终端同时运行多个独立的系统,智能终端具有多核CPU(Central Processing Unit,中央处理器),且不同的核的频率有可能不同,在系统运行时,通常是把多核CPU作为一个整体按时间片给各个系统调度,例如,现有的4核手机和8核手机等,都是作为一个整体按时间片给各个系统调度,各个CPU核都在同时处理某一个系统的工作。
然而,把多核CPU作为一个整体,按时间片分配给各个操作系统,不能很好的做到多个OS(Operating System,操作系统)和CPU核对应的隔离,同时,多核CPU作为一个整体同时运行,在性能需求较低时,多核CPU同时运行也存在一定的资源浪费,且耗费较多电量。
发明内容
本发明提供了一种在多系统中分配多核中央处理器的方法、装置及终端,以至少解决现有技术中,多核CPU作为一个整体同时运行,在性能需求较低时,多核CPU同时运行存在一定的资源浪费,且耗费较多电量的问题。
一方面,本发明提供一种在多系统中分配多核中央处理器的方法,包括:获取多个操作系统OS中各个OS当前的工作量;根据所述各个OS当前的工 作量的大小,分配具有相应处理能力的CPU核,以处理所述各个OS的工作。
进一步,根据所述各个OS当前的工作量的大小,分配具有相应处理能力的中央处理器CPU核包括:将所述多个OS按照工作量的大小进行排序,将多个CPU核按照频率的大小进行排序;按照CPU核频率由大到小的顺序,将CPU核依次分给按工作量由大到小排序后的各OS。
进一步,根据所述各个OS当前的工作量的大小,分配具有相应处理能力的中央处理器CPU核包括:为所述多个OS设置不同的优先级;确定是否存在具有相同工作量的OS;在存在具有相同工作量的OS情况下,按照所述优先级分配CPU核。
进一步,确定是否存在具有相同工作量的OS之后,还包括包括:在不存在具有相同工作量的OS情况下,按照工作量大小分配CPU核。
进一步,所述方法还包括:在分配一个CPU核无法完成对应OS工作的情况下,再为所述OS继续分配一个具有相应处理能力的CPU核。
另一方面,本发明还提供了一种在多系统中分配多核中央处理器的装置,包括:获取模块,用于获取多个操作系统OS中各个OS当前的工作量;分配模块,用于根据所述各个OS当前的工作量的大小,分配具有相应处理能力的CPU核,以处理所述各个OS的工作。
进一步,所述分配模块包括:排序单元,用于将所述多个OS按照工作量的大小进行排序,将多个CPU核按照频率的大小进行排序;第一分配单元,用于按照CPU核频率由大到小的顺序,将CPU核依次分给按工作量由大到小排序后的各OS。
进一步,所述分配模块包括:设置单元,用于为所述多个OS设置不同的优先级;确定单元,用于确定是否存在具有相同工作量的OS;第二分配单元,用于在存在具有相同工作量的OS情况下,按照所述优先级分配CPU核。
进一步,所述分配模块还包括:第三分配单元,用于在不存在具有相同工 作量的OS情况下,按照工作量大小分配CPU核。
又一方面,本发明还提供了一种终端,包括:
包括处理器和存储器,其中,所述存储器中存储一组程序代码,且所述处理器用于调用所述存储器中存储的程序代码,用于执行以下操作:
获取多个操作系统OS中各个OS当前的工作量;
根据所述各个OS当前的工作量的大小,分配具有相应处理能力的中央处理器CPU核,以处理所述各个OS的工作。
进一步,所述处理器根据所述各个OS当前的工作量的大小,分配具有相应处理能力的CPU核包括:
将所述多个OS按照工作量的大小进行排序,将多个CPU核按照频率的大小进行排序;
按照CPU核频率由大到小的顺序,将CPU核依次分给按工作量由大到小排序后的各OS。
进一步,所述处理器根据所述各个OS当前的工作量的大小,分配具有相应处理能力的CPU核包括:
为所述多个OS设置不同的优先级;
确定是否存在具有相同工作量的OS;
在存在具有相同工作量的OS情况下,按照所述优先级分配CPU核。
进一步,所述处理器确定是否存在具有相同工作量的OS之后,还执行以下操作:
在不存在具有相同工作量的OS情况下,按照工作量大小分配CPU核。
本发明在获取了各个OS的工作量后,能够确定哪一个OS当前的工作量较大,哪一个OS当前的工作量较小,然后根据工作量的情况,将不同的CPU核分配给不同的OS处理工作,合理的分配和利用了CPU核,不需要所有的CPU核同时工作,合理的利用了系统资源,解决了多核CPU作为一个整体同 时运行,在性能需求较低时,多核CPU同时运行存在一定的资源浪费,且耗费较多电量的问题。
附图说明
通过阅读下文优选实施方式的详细描述,各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。附图仅用于示出优选实施方式的目的,而并不认为是对本发明的限制。而且在整个附图中,用相同的参考符号表示相同的部件。在附图中:
图1是本发明实施例中在多系统中分配多核中央处理器的方法的流程图;
图2是本发明实施例中在多系统中分配多核中央处理器的装置的结构示意图;
图3是本发明实施例中在多系统中分配多核中央处理器的装置的第一结构示意图;
图4是本发明实施例中在多系统中分配多核中央处理器的装置的第二结构示意图;
图5是本发明优选实施例一中多系统多核CPU运行框架示意图;
图6是本发明实施例中一种终端的结构示意图。
具体实施方式
下面将参照附图更详细地描述本公开的示例性实施例。虽然附图中显示了本公开的示例性实施例,然而应当理解,可以以各种形式实现本公开而不应被这里阐述的实施例所限制。相反,提供这些实施例是为了能够更透彻地理解本公开,并且能够将本公开的范围完整的传达给本领域的技术人员。
为了解决现有技术中,多核CPU作为一个整体同时运行,在性能需求较低时,多核CPU同时运行存在一定的资源浪费,且耗费较多电量的问题,本发明提供了一种在多系统中分配多核中央处理器的方法、装置及终端,以下结 合附图以及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不限定本发明。
本发明实施例提供了一种在多系统中分配多核中央处理器的方法,其流程如图1所示,包括步骤S102至S104:
S102,获取多个OS中各个OS当前的工作量。
该过程的实现通常可以是通过虚拟层来执行的,虚拟层可以为各个OS都分配一个虚拟CPU核,该虚拟CPU核实际的作用就是统计各个OS工作量,本实施例中称其为虚拟CPU核,本领域技术人员在设计时,只要能够实现统计工作量的功能即可。
S104,根据各个OS当前的工作量的大小,分配具有相应处理能力的CPU核,以处理各个OS的工作。
在实现的过程中,CPU核的个数可能会比系统个数多,例如4核双系统智能终端,则如果为某两个OS分别分配一个CPU核就能够完成对应的工作量,其余两个CPU核就不需要工作;如果CPU核的个数和系统个数相同,例如,双核双系统智能终端,则当只有一个系统工作,且工作的系统运行工作量较小时,采用一个较小的CPU核就能完成其工作,则处理能力较强的CPU核不需要工作。
本发明实施例,在获取了各个OS的工作量后,能够确定哪一个OS当前的工作量较大,哪一个OS当前的工作量较小,然后根据工作量的情况,将不同的CPU核分配给不同的OS处理工作,合理的分配和利用了CPU核,不需要所有的CPU核同时工作,合理的利用了系统资源,解决了多核CPU作为一个整体同时运行,在性能需求较低时,多核CPU同时运行存在一定的资源浪费,且耗费较多电量的问题。
实现时,根据OS的工作量情况分配CPU核,例如,可以仅根据工作量来分配CPU核,也可以设置其他辅助参数和工作量来共同分配CPU核。
当仅根据工作量来分配CPU核时,可以将所述多个OS按照工作量的大小进行排序,将多个CPU核按照频率的大小进行排序,再按照CPU核频率由大到小的顺序,将CPU核依次分给按工作量由大到小排序后的各OS。此种分配方式下,CPU核能充分发挥自己的能力,在一个CPU核就能完某一OS工作量的情况下,其他未被分配的CPU核不进行工作,节省系统资源,也降低了耗电量。
当设置其他辅助参数和工作量来共同分配CPU核时,可以更加精确地分配CPU核。例如,将辅助参数设置为多个OS中各OS的优先级,则先需要为多个OS设置不同的优先级。其中,OS的优先级可以在终端出厂时就进行设置,例如,当终端的系统分为普通系统和安全系统时,则可以设置安全系统的优先级级别高于普通系统,则在处理时,频率较高的CPU核可以分配给安全系统;OS的优先级也可以设置为终端的系统设置,用户根据需求设置不同OS的优先级。
在设置了优先级后,确定是否存在具有相同工作量(也可以是工作量区间)的OS,并在OS工作量的大小不相同情况下,按照工作量大小分配CPU核,在存在具有相同工作量的OS情况下,按照所述优先级分配CPU核。
在上述方法实现的过程中,如果某一个OS的工作量较大,为其分配的一个CPU核无法完成其对应工作的情况下,再为所述OS继续分配一个具有相应处理能力的CPU核。
本发明实施例还提供了一种在多系统中分配多核中央处理器的装置,该装置的结构示意如图2所示,包括:获取模块10,用于获取多个操作系统OS中各个OS当前的工作量;分配模块20,与获取模块10耦合,用于根据各个OS当前的工作量的大小,分配具有相应处理能力的CPU核,以处理各个OS的工作。
图3示出了上述装置中分配模块20的结构示意图,其包括:排序单元201, 用于将所述多个OS按照工作量的大小进行排序,将多个CPU核按照频率的大小进行排序;第一分配单元202,与排序单元201耦合,用于按照CPU核频率由大到小的顺序,将CPU核依次分给按工作量由大到小排序后的各OS。
在图2的基础上,分配模块20还可以如图4所示,包括:设置单元203,用于为所述多个OS设置不同的优先级;确定单元204,与设置单元203耦合,用于确定是否存在具有相同工作量的OS;第二分配单元205,与确定单元204耦合,用于在存在具有相同工作量的OS情况下,按照所述优先级分配CPU核;第三分配单元206,与确定单元204耦合,用于在不存在具有相同工作量的OS情况下,按照工作量大小分配CPU核。
在一个优选的过程中,分配模块,还用于在分配一个CPU核无法完成对应OS工作的情况下,再为所述OS继续分配一个具有相应处理能力的CPU核。
本发明实施例还提供了一种终端,其包括上述的在多系统中分配多核中央处理器的装置。本领域技术人员根据上述记载的内容知晓如何将上述在多系统中分配多核中央处理器的装置集成设置在终端中,此处不再赘述。
优选实施例一
现有技术中,多核CPU作为一个整体同时运行,在性能需求较低时,多CPU核同时运行存在一定的资源浪费,且耗费较多电量。基于上述问题,本发明实施例提供了一种在多系统中分配多核中央处理器的方法,在本实施例中,由虚拟层统一控制CPU核的分配,此虚拟层用于控制,为了方便理解,本实施例中将其提炼出来,以虚拟层的形式呈现,多系统多核CPU运行框架示意图如图5所示,存在两个CPU核和两个OS。
各OS运行工作量的大小和CPU核不同核频率的动态对应分配由虚拟层执行,如OS1工作量比较小,CPU核1频率较低,而OS2工作量较大,CPU核2频率较高,则虚拟层将CPU核1分配给OS1,将CPU核2分配给OS2,OS工作量变化时,根据工作量大小,动态调整。
例如,终端上具有两个OS,OS1为正常系统,OS2为安全系统,只处理一些安全要求级别高的工作,一般情况下,由于OS2只处理安全级别较高的工作,工作较少,而OS1正常系统使用时各种工作都需要处理,工作较多,故虚拟层在进行CPU核分配时,将频率较低的CPU核分配给OS2,频率较高的CPU核分配给OS1。但是当用户在正常系统OS1中处理完事件后,切换进入OS2中时,OS1进入待机状态,此时OS1基本没工作,而OS2处理安全事件,工作量上升,此时虚拟层将频率较高的CPU核分配给OS2。利用本实施例提供的方法,能够充分利用不同频率CPU核的性能。
本发明实施例提出的上述方法中,能根据各OS运行工作量的大小和CPU核不同核频率的高低来分配CPU核,如OS1工作量比较小,第一CPU核频率较低,则OS1运行在第一CPU核上,而OS2工作量较大,第二CPU核频率较高,则OS2运行在第二CPU核上,各OS工作量变化时,根据工作量大小,动态分配CPU核,充分利用不同频率CPU核性能,根据工作量分配后,如CPU核尚有闲余,则剩下的CPU核可以暂时处于不工作状态,节省电量等资源。
优选实施例二
本发明实施例提供了一种在多系统中分配多核中央处理器的方法,该方法控制的终端包括四个CPU核和两个OS,CPU核1和CPU核2的频率为1.2GHz,CPU核3和CPU核4的频率为2.0GHz,OS1和OS2为两个各自独立的系统。
当系统运行时,OS1为前台正在运行的系统,OS2为后台运行的系统,OS1当前的工作量较大,OS2当前的工作量较小,因此,为OS1分配一个2.0GHz的CPU核,为OS2分配一个1.2GHz的CPU核即可,则另两个CPU核暂不使用。随着OS1系统工作量增加,一个2.0GHz的CPU核已经无法满足其处理工作的需求时,再根据其当下的工作需求,继续为OS1分配一个2.0GHz的 CPU核或1.2GHz的CPU核。
当系统进行切换。OS2切换为前台运行的系统时,OS1则转换为后台运行的系统,此时,OS2处理的工作变多,OS1处理的工作变少,则为OS1分配频率较小的1.2GHz的CPU核即可,此时,由于OS2处理的工作变多,需要为其分配处理能力较强的CPU核,则可以在1.2GHz的CPU核基础上再分配其他CPU核,也可以直接将当前处理能力较小的1.2GHz的CPU核替换掉,换成处理能力较强的2.0GHz的CPU核。
本实施例根据OS工作量的大小来给不同OS分配相匹配频率的CPU核,OS工作量变化时,根据工作量大小,动态调整,充分利用CPU核的性能,达到合理调度CPU核的效果。
图6是本发明实施例中一种终端的结构示意图,如图6所示,该终端6可以包括:至少一个处理器61,例如CPU,至少一个通信总线62以及存储器63;通信总线62用于实现这些组件之间的连接通信;存储器63可以是高速RAM存储器,也可以是非易失性存储器(non-volatile memory),例如至少一个磁盘存储器。存储器63中存储一组程序代码,且处理器61用于调用存储器63中存储的程序代码,用于执行以下操作:
获取多个操作系统OS中各个OS当前的工作量;
根据所述各个OS当前的工作量的大小,分配具有相应处理能力的中央处理器CPU核,以处理所述各个OS的工作。
进一步,所述处理器61根据所述各个OS当前的工作量的大小,分配具有相应处理能力的CPU核具体可以为:
将所述多个OS按照工作量的大小进行排序,将多个CPU核按照频率的大小进行排序;
按照CPU核频率由大到小的顺序,将CPU核依次分给按工作量由大到小排序后的各OS。
进一步,所述处理器61根据所述各个OS当前的工作量的大小,分配具有相应处理能力的CPU核具体可以为:
为所述多个OS设置不同的优先级;
确定是否存在具有相同工作量的OS;
在存在具有相同工作量的OS情况下,按照所述优先级分配CPU核。
进一步,所述处理器61确定是否存在具有相同工作量的OS之后,还可以执行以下操作:
在不存在具有相同工作量的OS情况下,按照工作量大小分配CPU核。
进一步,所述处理器61还可以调用存储器63中的存储代码执行以下操作:
在分配一个CPU核无法完成对应OS工作的情况下,再为所述OS继续分配一个具有相应处理能力的CPU核。
本实施例处理器根据OS工作量的大小来给不同OS分配相匹配频率的CPU核,OS工作量变化时,根据工作量大小,动态调整,充分利用CPU核的性能,达到合理调度CPU核的效果。
显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。

Claims (13)

  1. 一种在多系统中分配多核中央处理器的方法,其特征在于,包括:
    获取多个操作系统OS中各个OS当前的工作量;
    根据所述各个OS当前的工作量的大小,分配具有相应处理能力的中央处理器CPU核,以处理所述各个OS的工作。
  2. 如权利要求1所述的方法,其特征在于,根据所述各个OS当前的工作量的大小,分配具有相应处理能力的CPU核包括:
    将所述多个OS按照工作量的大小进行排序,将多个CPU核按照频率的大小进行排序;
    按照CPU核频率由大到小的顺序,将CPU核依次分给按工作量由大到小排序后的各OS。
  3. 如权利要求1所述的方法,其特征在于,根据所述各个OS当前的工作量的大小,分配具有相应处理能力的CPU核包括:
    为所述多个OS设置不同的优先级;
    确定是否存在具有相同工作量的OS;
    在存在具有相同工作量的OS情况下,按照所述优先级分配CPU核。
  4. 如权利要求3所述的方法,其特征在于,确定是否存在具有相同工作量的OS之后,还包括:
    在不存在具有相同工作量的OS情况下,按照工作量大小分配CPU核。
  5. 如权利要求1至4中任一项所述的方法,其特征在于,所述方法还包括:
    在分配一个CPU核无法完成对应OS工作的情况下,再为所述OS继续分配一个具有相应处理能力的CPU核。
  6. 一种在多系统中分配多核中央处理器的装置,其特征在于,包括:
    获取模块,用于获取多个操作系统OS中各个OS当前的工作量;
    分配模块,用于根据所述各个OS当前的工作量的大小,分配具有相应处理能力的中央处理器CPU核,以处理所述各个OS的工作。
  7. 如权利要求6所述的装置,其特征在于,所述分配模块包括:
    排序单元,用于将所述多个OS按照工作量的大小进行排序,将多个CPU核按照频率的大小进行排序;
    第一分配单元,用于按照CPU核频率由大到小的顺序,将CPU核依次分给按工作量由大到小排序后的各OS。
  8. 如权利要求6所述的装置,其特征在于,所述分配模块包括:
    设置单元,用于为所述多个OS设置不同的优先级;
    确定单元,用于确定是否存在具有相同工作量的OS;
    第二分配单元,用于在存在具有相同工作量的OS情况下,按照所述优先级分配CPU核。
  9. 如权利要求8所述的装置,其特征在于,所述分配模块还包括:
    第三分配单元,用于在不存在具有相同工作量的OS情况下,按照工作量大小分配CPU核。
  10. 一种终端,其特征在于,包括处理器和存储器,其中,所述存储器中存储一组程序代码,且所述处理器用于调用所述存储器中存储的程序代码,用于执行以下操作:
    获取多个操作系统OS中各个OS当前的工作量;
    根据所述各个OS当前的工作量的大小,分配具有相应处理能力的中央处理器CPU核,以处理所述各个OS的工作。
  11. 根据权利要求10所述的终端,其特征在于,所述处理器根据所述各个OS当前的工作量的大小,分配具有相应处理能力的CPU核包括:
    将所述多个OS按照工作量的大小进行排序,将多个CPU核按照频率的大小进行排序;
    按照CPU核频率由大到小的顺序,将CPU核依次分给按工作量由大到小排序后的各OS。
  12. 根据权利要求10所述的终端,其特征在于,所述处理器根据所述各个OS当前的工作量的大小,分配具有相应处理能力的CPU核包括:
    为所述多个OS设置不同的优先级;
    确定是否存在具有相同工作量的OS;
    在存在具有相同工作量的OS情况下,按照所述优先级分配CPU核。
  13. 根据权利要求12所述的终端,其特征在于,所述处理器确定是否存在具有相同工作量的OS之后,还执行以下操作:
    在不存在具有相同工作量的OS情况下,按照工作量大小分配CPU核。
PCT/CN2015/078074 2015-03-13 2015-04-30 在多系统中分配多核中央处理器的方法、装置及终端 Ceased WO2016145728A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510111882.3 2015-03-13
CN201510111882.3A CN106033374A (zh) 2015-03-13 2015-03-13 在多系统中分配多核中央处理器的方法、装置及终端

Publications (1)

Publication Number Publication Date
WO2016145728A1 true WO2016145728A1 (zh) 2016-09-22

Family

ID=56918278

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/078074 Ceased WO2016145728A1 (zh) 2015-03-13 2015-04-30 在多系统中分配多核中央处理器的方法、装置及终端

Country Status (2)

Country Link
CN (1) CN106033374A (zh)
WO (1) WO2016145728A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115373829A (zh) * 2021-05-19 2022-11-22 中国移动通信集团浙江有限公司 Cpu资源的调度方法、装置及系统

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106775828B (zh) * 2016-11-25 2020-07-03 Oppo广东移动通信有限公司 应用程序安装方法及装置、计算机设备
CN106708682B (zh) * 2017-01-20 2020-10-23 苏州浪潮智能科技有限公司 一种提升服务器SPEC CPU speed测试成绩的方法
TWI756974B (zh) 2020-12-09 2022-03-01 財團法人工業技術研究院 機器學習系統及其資源配置方法

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030061264A1 (en) * 2001-09-21 2003-03-27 International Business Machines Corporation Method, system, and program for allocating processor resources to a first and second types of tasks
CN101256515A (zh) * 2008-03-11 2008-09-03 浙江大学 多核处理器操作系统负载均衡的实现方法
CN101470634A (zh) * 2007-12-24 2009-07-01 联想(北京)有限公司 Cpu资源调度方法及虚拟机监视器、虚拟机系统
JP2009163527A (ja) * 2008-01-08 2009-07-23 Hitachi Ltd Os間で負荷分散する情報処理システム

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102053869B (zh) * 2009-10-29 2013-11-06 杭州华三通信技术有限公司 一种多操作系统的资源分配方法和装置
CN102184125B (zh) * 2011-06-02 2013-11-13 首都师范大学 异构多核环境下基于程序行为在线分析的负载均衡方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030061264A1 (en) * 2001-09-21 2003-03-27 International Business Machines Corporation Method, system, and program for allocating processor resources to a first and second types of tasks
CN101470634A (zh) * 2007-12-24 2009-07-01 联想(北京)有限公司 Cpu资源调度方法及虚拟机监视器、虚拟机系统
JP2009163527A (ja) * 2008-01-08 2009-07-23 Hitachi Ltd Os間で負荷分散する情報処理システム
CN101256515A (zh) * 2008-03-11 2008-09-03 浙江大学 多核处理器操作系统负载均衡的实现方法

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115373829A (zh) * 2021-05-19 2022-11-22 中国移动通信集团浙江有限公司 Cpu资源的调度方法、装置及系统

Also Published As

Publication number Publication date
CN106033374A (zh) 2016-10-19

Similar Documents

Publication Publication Date Title
CN100487660C (zh) 一种多线程处理器动态内存管理系统及方法
US9563474B2 (en) Methods for managing threads within an application and devices thereof
CN103645954A (zh) 一种基于异构多核体系的cpu调度方法、装置和系统
US9274852B2 (en) Apparatus and method for managing virtual processing unit
CN104598426A (zh) 用于异构多核处理器系统的任务调度方法
CN104050137B (zh) 一种异构操作系统中内核运行的方法及装置
CN101013388A (zh) 面向异构多核体系的进程调度方法
CN105320570B (zh) 资源管理方法和系统
CN107766145B (zh) 双系统下的内存管理方法和装置
US9612651B2 (en) Access based resources driven low power control and management for multi-core system on a chip
JP2013125548A (ja) 仮想マシン割り当てシステム及びその使用方法
WO2016145728A1 (zh) 在多系统中分配多核中央处理器的方法、装置及终端
CN104598298A (zh) 基于虚拟机当前工作性质以及任务负载的虚拟机调度算法
US20240152395A1 (en) Resource scheduling method and apparatus, and computing node
CN103336684B (zh) 一种并发处理ap消息的ac及其处理方法
WO2020108337A1 (zh) 一种cpu资源调度方法及电子设备
CN105320565A (zh) 一种针对多种应用软件的计算机资源调度方法
US20080098395A1 (en) System and method of expediting certain jobs in a computer processing system
CN103617048B (zh) 一种虚拟机连接池分组系统及分组连接方法
CN119336507A (zh) Gpu的任务调度方法、装置、电子设备、存储介质和程序产品
CN108429784B (zh) 一种能效优先的云资源分配与调度方法
CN102662636A (zh) 一种基于两层虚拟机的并行作业调度的方法
CN110333899B (zh) 数据处理方法、装置和存储介质
CN103823712A (zh) 一种多cpu虚拟机系统的数据流处理方法和装置
CN110704195A (zh) 一种cpu调整方法、服务器及计算机可读存储介质

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

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

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

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

122 Ep: pct application non-entry in european phase

Ref document number: 15885111

Country of ref document: EP

Kind code of ref document: A1