The disclosed embodiments of the present invention relate to a task migration control scheme, and more particularly, to a method for controlling a task migration of a task in a heterogeneous multi-core system based on dynamic migration threshold and related computer readable medium.
A multi-core system becomes popular nowadays due to advance of the semiconductor process. Hence, an operating system (OS) of the multi-core system frequently needs to decide whether or not a task running on a current core should migrate to a different core to maintain good load balance and/or high utilization of the system resource. Regarding a heterogeneous multi-core system, it has cores that are not identical. For example, the heterogeneous multi-core system includes at least one first core and at least one second core, where each first core has first processor architecture, and each second core has second processor architecture that is different from the first processor architecture. Hence, if the same task is running on the first core and the second core, instructions executed by the first core would be different from that executed by the second core.
In general, the first core and the second core implemented in the heterogeneous multi-core system would have different computing power due to different processor architecture. For example, the first core is a performance oriented processor core, while the second core is a power-saving oriented processor core. Hence, the computing power/capability of the first core is greater than that of the second core. When a task with heavy load and high priority is dispatched to the second core with low computing power/capacity for execution, this would result in poor system performance. In contrast, when a task with light load or low priority is dispatched to the first core with high computing power/capability for execution, this would result in poor power efficiency. Besides, to achieve better system performance, more cores in the heterogeneous multi-core system should be kept busy for task handling. However, this would result in higher power consumption. In contrast, to achieve better power-saving performance, fewer cores in the heterogeneous multi-core system should be used for task handling. However, this would result in poorer system performance.
Thus, there is a need for a task migration control mechanism which is capable of properly dispatching tasks to different cores implemented in the heterogeneous multi-core system.
In accordance with exemplary embodiments of the present invention, a method for controlling a task migration of a task in a heterogeneous multi-core system based on dynamic migration threshold and related computer readable medium are proposed to solve the above-mentioned problem.
According to a first aspect of the present invention, an exemplary method for controlling a task migration of a task in a heterogeneous multi-core system having at least a first cluster and a second cluster is disclosed. The exemplary method includes the following steps: dynamically adjusting a migration threshold; comparing a load of the task running on one core of the first cluster with the migration threshold, and accordingly generating a comparison result; and selectively controlling the task to migrate to the second cluster according to at least the comparison result, wherein each core in the first cluster has first processor architecture, and each core in the second cluster has second processor architecture different from the first processor architecture.
According to a second aspect of the present invention, an exemplary method for controlling a task migration of a task in a heterogeneous multi-core system having at least a first cluster and a second cluster is disclosed. The exemplary method includes the following steps: estimating a current available capacity of the second cluster; and selectively controlling the task running on one core of the first cluster to migrate to the second cluster according to at least the estimated current available capacity, wherein each core in the first cluster has first processor architecture, and each core in the second cluster has second processor architecture different from the first processor architecture.
According to a third aspect of the present invention, an exemplary non-transitory computer readable medium storing a program code is disclosed. When executed by a heterogeneous multi-core system having at least a first cluster and a second cluster, the program code is operative to perform a task migration control method which includes the following steps: dynamically adjusting a migration threshold; comparing a load of a task running on one core of the first cluster with the migration threshold, and accordingly generating a comparison result; and selectively controlling the task to migrate to the second cluster according to at least the comparison result, wherein each core in the first cluster has first processor architecture, and each core in the second cluster has second processor architecture different from the first processor architecture.
According to a fourth aspect of the present invention, an exemplary non-transitory computer readable medium storing a program code is disclosed. When executed by a heterogeneous multi-core system having at least a first cluster and a second cluster, the program code is operative to perform a task migration control method which includes the following steps: estimating a current available capacity of the second cluster; and selectively controlling a task running on one core of the first cluster to migrate to the second cluster according to at least the estimated current available capacity, wherein each core in the first cluster has first processor architecture, and each core in the second cluster has second processor architecture different from the first processor architecture.
These and other objectives of the present invention will no doubt become obvious to those of ordinary skill in the art after reading the following detailed description of the preferred embodiment that is illustrated in the various figures and drawings.
Certain terms are used throughout the description and following claims to refer to particular components. As one skilled in the art will appreciate, manufacturers may refer to a component by different names. This document does not intend to distinguish between components that differ in name but not function. In the following description and in the claims, the terms “include” and “comprise” are used in an open-ended fashion, and thus should be interpreted to mean “include, but not limited to . . . ”. Also, the term “couple” is intended to mean either an indirect or direct electrical connection. Accordingly, if one device is coupled to another device, that connection may be through a direct electrical connection, or through an indirect electrical connection via other devices and connections.
Regarding the first cluster 112 and the second cluster 114, each cluster is a group of central processing unit (CPU) cores. That is, the first cluster 112 may include one or more first cores 113, each having the same first processor architecture; and the second cluster 114 may include one or more second cores 115, each having the same second processor architecture different from the first processor architecture. For clarity and simplicity, only one first core 113 and only one second core 115 are shown in
The task migration control module 100 may be part of a scheduler and used to enable tasks in a software stack to be distributed across CPU cores in both clusters 112 and 114. Hence, at least one first core 113 and at least one second core 115 are allowed to be in operation simultaneously. In an extreme case, all of the CPU cores may be in operation simultaneously, thus achieving the optimum system performance. Besides, with the aid of the proposed task migration control method at least based on the dynamic migration threshold, a task may migrate from one core in a cluster to another core in a different cluster. The function and operation of the proposed task migration control method performed by the task migration control module 100 are detailed as below.
The threshold adjusting unit 102 is arranged to dynamically adjust a first migration threshold (e.g., an up threshold) TH_H and a second migration threshold (e.g., a down threshold) TH_L. The first migration threshold TH_H and the second migration threshold TH_L serve as parameters of the migration control unit 104. An application (e.g., a gaming application, a web surfing application, or a phone application) executed on the heterogeneous multi-core system 10 may include a plurality of tasks. Hence, the migration control unit 104 refers to the dynamic thresholds (i.e., TH_H and TH_L) and the task load of each task to control the task to migrate between the first cluster 112 and the second cluster 114. It should be noted that the task load in the present invention is related to the CPU time that the task has recently required. Therefore, the task load is a dynamic value, depending upon the instant execution status of the task running on a CPU core.
Please refer to
Similarly, suppose that a task is initially dispatched to the first core 113 in the first cluster 112. When the task load of the task running on the first core 113 does not decrease to reach the instant value of the second migration threshold TH_L (which is adjusted dynamically), the first core 113 would keep processing the task. However, when it is determined that the task load of the task running on the first core 113 decreases to reach the instant value of the second migration threshold TH_L, the migration control unit 104 would be operative to make the task migrate from the first core 113 to the second cluster 114. To put it simply, in a situation where a task is running on the first core 113 in the beginning or after migrating from the second core 115 to the first core 113, the task does not migrate from one cluster (especially, the first core 113 in the first cluster 112) to another cluster (especially, the second core 115 in the second cluster 114) unless the task load thereof reaches the instant value of the second migration threshold TH_L.
The present invention proposes a dynamic threshold based task migration control, thus allowing tasks of an application to migrate between different clusters (i.e., heterogeneous core groups) in a more flexible manner. For better understanding of the technical features of the present invention, a comparison between a task migration control based on dynamic thresholds and a task migration control based on fixed thresholds is detailed as below.
Please refer to
As mentioned above, the threshold adjusting unit 102 is arranged to adjust the migration thresholds dynamically. In one exemplary design, the threshold adjusting unit 102 may refer to the system situation of the heterogeneous multi-core system 10 to set the aforementioned first migration threshold TH_H and the second migration threshold TH_L. For example, the system situation may include performance-related factors, such as the CPU usage per core/cluster (e.g., CPU load per core/cluster and/or CPU characteristic/ratio), the predicted CPU usage per core/cluster (e.g., predicted CPU load per core/cluster and/or predicted CPU characteristic/ratio), the number of tasks per core/cluster (e.g., the number of active tasks per core/cluster and/or the number of inactive tasks per core/cluster), and/or the load difference between cores/clusters. Since the first core(s) 113 in the first cluster 112 and the second core(s) 115 in the second cluster 114 have different hardware designs and use different instructions, the first cluster 112 would have better efficiency when used to execute tasks with some task types, and the second cluster 114 would have better efficiency when used to execute tasks with other task types. Thus, the CPU characteristic/ratio of the first cluster 112 and the second cluster 114 may be used to serve as measurement of the CPU usage. It should be noted that the CPU characteristic/ratio is a known parameter after the first cluster 112 and the second cluster 114 are designed/fabricated. Besides, when a cluster includes more than one core, the tasks dispatched to the cluster may be properly assigned to multiple cores in the same cluster for load balance. Thus, one or both of the core-based value (e.g., CPU usage per core) and the cluster-based value (e.g., CPU usage per cluster) of a performance-related factor may be involved in the dynamic migration threshold calculation.
One or more of the above-mentioned performance-related factors may be checked by the threshold adjusting unit 102 to dynamically set the first migration threshold TH_H and the second migration threshold TH_L. In this way, the proposed task migration control method is capable of making the heterogeneous multi-core system 10 have optimized system performance.
In another exemplary design, the system situation of the heterogeneous multi-core system 10 may include power-related factors, such as the power budget per core/cluster, the power consumption per core/cluster, and the power constraint (e.g., thermal constraint) per core/cluster. Similarly, when a cluster includes more than one core, the tasks dispatched to the cluster may be properly assigned to multiple cores in the same cluster for load balance. Thus, one or both of the core-based value (e.g., power budge per core) and the cluster-based value (e.g., power budget per cluster) of a power-related factor may be involved in the dynamic migration threshold calculation. It should be noted that one or more of the power-related factors may be checked by the threshold adjusting unit 102 to dynamically set the first migration threshold TH_H and the second migration threshold TH_L. In this way, the proposed task migration control is capable of making the heterogeneous multi-core system 10 have optimized power-saving performance.
In yet another exemplary design, at least one of the above-mentioned power-related factors and at least one of the above-mentioned performance-related factors may be concurrently checked by the threshold adjusting unit 102 to dynamically set the first migration threshold TH_H and the second migration threshold TH_L. In this way, the proposed task migration control is capable of making the heterogeneous multi-core system 10 have balanced performance associated with task-handling and power-saving.
In addition, the migration control unit 104 may also refer to the task priority of the tasks to decide whether this task should be migrated or not. In other words, the task priority assigned to each task to be executed is a factor that affects migration judgment. For example, when it is determined that the task load of a task running on the first core 113 decreases to reach the instant value of the dynamically-adjusted second migration threshold TH_L and the priority of the task permits a task migration from the first cluster 112 to the second cluster 114, the migration control unit 104 therefore decides to make the task migrate to the second cluster 114 for execution. Similarly, when it is determined that the task load of a task running on the second core 115 increases to reach the instant value of the dynamically-adjusted first migration threshold TH_H and the priority of the task permits a task migration from the second cluster 114 to the first cluster 112, the migration control unit 104 therefore decides to make the task migrate to the first cluster 112 for execution. Specifically, in one exemplary design, a task with low priority must migrate to a less powerful cluster (i.e., the second cluster 114) even through its task load is not beneath the instant value of the second migration threshold TH_L.
To put it simply, the factors that affect the migration threshold setting may include at least the system situation (e.g., performance-related factor(s) and/or power-related factor(s)), and the factors that affect the migration judgment may include at least the task priority.
In above embodiment, both of the up threshold (i.e., the first migration threshold TH_H) and the down threshold (i.e., the second migration threshold TH_L) are dynamically adjusted by the threshold adjusting unit 102. In one alternative design, the threshold adjusting unit 102 may be configured to refer to the system situation to dynamically adjust one of the up threshold and the down threshold while leaving the other of the up threshold and the down threshold unchanged (i.e., fixed). This also falls within the scope of the present invention.
In addition to the dynamic threshold(s) provided by the threshold adjusting unit 102, the migration control unit 104 may employ addition mechanism(s) to further improve the overall task migration performance.
The aforementioned CPU capacity check and dynamic threshold calculation strongly depend on the preciseness of the task load. When a task just migrates to a new core of a selected cluster, the task is not executed by the new core yet. Thus, the task load may be incorrect. However, at this moment, it may have non-zero task load. If the task load of the migrated task is considered before the migrated task is actually running on the new core, the task migration control may have incorrect CPU/cluster capacity check result and dynamic threshold calculation result. Thus, to improve the preciseness of the estimated task load, the historical contribution of the task load of the migrated task running on the new core should be considered. Hence, the task has to run on the new core for a period of time and then its load is recalculated and used by the migration control unit 104 and the threshold adjusting unit 102. An embodiment of the present embodiment may be configured to include a migration stabilizing mechanism which improves the preciseness of the estimated task load, as shown in
Besides, using all of aforementioned mechanisms, including the migration stabilizing mechanism, the CPU capacity check, and the dynamic migration threshold calculation, to control the task migration is merely one feasible implementation of the present invention. Any task migration control design using at least one of the CPU capacity check and the dynamic migration threshold calculation would fall within the scope of the present invention.
Those skilled in the art will readily observe that numerous modifications and alterations of the device and method may be made while retaining the teachings of the invention. Accordingly, the above disclosure should be construed as limited only by the metes and bounds of the appended claims.
This application claims the benefit of U.S. provisional application No. 61/737,834, filed on Dec. 17, 2012 and incorporated herein by reference.
Number | Date | Country | |
---|---|---|---|
61737834 | Dec 2012 | US |