技术领域technical field
本发明涉及计算机应用技术领域,特别是涉及一种运算资源频率调整方法及系统。The invention relates to the field of computer application technology, in particular to a method and system for adjusting the frequency of computing resources.
背景技术Background technique
在一些领域中,例如移动智能终端中,通常线程在从一个运算资源(源运算资源)迁移到另一个运算资源(目标运算资源)上时,如果目标运算资源的当前运算频率低于目标运算资源的运算频率,目标运算资源的运算频率会被调节为源运算资源的运算频率。上述的运算资源可以为CPU(Central ProcessingUnit,中央处理单元)、GPU(Graphics Processing Unit,图形处理单元)和VPU(Video Processing Unit,视频处理单元)。例如:如图1所示,运算资源0当前的运算频率为1.5GHz,运算资源3当前的运算频率为600MHz,当线程A从运算资源0迁移到运算资源3时,系统通常会根据运算资源0的运算频率直接将运算资源3的运算频率调整至1.5GHz。In some fields, such as mobile smart terminals, when a thread migrates from one computing resource (source computing resource) to another computing resource (target computing resource), if the current computing frequency of the target computing resource is lower than the target computing resource The computing frequency of the target computing resource will be adjusted to the computing frequency of the source computing resource. The above computing resource may be a CPU (Central Processing Unit, central processing unit), a GPU (Graphics Processing Unit, graphics processing unit), and a VPU (Video Processing Unit, video processing unit). For example, as shown in Figure 1, the current computing frequency of computing resource 0 is 1.5GHz, and the current computing frequency of computing resource 3 is 600MHz. When thread A migrates from computing resource 0 to computing resource 3, the system usually directly adjust the computing frequency of the computing resource 3 to 1.5 GHz.
本发明的发明人发现:将线程从源运算资源迁移到目标运算资源上时,将目标运算资源的运算频率调节为源运算资源的运算频率,不一定刚好满足目标运算资源上的所有线程的频率需求,调整后目标运算资源可能会出现运算频率过高,从而造成功耗较大、功耗浪费(效能溢出)的问题;也可能会出现目标运算资源的运算频率仍然不足,导致效能不足,即不能满足目标运算资源上所有的线程的效能需求,导致系统卡顿的问题。The inventors of the present invention found that: when migrating threads from the source computing resource to the target computing resource, adjusting the computing frequency of the target computing resource to the computing frequency of the source computing resource may not exactly meet the frequency of all threads on the target computing resource According to the demand, after adjustment, the target computing resource may have a high computing frequency, resulting in large power consumption and waste of power consumption (performance overflow); it may also occur that the computing frequency of the target computing resource is still insufficient, resulting in insufficient performance, that is, The performance requirements of all the threads on the target computing resources cannot be met, causing the system to freeze.
发明内容Contents of the invention
鉴于此,有必要针对前述的线程在运算资源之间迁移时易出现效能溢出或不足的问题,提供一种运算资源频率调整方法及系统,能够有效避免线程在运算资源之间迁移出现的效能溢出或不足的问题。In view of this, it is necessary to provide a method and system for adjusting the frequency of computing resources, which can effectively avoid the performance overflow of threads migrating between computing resources, in order to solve the aforementioned problem of performance overflow or shortage when migrating threads between computing resources. or insufficient problems.
为达到发明目的,提供一种运算资源频率调整方法,所述方法包括:In order to achieve the purpose of the invention, a method for adjusting the frequency of computing resources is provided, the method comprising:
当有线程需要迁移时,获取所述线程将要迁移出的源运算资源和所述线程将要迁移入的目标运算资源;When a thread needs to be migrated, obtain the source computing resource that the thread will migrate out of and the target computing resource that the thread will migrate into;
计算所述线程在所述源运算资源的运算频率中所占的第一运算频率;calculating a first computing frequency occupied by the thread in the computing frequency of the source computing resource;
获取所述第一运算频率,并根据所述第一运算频率调整所述目标运算资源的运算频率;Acquiring the first computing frequency, and adjusting the computing frequency of the target computing resource according to the first computing frequency;
将所述线程迁移至所述目标运算资源。Migrate the thread to the target computing resource.
在其中一个实施例中,所述获取所述第一运算频率,并根据所述第一运算频率调整所述目标运算资源的运算频率的步骤包括:In one of the embodiments, the step of acquiring the first computing frequency and adjusting the computing frequency of the target computing resource according to the first computing frequency includes:
判断所述目标运算资源上是否存在已有线程正在被执行;Judging whether there is an existing thread being executed on the target computing resource;
若是,则获取所述目标运算资源中所述已有线程所占的第二运算频率,并将所述目标运算资源的运算频率的值调整为所述第一运算频率与所述第二运算频率之和;If yes, obtain the second computing frequency occupied by the existing thread in the target computing resource, and adjust the value of the computing frequency of the target computing resource to be the first computing frequency and the second computing frequency Sum;
若否,则将所述目标运算资源的运算频率调整至所述第一运算频率。If not, adjusting the computing frequency of the target computing resource to the first computing frequency.
在其中一个实施例中,在在所述将所述线程迁移至所述目标运算资源的步骤之后,还包括;In one of the embodiments, after the step of migrating the thread to the target computing resource, it further includes;
根据所述第一运算频率调整所述源运算资源的运算频率。Adjusting the computing frequency of the source computing resource according to the first computing frequency.
在其中一个实施例中,所述根据所述第一运算频率调整所述源运算资源的运算频率的步骤包括:In one of the embodiments, the step of adjusting the operating frequency of the source computing resource according to the first operating frequency includes:
将所述源运算资源的运算频率的值调整为源运算资源的原运算频率与所述第一运算频率之差。The value of the computing frequency of the source computing resource is adjusted to the difference between the original computing frequency of the source computing resource and the first computing frequency.
在其中一个实施例中,在所述当有线程需要迁移时,获取所述线程将要迁移出的源运算资源和所述线程将要迁移入的目标运算资源的步骤之前,还包括:In one of the embodiments, before the step of obtaining the source computing resource that the thread will migrate out of and the target computing resource that the thread will migrate into when there is a thread that needs to be migrated, it further includes:
判断是否有至少两个运算资源处于开启状态,其中,至少两个所述运算资源中至少包括一个所述源运算资源和一个所述目标运算资源;judging whether at least two computing resources are in an open state, wherein at least two computing resources include at least one source computing resource and one target computing resource;
若是,则执行所述有线程需要迁移时,获取所述线程将要迁移出的源运算资源和所述线程将要迁移入的目标运算资源的步骤;If yes, then execute the step of obtaining the source computing resource that the thread will migrate out of and the target computing resource that the thread will migrate into when there is a thread that needs to be migrated;
若否,则不执行所述线程迁移的步骤。If not, the step of thread migration is not performed.
本发明还提供一种运算资源频率调整系统,所述系统包括:The present invention also provides a computing resource frequency adjustment system, the system comprising:
获取模块,用于当有线程需要迁移时,获取所述线程将要迁移出的源运算资源和所述线程将要迁移入的目标运算资源;An acquisition module, configured to acquire, when a thread needs to be migrated, a source computing resource that the thread will migrate out of and a target computing resource that the thread will migrate into;
计算模块,用于计算所述线程在所述源运算资源的运算频率中所占的第一运算频率;a calculation module, configured to calculate the first operating frequency occupied by the thread in the operating frequency of the source operating resource;
第一调整模块,用于获取所述第一运算频率,并根据所述第一运算频率调整所述目标运算资源的运算频率;A first adjustment module, configured to acquire the first computing frequency, and adjust the computing frequency of the target computing resource according to the first computing frequency;
迁移模块,用于将所述线程迁移至所述目标运算资源。A migration module, configured to migrate the thread to the target computing resource.
在其中一个实施例中,所述第一调整模块包括:In one of the embodiments, the first adjustment module includes:
判断单元,用于判断所述目标运算资源上是否存在已有线程正在被执行;a judging unit, configured to judge whether there is an existing thread being executed on the target computing resource;
第一调整单元,用于若所述目标运算资源上存在所述已有线程正在被执行,则获取所述目标运算资源中所述已有线程所占的第二运算频率,并将所述目标运算资源的运算频率的值调整为所述第一运算频率与所述第二运算频率之和;The first adjustment unit is configured to obtain the second computing frequency occupied by the existing thread in the target computing resource if the existing thread is being executed on the target computing resource, and set the target The value of the computing frequency of the computing resources is adjusted to the sum of the first computing frequency and the second computing frequency;
第二调整单元,用于若所述目标运算资源上不存在所述已有线程正在被执行,则将所述目标运算资源的运算频率调整至所述第一运算频率。The second adjustment unit is configured to adjust the operation frequency of the target operation resource to the first operation frequency if the existing thread is not being executed on the target operation resource.
在其中一个实施例中,还包括:In one of the embodiments, it also includes:
第二调整模块,用于根据所述第一运算频率调整所述源运算资源的运算频率。A second adjustment module, configured to adjust the operating frequency of the source operating resource according to the first operating frequency.
在其中一个实施例中,所述第二调整模块包括:In one of the embodiments, the second adjustment module includes:
第三调整单元,用于将所述源运算资源的运算频率的值调整为源运算资源的原运算频率与所述第一运算频率之差。The third adjusting unit is configured to adjust the value of the computing frequency of the source computing resource to be the difference between the original computing frequency of the source computing resource and the first computing frequency.
在其中一个实施例中,还包括:In one of the embodiments, it also includes:
判断模块,用于判断是否有至少两个运算资源处于开启状态,其中,至少两个所述运算资源中至少包括一个所述源运算资源和一个所述目标运算资源;若是,则进入所述获取模块,若否,则不迁移所述线程。A judging module, configured to judge whether at least two computing resources are on, wherein at least two of the computing resources include at least one of the source computing resources and one of the target computing resources; if so, enter the acquisition module, if not, the thread is not migrated.
本发明的有益效果包括:The beneficial effects of the present invention include:
上述运算资源频率调整方法及系统,目标运算资源的运算频率是根据要迁移的线程在源运算资源的运算频率中所占的第一运算频率调整得到的,因此目标运算资源的运行频率能够很好的满足线程的频率需求,既不会出现效能溢出,造成不必要功耗的现象,也不会出现效能不足,造成系统卡顿的现象,这样既不影响使用者的使用体验,也不会有功耗上的浪费,提高了使用者的体验舒适度。In the above computing resource frequency adjustment method and system, the computing frequency of the target computing resource is adjusted according to the first computing frequency occupied by the thread to be migrated in the computing frequency of the source computing resource, so the running frequency of the target computing resource can be very good To meet the frequency requirements of the thread, there will be neither performance overflow, causing unnecessary power consumption, nor insufficient performance, causing the system to freeze. This will neither affect the user experience nor have The waste of power consumption improves the experience comfort of users.
附图说明Description of drawings
图1为一个实施例中的传统运算资源频率调整状况的示意图;FIG. 1 is a schematic diagram of frequency adjustment status of traditional computing resources in an embodiment;
图2为一个实施例中的运算资源频率调整状况的示意图;FIG. 2 is a schematic diagram of frequency adjustment status of computing resources in an embodiment;
图3为一个实施例中的运算资源频率调整方法的流程示意图;FIG. 3 is a schematic flowchart of a method for adjusting the frequency of computing resources in an embodiment;
图4为另一个实施例中的运算资源频率调整方法的流程示意图;FIG. 4 is a schematic flowchart of a method for adjusting the frequency of computing resources in another embodiment;
图5为又一个实施例中的运算资源频率调整方法的流程示意图;FIG. 5 is a schematic flowchart of a method for adjusting the frequency of computing resources in yet another embodiment;
图6为一个实施例中的运算资源频率调整系统的结构示意图。FIG. 6 is a schematic structural diagram of a computing resource frequency adjustment system in an embodiment.
具体实施方式detailed description
为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例对本发明运算资源频率调整方法及系统进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本发明,并不用于限定本发明。In order to make the purpose, technical solution and advantages of the present invention clearer, the method and system for adjusting the frequency of computing resources of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present invention, not to limit the present invention.
在一个实施例中,如图3所示,提供了一种运算资源频率调整方法,该方法包括以下步骤:In one embodiment, as shown in FIG. 3 , a method for adjusting the frequency of computing resources is provided, and the method includes the following steps:
S100,当有线程需要迁移时,获取所述线程将要迁移出的源运算资源和线程将要迁移入的目标运算资源。S100. When a thread needs to be migrated, acquire a source computing resource from which the thread will migrate and a target computing resource into which the thread will migrate.
S200,计算所述线程在源运算资源的运算频率中所占的第一运算频率。S200. Calculate a first computing frequency occupied by the thread in computing frequencies of source computing resources.
S300,获取所述第一运算频率,并根据所述第一运算频率调整所述目标运算资源的运算频率。S300. Acquire the first computing frequency, and adjust the computing frequency of the target computing resource according to the first computing frequency.
S400,将所述线程迁移至所述目标运算资源。S400. Migrate the thread to the target computing resource.
在一实施方式中,前述“根据所述第一运算频率调整目标运算资源的运算频率”指所述目标运算资源的调整后的运算频率为所述第一运算频率和所述目标运算资源的调整前的运算频率之和。In an embodiment, the aforementioned "adjusting the computing frequency of the target computing resource according to the first computing frequency" means that the adjusted computing frequency of the target computing resource is the adjusted frequency of the first computing frequency and the target computing resource. The sum of the previous operating frequencies.
本实施例中,当有线程需要在运算资源之间迁移时,获取线程迁移的源运算资源和目标运算资源,源运算资源是指线程将要迁移出的运算资源,目标运算资源是指线程将要迁移入的运算资源,并获取线程在源运算资源的运算频率中所占的第一运算频率,根据第一运算频率动态调整目标运算资源的运算频率,最后将线程迁移到目标运算资源,以使目标运算资源的运算频率以最适合线程需求的运算频率运行,不仅不会出现效能溢出,功耗浪费的情况,还能将不必要功耗降至零,同时也不会出现由于效能不足而影响到系统散热、负载、运算资源等平衡的情况,提高使用者的体验舒适度。In this embodiment, when a thread needs to be migrated between computing resources, the source computing resource and target computing resource for thread migration are obtained. The source computing resource refers to the computing resource that the thread will migrate from, and the target computing resource refers to the The input computing resource, and obtain the first computing frequency that the thread occupies in the computing frequency of the source computing resource, dynamically adjust the computing frequency of the target computing resource according to the first computing frequency, and finally migrate the thread to the target computing resource, so that the target The computing frequency of computing resources runs at the computing frequency that is most suitable for thread requirements. Not only will there be no performance overflow and power consumption waste, but unnecessary power consumption will be reduced to zero, and at the same time, there will be no impact due to insufficient performance. The balance of system heat dissipation, load, and computing resources improves user experience and comfort.
在一实施方式中,运算资源包括CPU(Central Processing Unit,中央处理单元)、GPU(Graphics Processing Unit,图形处理单元)和VPU(Video ProcessingUnit,视频处理单元)。In one embodiment, the computing resources include a CPU (Central Processing Unit, central processing unit), a GPU (Graphics Processing Unit, graphics processing unit), and a VPU (Video Processing Unit, video processing unit).
需要说明的是,每个运算资源可以在多个运算频率下运行,在理想假设没有损耗的情况下,在高运算频率下运行的运算资源能提供更好的效能输出,但同时所需要的功耗也越大。线程是占用运算资源的基本单位,可以随时中断并随时再从中断点继续执行,也可以在运算资源间自由迁移,但同一时间只能在一个运算资源上执行。迁移是指线程从在一个运算资源执行改变为在另一个运算资源执行,迁移一般由调度器调度改变。It should be noted that each computing resource can run at multiple computing frequencies. Under the ideal assumption that there is no loss, computing resources running at high computing frequencies can provide better performance output, but at the same time the required power The consumption is also greater. A thread is the basic unit that occupies computing resources. It can be interrupted at any time and resume execution from the point of interruption at any time. It can also migrate freely between computing resources, but it can only be executed on one computing resource at a time. Migration refers to the change of a thread from executing on one computing resource to executing on another computing resource. Migration is generally scheduled by the scheduler.
例如:图1中呈现了相同的四个运算资源,每个运算资源可以是开启或关闭的运行状态,其中运算资源0和3处于开启状态,运算资源1和2处于关闭状态,而线程可以在状态开启的运算资源0和3间迁移。当一个线程要迁移时,如线程A从运算资源0迁移到运算资源3时,虽然运算资源3当前的运算频率(效能)为600MHz,但该运算频率600MHz也只能满足线程D的需求。此时可以预见运算资源3是无法同时满足线程A和线程D的效能需求,因此,如果需要将线程A迁移到运算资源3,则需要调整运算资源3的运算频率。For example: Figure 1 presents the same four computing resources, and each computing resource can be enabled or disabled. Among them, computing resources 0 and 3 are in the enabled state, computing resources 1 and 2 are in the disabled state, and threads can be in the Computing resources in the enabled state migrate between 0 and 3. When a thread needs to be migrated, for example, when thread A migrates from computing resource 0 to computing resource 3, although the current computing frequency (efficiency) of computing resource 3 is 600MHz, the computing frequency of 600MHz can only meet the needs of thread D. At this time, it can be predicted that computing resource 3 cannot meet the performance requirements of thread A and thread D at the same time. Therefore, if thread A needs to be migrated to computing resource 3, the computing frequency of computing resource 3 needs to be adjusted.
现有的运算资源的频率调整技术直接将运算资源3的运算频率调整为运算资源0的运算频率,即1.5GHz,认为这样便能同时满足线程A和D的效能需求。但实际上由于不知道线程A、B、C分别占用运算资源0的1.5GHz的比例,所以运算资源3在频率调整后仍可能会出现效能不足或溢出。如:假设线程A占用的运算频率为800MHz时,将运算资源3的运算频率调整为1.5GHz,此时,运算资源3上的所有线程(即线程A和线程D)共需要1.4GHz的运算频率,此时,运算资源3多出了100MHz效能资源没有被利用,造成了浪费。或者,若线程A占用的运算频率为1GHz,即使将运算资源3的运算频率调整为1.5GHz,也不能满足线程A和线程D的1.6GHz运算频率的需求,造成效能不足,从而产生系统卡顿的现象。The existing computing resource frequency adjustment technology directly adjusts the computing frequency of computing resource 3 to the computing frequency of computing resource 0, that is, 1.5 GHz. It is believed that this can meet the performance requirements of threads A and D at the same time. But in fact, since the proportions of 1.5 GHz occupied by the threads A, B, and C respectively of the computing resource 0 are not known, the computing resource 3 may still have performance insufficiency or overflow after the frequency adjustment. For example, assuming that the computing frequency occupied by thread A is 800MHz, adjust the computing frequency of computing resource 3 to 1.5GHz. At this time, all threads on computing resource 3 (that is, thread A and thread D) need a total computing frequency of 1.4GHz , at this time, the computing resource 3 is 100 MHz more than the performance resource which is not utilized, resulting in waste. Or, if the computing frequency occupied by thread A is 1GHz, even if the computing frequency of computing resource 3 is adjusted to 1.5GHz, it cannot meet the requirements of the 1.6GHz computing frequency of thread A and thread D, resulting in insufficient performance, resulting in system freeze The phenomenon.
参见图2,在迁移线程A之前,先精确计算出运算资源上的每一个线程所需的运算频率,在由于散热、效能、耗电、负载平衡等原因需将线程A迁移至其他运算资源时,依据线程A本身所需的运算频率进行目标运算资源的运算频率调整。如:当要将线程A迁移至运算资源3时,计算线程A的运算频率需求为900MHz,计算运算资源3中已有线程D的运算频率需求为600MHz,为了让运算资源3可以同时满足线程A和线程的D的效能需求,将运算资源3的运算频率调高至1.5GHz,这样便能完美地避免能效的溢出和不足。同时将线程A从运算资源0迁出后,运算资源0的1.7GHz运算频率出现了900MHz效能溢出,所以将运算资源0的运算频率调整至800MHz,以此来避免运算资源0的能耗溢出。Referring to Figure 2, before migrating thread A, accurately calculate the computing frequency required by each thread on the computing resource. When thread A needs to be migrated to other computing resources due to heat dissipation, performance, power consumption, load balancing, etc. , adjusting the computing frequency of the target computing resource according to the computing frequency required by the thread A itself. For example: when thread A is to be migrated to computing resource 3, the computing frequency requirement of computing thread A is 900MHz, and the computing frequency requirement of thread D in computing computing resource 3 is 600MHz, so that computing resource 3 can satisfy thread A at the same time According to the performance requirements of D and thread, the computing frequency of the computing resource 3 is increased to 1.5GHz, so that the overflow and shortage of energy efficiency can be perfectly avoided. At the same time, after thread A is migrated from computing resource 0, the 1.7GHz computing frequency of computing resource 0 has 900MHz performance overflow, so the computing frequency of computing resource 0 is adjusted to 800MHz to avoid the energy consumption overflow of computing resource 0.
在一个实施例中,参见图4,步骤S300包括:In one embodiment, referring to FIG. 4, step S300 includes:
S310,判断目标运算资源上是否存在已有线程正在被执行。S310. Determine whether there is an existing thread being executed on the target computing resource.
S320,若是,则获取目标运算资源中所述已有线程所占的第二运算频率,并将目标运算资源的运算频率的值调整为第一运算频率与第二运算频率之和。S320, if yes, acquire the second computing frequency occupied by the existing thread in the target computing resource, and adjust the value of the computing frequency of the target computing resource to the sum of the first computing frequency and the second computing frequency.
S320,若否,则将所述目标运算资源的运算频率调整至所述第一运算频率S320, if not, adjust the computing frequency of the target computing resource to the first computing frequency
若线程将要迁移到的目标运算资源的上不存在已有线程正在被执行,则说明该目标运算资源刚从关闭状态中开启,此时目标运算资源的运行频率为0,若想要将线程迁移至目标运算资源时,需调整目标运算资源的运行频率满足线程的需求,最好是将目标运算资源的运算频率调整至第一运算频率,这样既不会有效能溢出,也不会有效能不足。If there is no existing thread being executed on the target computing resource to which the thread is to be migrated, it means that the target computing resource has just been turned on from the closed state. At this time, the running frequency of the target computing resource is 0. If you want to migrate the thread When reaching the target computing resource, it is necessary to adjust the running frequency of the target computing resource to meet the needs of the thread. It is best to adjust the computing frequency of the target computing resource to the first computing frequency, so that there will be neither performance overflow nor insufficient performance. .
相似的,若线程将要迁移到的目标运算资源上存在已有线程正在被执行,则说明该目标运算资源的运算状态不是刚开启状态,此时若想要将线程迁移至目标运算资源时,需要调整目标运算资源的运行频率满足已有线程和该迁移线程的频率需求,最好是将目标运算资源的运算频率调整为第一运算频率与第二运算频率之和,这样便能完美地避免效能溢出或不足。。Similarly, if there is an existing thread being executed on the target computing resource to which the thread is to be migrated, it means that the computing status of the target computing resource is not just started. At this time, if you want to migrate the thread to the target computing resource, you need to Adjust the operating frequency of the target computing resource to meet the frequency requirements of the existing thread and the migrated thread. It is best to adjust the operating frequency of the target computing resource to the sum of the first computing frequency and the second computing frequency, which can perfectly avoid performance overflow or under. .
在一个实施例中,参见图5,步骤S400之后,还包括:In one embodiment, referring to FIG. 5, after step S400, further includes:
S500,根据第一运算频率调整源运算资源的运算频率。S500. Adjust the computing frequency of the source computing resource according to the first computing frequency.
优选的,在一个实施例中,步骤S500包括:Preferably, in one embodiment, step S500 includes:
S510,将源运算资源的运算频率的值调整为源运算资源的原运算频率与第一运算频率之差。S510. Adjust the value of the computing frequency of the source computing resource to be the difference between the original computing frequency of the source computing resource and the first computing frequency.
将线程迁移出源运算资源之后,由于源运算资源中满足迁移线程需求的运算频率空闲出来,这样造成了效能的溢出,根据第一运算频率按照一定的比例调整源运算资源,以降低源运算资源的效能溢出。优选的,将源运算资源的运算频率的值调整为源运算资源的原运算频率与第一运算频率之差,能够有效的避免源运算资源的效能溢出。After the thread is migrated from the source computing resource, the computing frequency that meets the needs of the migrated thread in the source computing resource is free, which causes performance overflow. Adjust the source computing resource according to a certain ratio according to the first computing frequency to reduce the source computing resource. performance overflow. Preferably, the value of the computing frequency of the source computing resource is adjusted to the difference between the original computing frequency of the source computing resource and the first computing frequency, which can effectively avoid performance overflow of the source computing resource.
在一个实施例中,在步骤S100之前,还包括:In one embodiment, before step S100, it also includes:
S010,判断是否有至少两个运算资源处于开启状态,其中,所述至少两个运算资源中至少包括一个源运算资源和一个目标运算资源;若是,则执行步骤S100;若否,则不执行线程迁移的步骤。S010, judging whether at least two computing resources are in an open state, wherein the at least two computing resources include at least one source computing resource and one target computing resource; if yes, perform step S100; if not, do not execute the thread Migration steps.
线程的迁移是指线程从一个状态为开启的运算资源上迁移到另一个状态为开启的运算资源上,即线程在状态开启的运算资源上迁移,若只有一个或没有运算资源的状态是开启的,则无法执行线程的迁移,因此也无需对运算资源的运算频率进行调整,简便了不必要的执行过程。Thread migration refers to the migration of a thread from one computing resource whose state is enabled to another computing resource whose state is enabled, that is, a thread migrates on a computing resource whose state is enabled, if only one or no computing resource is enabled , thread migration cannot be performed, so there is no need to adjust the computing frequency of computing resources, which simplifies unnecessary execution processes.
值得说明的是,若只有两个运算资源的状态为开启状态,则如果线程要执行迁移的步骤,则这两个运算资源中必定有一个为源运算资源,另一个为目标运算资源。若运算资源中有多个为开启状态(两个以上),这多个运算资源中也至少有一个为源运算资源,至少一个为目标运算资源。It is worth noting that if only two computing resources are enabled, then if the thread is to perform the migration step, one of the two computing resources must be the source computing resource and the other must be the target computing resource. If more than one of the computing resources is enabled (more than two), at least one of the multiple computing resources is a source computing resource, and at least one is a target computing resource.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(Random Access Memory,RAM)等。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented through computer programs to instruct related hardware, and the programs can be stored in a computer-readable storage medium. During execution, it may include the processes of the embodiments of the above-mentioned methods. Wherein, the storage medium may be a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM) or a random access memory (Random Access Memory, RAM) and the like.
在一个实施例中,如图6所示,还提供了一种运算资源频率调整系统,该系统包括:获取模块100,用于当有线程需要迁移时,获取线程将要迁移出的源运算资源和所述线程将要迁移入的目标运算资源。计算模块200,用于计算所述线程在源运算资源的运算频率中所占的第一运算频率。第一调整模块300,用于获取第一运算频率,并根据第一运算频率调整目标运算资源的运算频率。迁移模块400,用于将线程迁移至目标运算资源。In one embodiment, as shown in FIG. 6 , a computing resource frequency adjustment system is also provided, the system includes: an acquisition module 100, configured to acquire the source computing resources and The target computing resource to which the thread will be migrated. The calculation module 200 is configured to calculate the first operation frequency occupied by the thread in the operation frequency of the source operation resource. The first adjusting module 300 is configured to obtain a first computing frequency, and adjust the computing frequency of the target computing resource according to the first computing frequency. Migration module 400, configured to migrate threads to target computing resources.
本实施例中,目标运算资源的运算频率是根据要迁移的线程在源运算资源的运算频率中所占的第一运算频率调整得到的,因此目标运算资源的运行频率能够很好的满足线程的频率需求,既不会出现效能溢出,造成不必要功耗的现象,也不会出现效能不足,造成系统卡顿的现象。这样既不影响使用者的使用体验,也不会有功耗上的浪费,提高使用者的体验舒适度。In this embodiment, the computing frequency of the target computing resource is adjusted according to the first computing frequency occupied by the thread to be migrated in the computing frequency of the source computing resource, so the running frequency of the target computing resource can well meet the requirements of the thread. Frequency requirements, there will be neither performance overflow, causing unnecessary power consumption, nor insufficient performance, causing the system to freeze. In this way, the use experience of the user will not be affected, and there will be no waste of power consumption, so as to improve the experience comfort of the user.
在一个实施例中,第一调整模块300包括:判断单元310,用于判断目标运算资源上是否存在已有线程正在被执行。第一调整单元320,用于若目标运算资源上存在已有线程正在被执行,则获取目标运算资源中所述已有线程所占的第二运算频率,并将所述目标运算资源的运算频率的值调整为所述第一运算频率与所述第二运算频率之和。第二调整单元330,用于若所述目标运算资源上不存在所述已有线程正在被执行,则将所述目标运算资源的运算频率调整至所述第一运算频率。In one embodiment, the first adjustment module 300 includes: a judging unit 310, configured to judge whether there is an existing thread being executed on the target computing resource. The first adjustment unit 320 is configured to obtain the second computing frequency occupied by the existing thread in the target computing resource if there is an existing thread being executed on the target computing resource, and calculate the computing frequency of the target computing resource The value of is adjusted as the sum of the first operation frequency and the second operation frequency. The second adjustment unit 330 is configured to adjust the operation frequency of the target operation resource to the first operation frequency if the existing thread is not being executed on the target operation resource.
在一个实施例中,还包括:第二调整模块500,用于根据第一运算频率调整源运算资源的运算频率。In one embodiment, it further includes: a second adjustment module 500, configured to adjust the operating frequency of the source operating resource according to the first operating frequency.
在一个实施例中,第二调整模块500包括第三调整单元510,用于将源运算资源的运算频率的值调整为源运算资源的原运算频率与所述第一运算频率之差。In one embodiment, the second adjustment module 500 includes a third adjustment unit 510, configured to adjust the value of the computing frequency of the source computing resource to the difference between the original computing frequency of the source computing resource and the first computing frequency.
在一个实施例中,还包括:判断模块010,用于判断是否有至少两个运算资源处于开启状态,其中,至少两个运算资源中至少包括一个源运算资源和一个目标运算资源;若是,则进入获取模块100,若否,则不迁移线程。In one embodiment, it further includes: a judging module 010, configured to judge whether at least two computing resources are turned on, wherein the at least two computing resources include at least one source computing resource and one target computing resource; if so, then Enter the acquisition module 100, if not, the thread will not be migrated.
由于此系统解决问题的原理与前述一种运算资源频率调整方法相似,因此该系统的实施可以参见前述方法的实施,重复之处不再赘述。Since the principle of this system to solve the problem is similar to the aforementioned method for adjusting the frequency of computing resources, the implementation of this system can refer to the implementation of the aforementioned method, and the repetition will not be repeated.
以上所述实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The various technical features of the above-mentioned embodiments can be combined arbitrarily. For the sake of concise description, all possible combinations of the various technical features in the above-mentioned embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, should be considered as within the scope of this specification.
以上所述实施例仅表达了本发明的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本发明构思的前提下,还可以做出若干变形和改进,这些都属于本发明的保护范围。因此,本发明专利的保护范围应以所附权利要求为准。The above-mentioned embodiments only express several implementation modes of the present invention, and the descriptions thereof are relatively specific and detailed, but should not be construed as limiting the patent scope of the invention. It should be noted that those skilled in the art can make several modifications and improvements without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the patent for the present invention should be based on the appended claims.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201610242207.9ACN105930218A (en) | 2016-04-18 | 2016-04-18 | Computing resource frequency adjustment method and system |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201610242207.9ACN105930218A (en) | 2016-04-18 | 2016-04-18 | Computing resource frequency adjustment method and system |
| Publication Number | Publication Date |
|---|---|
| CN105930218Atrue CN105930218A (en) | 2016-09-07 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201610242207.9APendingCN105930218A (en) | 2016-04-18 | 2016-04-18 | Computing resource frequency adjustment method and system |
| Country | Link |
|---|---|
| CN (1) | CN105930218A (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109471716A (en)* | 2018-09-26 | 2019-03-15 | 努比亚技术有限公司 | A kind of application thread processing method, terminal and computer readable storage medium |
| WO2022179473A1 (en)* | 2021-02-23 | 2022-09-01 | 华为技术有限公司 | Frequency adjustment method for inter-core migration |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101122868A (en)* | 2007-09-18 | 2008-02-13 | 中兴通讯股份有限公司 | Device and method for implementing transparent course migration |
| CN101504618A (en)* | 2009-02-26 | 2009-08-12 | 浙江大学 | Multi-core processor oriented real-time thread migration method |
| CN102004543A (en)* | 2010-11-29 | 2011-04-06 | 华为技术有限公司 | Method and device for realizing energy saving of CPU |
| CN102866921A (en)* | 2012-08-29 | 2013-01-09 | 惠州Tcl移动通信有限公司 | Method and system for regulating and controlling multi-core central processing unit (CPU) |
| CN102915107A (en)* | 2011-08-04 | 2013-02-06 | 联芯科技有限公司 | Regulating method of power consumption of terminal as well as terminal |
| WO2015023191A1 (en)* | 2013-08-13 | 2015-02-19 | Putyrski Sławomir | Power balancing to increase workload density and improve energy efficiency |
| CN104781803A (en)* | 2012-12-26 | 2015-07-15 | 英特尔公司 | Thread migration support for architecturally different cores |
| CN104866379A (en)* | 2014-02-24 | 2015-08-26 | 中兴通讯股份有限公司 | Multi-core processor scheduling method and device as well as terminal |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101122868A (en)* | 2007-09-18 | 2008-02-13 | 中兴通讯股份有限公司 | Device and method for implementing transparent course migration |
| CN101504618A (en)* | 2009-02-26 | 2009-08-12 | 浙江大学 | Multi-core processor oriented real-time thread migration method |
| CN102004543A (en)* | 2010-11-29 | 2011-04-06 | 华为技术有限公司 | Method and device for realizing energy saving of CPU |
| CN102915107A (en)* | 2011-08-04 | 2013-02-06 | 联芯科技有限公司 | Regulating method of power consumption of terminal as well as terminal |
| CN102866921A (en)* | 2012-08-29 | 2013-01-09 | 惠州Tcl移动通信有限公司 | Method and system for regulating and controlling multi-core central processing unit (CPU) |
| CN104781803A (en)* | 2012-12-26 | 2015-07-15 | 英特尔公司 | Thread migration support for architecturally different cores |
| WO2015023191A1 (en)* | 2013-08-13 | 2015-02-19 | Putyrski Sławomir | Power balancing to increase workload density and improve energy efficiency |
| CN105814543A (en)* | 2013-08-13 | 2016-07-27 | 英特尔公司 | Power balancing for increased load density and improved energy efficiency |
| CN104866379A (en)* | 2014-02-24 | 2015-08-26 | 中兴通讯股份有限公司 | Multi-core processor scheduling method and device as well as terminal |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109471716A (en)* | 2018-09-26 | 2019-03-15 | 努比亚技术有限公司 | A kind of application thread processing method, terminal and computer readable storage medium |
| WO2022179473A1 (en)* | 2021-02-23 | 2022-09-01 | 华为技术有限公司 | Frequency adjustment method for inter-core migration |
| Publication | Publication Date | Title |
|---|---|---|
| US9378536B2 (en) | CPU/GPU DCVS co-optimization for reducing power consumption in graphics frame processing | |
| JP6355853B2 (en) | System and method for providing dynamic cache expansion in a multi-cluster heterogeneous processor architecture | |
| CN104423529B (en) | Central processing unit state adjustment method and device | |
| KR101842016B1 (en) | Method for dynamically controlling power in multicore environment | |
| US10242418B2 (en) | Reconfigurable graphics processor for performance improvement | |
| WO2008124455A3 (en) | Priority based throttling for power/performance quality of service | |
| US20160291672A1 (en) | Preformance state aware thread scheduling | |
| CN103037109B (en) | Multicore equipment energy consumption management method and device | |
| CN104866379A (en) | Multi-core processor scheduling method and device as well as terminal | |
| TW201324357A (en) | Green energy management of virtual machine cluster | |
| US20160342191A1 (en) | Cpu frequency scaling apparatus and method | |
| US11144366B2 (en) | Computing node processor resource optimization method, computing node and server cluster | |
| US20170212581A1 (en) | Systems and methods for providing power efficiency via memory latency control | |
| CN104461673A (en) | Virtual machine transferring judgment method and device | |
| Neshatpour et al. | Big data analytics on heterogeneous accelerator architectures | |
| US20160378791A1 (en) | Method and apparatus for performing a search operation on heterogeneous computing systems | |
| CN105930218A (en) | Computing resource frequency adjustment method and system | |
| CN108845659A (en) | A kind of embeded processor real-time task distribution method that power consumption is preferential | |
| WO2025059547A1 (en) | Memory hierarchy power management | |
| US10242652B2 (en) | Reconfigurable graphics processor for performance improvement | |
| Khaleel et al. | Energy-aware job management approaches for workflow in cloud | |
| CN109101073B (en) | Bus dynamic frequency modulation method and bus dynamic frequency modulation device | |
| Ravi et al. | Mobile computation bursting: An application partitioning and offloading decision engine | |
| US20160048190A1 (en) | Method and apparatus for controlling performance of electronic device | |
| CN105487597A (en) | Clock management method and device of central processing unit |
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| RJ01 | Rejection of invention patent application after publication | ||
| RJ01 | Rejection of invention patent application after publication | Application publication date:20160907 |