Enhanced Harmonic Partitioned Scheduling of Periodic Real-Time Tasks Based on Slack Analysis

The adoption of multiprocessor platforms is growing commonplace in Internet of Things (IoT) applications to handle large volumes of sensor data while maintaining real-time performance at a reasonable cost and with low power consumption. Partitioned scheduling is a competitive approach to ensure the temporal constraints of real-time sensor data processing tasks on multiprocessor platforms. However, the problem of partitioning real-time sensor data processing tasks to individual processors is strongly NP-hard, making it crucial to develop efficient partitioning heuristics to achieve high real-time performance. This paper presents an enhanced harmonic partitioned multiprocessor scheduling method for periodic real-time sensor data processing tasks to improve system utilization over the state of the art. Specifically, we introduce a general harmonic index to effectively quantify the harmonicity of a periodic real-time task set. This index is derived by analyzing the variance between the worst-case slack time and the best-case slack time for the lowest-priority task in the task set. Leveraging this harmonic index, we propose two efficient partitioned scheduling methods to optimize the system utilization via strategically allocating the workload among processors by leveraging the task harmonic relationship. Experiments with randomly synthesized task sets demonstrate that our methods significantly surpass existing approaches in terms of schedulability.


Introduction
In Internet of Things (IoT) applications, sensors are critical components that continuously monitor and collect data from the environment.Generally, the sensor data need to be processed in real time to enable timely responses and actions [1][2][3][4].With the rapid advancement in multiprocessor technology, multiprocessor platforms have already been widely adopted in IoT applications to handle large volumes of sensor data while maintaining real-time performance at a reasonable cost and with low power consumption [5][6][7][8].Conversely, partitioned scheduling statically assigns tasks to specific processors, where they execute without migration.In comparison to global scheduling, partitioned scheduling can effectively alleviate the unpredictability of system run-time behaviors through safe isolation between different processors [9].In most cases, the partitioning approach is generally considered to be the most appropriate solution owing to its simplicity and efficiency when the task set is predetermined and known in advance.Consequently, partitioned scheduling has gained widespread adoption and support in a variety of commercial real-time operating systems for IoT applications [10].
Unfortunately, the task allocation problem in partitioned scheduling is similar to the bin-packing problem, which is recognized as strongly N P-hard [11].To address the task allocation problem in partitioned scheduling, a rich literature has been developed, and a comprehensive survey can be found in [12,13].Early research in partitioned multiprocessor scheduling often relied on combining different bin-packing heuristics with task ordering methods for the task allocation [12,13].However, these approaches disregard the potential impact of some implicit relations among tasks on the schedulability of tasks assigned to a processor [14].More recently, there has been an increased focus on optimizing processor utilization by exploiting the task period relationship during task partitioning.Much work in this direction is motivated by the observation that the utilization bound of a task set tends to rise as the task periods exhibit greater harmonicity [15].To optimize the schedulability of the system with periodic real-time tasks by leveraging the task period harmonic relationships, Wang et al. [14] proposed two harmonic-aware partitioned approaches to group tasks with harmonic periods on the same processor.For probabilistic real-time systems, Wang et al. [16] presented four harmonic metrics and a harmonicity-aware partitioning method to optimize system utilization.Their main idea was to assign harmonic tasks to a single processor to enhance the system usage by exploring the harmonic relationship among tasks.Nonetheless, its performance deteriorates when the system includes some heavy-utilization tasks.The main cause of this is the lack of consideration for workload characteristics during task allocation, resulting in a fragmentation issue, where certain tasks cannot be assigned despite the overall processor capacity being relatively high [17].
To address this problem, Ren et al. [17] proposed a workload-aware harmonic partitioned scheduling method for probabilistic multiprocessor real-time systems.For constraineddeadline real-time tasks, Wang et al. [18] introduced two harmonic scheduling methods, GIM and HCM.However, neither GIM nor HCM adequately incorporate the impact of harmonicity and workload characteristic on the task allocation performance.To address this problem, Ren et al. [19] further refined this approach by designing grouping metrics that consider both harmonicity and workload characteristics.These investigations demonstrate that system schedulability can be substantially enhanced compared to traditional bin-packing approaches when task harmonic relationships are effectively utilized.However, these studies quantify the task set harmonicity by measuring the "distance" from an associated harmonic task set with respect to change in density or utilization, and they construct a harmonic counterpart of a task set by scaling periods or deadlines.This harmonicity metric is too tight to effectively quantify the harmonicity of some task sets, limiting the potential improvements in schedulability for some task sets using existing harmonic-partitioned scheduling methods.
In this paper, we propose a more general harmonicity characterization approach based on the slack variation to address the limitations of the existing methods mentioned above.In particular, we propose an exact analysis method for the worst-case slack time and the bestcase slack time to derive the harmonic index based on slack variation.With the proposed harmonic index, we present two enhanced harmonic task partitioning algorithms.The first algorithm, named EHAP-SV, focuses on improving the system utilization by leveraging the task harmonic relationships.To tackle the "fragmentation" issue and further enhance the system schedulability, we also propose a workload-aware harmonic partitioning algorithm called WAHP-SV, incorporating both harmonicity and workload characteristics into the scheduling framework.Contributions.The primary contributions of this work are as follows:

•
A more general harmonic index based on slack variation to effectively quantify the harmonicity degree of a periodic real-time task set; • An exact analysis method for the worst-case slack time and the best-case slack time to derive the slack variation-based harmonic index; • An enhanced harmonic task partitioning scheme to optimize the system utilization by leveraging the harmonic relationships to allocate harmonic tasks to one processor; • A workload-aware harmonic task partitioning scheme by designing a metric integrating the exploration of harmonic relationships and workload characteristics to alleviate the "fragmentation" problem in the pure harmonic task partitioning method.
Experimental evaluation on randomly synthesized task systems demonstrates that our methods surpass existing partitioned scheduling approaches in terms of schedulability.
The remaining sections are structured as follows.Section 2 provides the system model and problem definition.In Section 3, we present the harmonic index based on slack variation and give its calculation method based on slack time analysis.Section 4 presents a detailed description of our proposed enhanced harmonic partitioned scheduling schemes.The experimental evaluation is given in Section 5, and we conclude the paper in Section 6.

System Model and Problem Definition
Before presenting the detailed system model, we summarize the major notations used in this paper in Table 1.

Notation Description
Utilization change-based harmonic index of task set Γ H slack (Γ) Slack variation-based harmonic index of task set Γ Sensors in IoT systems generally generate data at various rates to constantly track and measure some properties, and the processing tasks often have different periods and deadlines.In this paper, we focus on a real-time system in IoT with n independent periodic real-time sensor data processing tasks, represented by Γ = {τ 1 ,..., τ n }.These tasks are preemptively scheduled on a multiprocessor platform comprising m identical processors with unit-capacity, indicated as Π = {π 1 ,...,π m }, according to the rate monotonic (RM) policy.We assume a discrete notion of real time t = xθ, x ≥ 0, where θ is both the unit time and the smallest unit of preemption, and all timing values are specified as non-negative integers.For each task τ i ∈ Γ, described by a triple τ i = (C i , T i , D i ), where: • C i represents the worst-case execution time (WCET) of τ i ; • T i denotes the inter-arrival time (period) of τ i ; • D i represents the relative deadline of τ i .
All tasks are considered to be implicit-deadline real-time tasks (i.e., D i = T i ).All tasks are assumed to be initially released simultaneously at time t = 0.The job of τ i is indicated by J i,k , with its release time represented by r i,k .The WCETs of all tasks are assumed to be strictly positive.The worst-case response time (WCRT) of a task τ i , represented by R i , measures the maximum interval between a job's release and its completion, taking into account potential interference from other tasks.A task set Γ is considered schedulable if the WCRT of every task τ i ∈ Γ does not exceed the deadline.The hyperperiod of the task set Γ is indicated by H Γ , which is the least common multiple of periods of all tasks in Γ.
We characterize the workload of tasks by using the task utilization.

Definition 1.
The utilization of a real-time task τ i = (C i , T i , D i ), denoted as U i , is expressed as Definition 2. The total utilization of a real-time task set Γ, indicated as U Γ , is expressed as Definition 3. Given a set of n independent periodic real-time sets Γ = {τ 1 ,..., τ n } and m identical processors Π = {π 1 ,. ..,π m }, the goal of the partitioned multiprocessor scheduling problem is to assign each task in Γ to exactly one processor in Π such that all tasks meet their deadlines while minimizing the overall number of processors utilized.
Note that the task allocation problem in partitioned scheduling is similar to the binpacking problem, which is recognized as strongly N P-hard [11].Definition 4 ([11]).Given a bin capacity V and a set of n items x 1 ,. ..,x n with sizes a 1 ,. ..,a n , the goal of the bin-packing optimization problem is to assign each item to a bin such that the number of bins is minimized and no bin exceeds its capacity V.
Proof.To prove that the partitioned multiprocessor scheduling problem is N P-hard, we reduce an instance of the bin-packing problem to an instance of the partitioned multiprocessor scheduling problem.
For each item x i in the bin-packing problem, we create a corresponding task τ i with WCET C i = a i .Let us consider the period and deadline of each task τ i to be bin capacity V (i.e., T i = D i = V).This implies that each task must complete its execution within one period, which corresponds to the capacity of the bin.Each processor in the scheduling problem is considered as a bin in the bin-packing problem.Each processor has a capacity in terms of the total execution time it can handle within the period.Thus, if we can find a valid partitioned multiprocessor schedule for the tasks such that all tasks meet their deadlines, then this corresponds to a valid bin-packing solution, where the number of processors used is equivalent to the number of bins used.
According to [11], the bin-packing problem is N P-hard.Since we can reduce any instance of the bin-packing problem to an instance of the partitioned multiprocessor scheduling problem in polynomial time, and a solution to the scheduling problem would provide a solution to the bin-packing problem, it follows that the partitioned multiprocessor scheduling problem is also N P-hard.
To improve the performance of the partitioned scheduling via the harmonic relationship exploration based on the effective harmonicity quantification, we introduce a harmonic index based on slack variation to measure the harmonic characteristic among tasks.In the following, we provide some definitions of slack time.
Definition 5.For a job J i,k of a real-time task τ i , its slack time, indicated as S i,k , is defined as the amount of idle time during the interval [r i,k , r i,k + T i ) when all jobs of all tasks always experience worst-case execution times.Definition 6.The worst-case slack time of a real-time task τ i , indicated as S W i , is defined as Definition 7. The best-case slack time of a real-time task τ i , indicated as S B i , is expressed as The primary aim of this research is to develop an efficient task partitioning method, ensuring that each processor's assigned set of tasks is schedulable while minimizing the overall number of processors utilized.We analyze the drawbacks of the current harmonic index for harmonicity-aware partitioning schemes with an example, and introduce a novel harmonic index based on slack variation to guide the task partition.With the proposed harmonic index, we devise two efficient partitioned scheduling schemes to enhance system utilization through efficiently leveraging the task harmonic relationship.

Harmonicity Quantification Based on Slack Analysis
To enhance the performance of the partitioned scheduling via the harmonic relationship exploration based on the effective harmonicity quantification, we propose a slack variation-based harmonic index to guide the task partition.In this section, we first illustrate the motivation behind the slack variation-based harmonic index through an example to highlight the drawbacks of the utilization change-based harmonic index.We then provide a comprehensive explanation of our harmonic index based on slack variation.Additionally, we also present an exact analysis method to determine the worst-case and best-case slack times, which are utilized to calculate the harmonic index based on slack variation.

Motivations
In order to optimize task partition by exploring harmonic relationships, it is crucial to quantify the task set harmonicity degree, as not all tasks are strictly harmonic.Fan et al. [14] presented a task set harmonic index through measuring the "distance" between a task set and the corresponding harmonic task set with regard to the total utilization change.However, such a harmonic index is too tight to effectively quantify the degree of harmonic for certain task sets, thereby limiting the potential improvement in the schedulability through the harmonic relationship exploration with this index.Here, we first discuss the shortcomings of the existing harmonic index, and then, introduce our proposed harmonic index based on slack variation.

and for any two tasks τ
This new task set Γ ′ is referred to as a sub-harmonic task set of task set Γ.

Definition 9 ([14]
).Given a sub-harmonic task set Γ ′ of task set Γ, we define task set Γ ′ as the primary harmonic task set of task set Γ when there is no other sub-harmonic task set Γ ′′ , such that T ′ i ≤ T ′′ i for all i where 1 ≤ i ≤ n.

Definition 10 ([14]
).For a task set Γ, let G(Γ) be all primary harmonic task sets of task set Γ.The utilization change-based harmonic index of task set Γ, indicated as H uc (Γ), is expressed as From Equation (5), we can observe that H uc is characterized as the minimum "distance" between a task set and its primary harmonic task sets with regard to the change in total utilization.We can also see that a low value of H uc indicates a high harmonic relationship, and a task set Γ is strictly "harmonic" exactly when H uc (Γ) = 0.For primary harmonic task sets, they can be obtained with the Sr or DCT algorithms in [15].However, the original intention of the primary harmonic task set is to improve the schedulability analysis of the RM scheduling strategy, and it considers a task set to be strictly harmonic exactly when every pair of tasks in the task set are strictly harmonic.This leads to inaccurate quantification of the harmonicity of some task sets from the perspective of system resource utilization, and we illustrate this issue with an example.
Example 1.Let us consider a task set Γ = {τ 1 , τ 2 , τ 3 }, as given in Table 2, executed on a uniprocessor under the RM scheduling policy.Here, T ′ i represents the period of the task corresponding to task τ i in a primary harmonic task set and thus, H uc (Γ) = 7/6 − 1 = 1/6.Therefore, Γ is not strictly "harmonic" based on the definition of the harmonic index H uc .However, according to the simulation of the synchronous arrival sequence (SAS) for all tasks in Γ in Figure 1, it is evident that Γ is schedulable.Moreover, the utilization of Γ is 1, and thus, Γ can be regarded as strictly "harmonic" from the perspective of system resource utilization because the maximum utilization is achieved.Therefore, the harmonic index H uc is not able to effectively quantify the harmonicity degree of Γ due to its tight restriction.This leads to the harmonic partitioned scheduling method based on H uc not offering good performance for some task sets (see example 3).In the following section, we give a more general harmonic index based on slack variation, which can effectively quantify the harmonicity of task set Γ (see example 2).   2.

Harmonic Index Based on Slack Variation
As indicated in example 1, the utilization change-based harmonic index cannot effectively quantify the harmonicity of some task sets from the perspective of system resource utilization.Now, we first discuss the property of the schedulable task set that can achieve maximum utilization; thus, we can shed some light on the design of our proposed harmonic index based on slack variation.Lemma 1.Consider a schedulable task set Γ = {τ 1 , ..., τ n } with U Γ = 1 on a uniprocessor under the rate monotonic (RM) policy.Here, tasks in Γ are sorted in decreasing priority and their WCETs are greater than 0.Then, the WCRT R n of τ n equals its period T n , that is, R n = T n .
Proof.Since tasks in task set Γ are ordered in decreasing priority, task τ n has the lowest priority and Thus, we can obtain Based on [20], the WCRT R n satisfies the following equation: Because the task set Γ is schedulable, we have R n = T n − δ, where δ ≥ 0. Therefore, with Equations ( 7) and ( 8), we have By Equation ( 9), we have With Equations ( 6) and ( 10), we have Since the WCETs of all tasks are greater than 0 and δ ≥ 0, by Equation ( 11), we have δ = 0. Therefore, the worst-case response time R n is equal to its period T n .
Based on Lemma 1, for a schedulable task set Γ = {τ 1 , ..., τ n } with U Γ = 1 on a uniprocessor under the RM policy, we can obtain the relationship between the period of task τ n and the periods of tasks with higher priorities than task τ n (i.e., Lemma 2).Lemma 2. Consider a schedulable task set Γ = {τ 1 , ..., τ n } with U Γ = 1 on a uniprocessor under the rate monotonic (RM) policy.Here, tasks in Γ are sorted in descending priority and their WCETs are greater than 0.Then, the period T n of task τ n is a common multiple of periods of all higher-priority tasks τ i for 1 ≤ i ≤ n − 1.
Proof.By Lemma 1 and Equation ( 8), we have By Equations ( 7) and ( 12), we have Since the WCETs of all tasks are greater than 0, by Equation ( 13), we have ⌈T n /T i ⌉ = T n /T i for each task τ i .Therefore, the period T n of task τ n is a common multiple of periods of all higher-priority tasks τ i for 1 ≤ i ≤ n − 1.
Theorem 3. Consider a schedulable task set Γ = {τ 1 , ..., τ n } with U Γ = 1 on a uniprocessor under the rate monotonic (RM) policy.Here, tasks in Γ are sorted in decreasing priority and their WCETs are greater than 0. The worst-case slack time S W n of τ n equals its best-case slack time S B n , i.e., S W n = S S n .
Proof.According to Lemma 2, the period T n of task τ n is a common multiple of periods of all higher-priority tasks τ i (1 ≤ i ≤ n − 1).Moreover, because task τ n is the lowest-priority task in Γ, its period T n equals the hyperperiod of Γ (i.e., T n = H Γ ).Since all tasks in Γ are initially released at the same time, each job J n,k of task τ n will be released concurrently with a job of every higher-priority task τ i (1 ≤ i ≤ n − 1).Therefore, all jobs of task τ n have the same slack times, and thus, the worst-case slack time S W n of τ n equals its best-case slack time S B n .
From Theorem 3, we can find that for a schedulable task set under RM scheduling policy that achieves maximum utilization (i.e., 1), all jobs of the lowest-priority task share the same slack times (i.e., the worst-case slack time is equal to the best-case slack time).On the basis of this observation, we introduce the harmonic index based on the slack variation as follows.
Definition 11.Consider a schedulable task set Γ = {τ 1 , ..., τ n } on a uniprocessor under the rate monotonic (RM) policy.Here, tasks in Γ are sorted in decreasing priority.The slack variationbased harmonic index of the task set Γ, indicated as H slack (Γ), is expressed as where S B n and S W n are the best-case and worst-case slack times of τ n , respectively.
A low value of H slack implies a high harmonicity degree, and the task set Γ is "harmonic" if H slack (Γ) = 0.When H slack (Γ) > 0, the index H slack (Γ) can be viewed as a measure of processor resource waste when the lowest-priority task achieves the largest schedulable WCET, since the worst-case situation (i.e., the case where a job of the task experiences its WCET) should be considered for the schedulability analysis.Therefore, a higher utilization can be attained by assigning tasks with a lower slack variation-based harmonic index to the same processor to balance the slack time.
Example 2. Let us consider task set Γ as depicted in Table 2 again.From Figure 1, we can find that the Γ is schedulable on a uniprocessor, and S W 3 = S B 3 = 1 for the lowest-priority task τ 3 .Thus, we can obtain H slack (Γ) = 0. Therefore, Γ is strictly harmonic according to the slack variation-based harmonic index.Consider the sub-task set Γ sub = {τ 1 , τ 2 } ⊂ Γ.For the lowest-priority task τ 2 in Γ sub , S W 2 = 1 and S B 2 = 2, and thus, H slack (Γ sub ) = (2 − 1)/3 = 1/3 > 0. Therefore, the task set Γ sub is not harmonic according to the harmonic index based on slack variation.Note that for the task set Γ sub , task τ 2 achieves the largest schedulable WCET even though there is still some slack for some jobs (e.g., jobs J 2,2 and J 2,4 ), since the worst-case scenarios (i.e., jobs J 2,1 and J 2,3 ) should be considered for the schedulability analysis.
Proof.Suppose that tasks in Γ are sorted in decreasing priority under the RM policy, and thus, T 1 ≤ T 2 ≤ ... ≤ T n .Since H uc (Γ) = 0, T j is an exact multiple of T i for any two tasks τ i and τ j in the task set Γ if T i ≤ T j .Hence, T n is divisible by T i for any task τ i ∈ Γ, and thus, T n is a common multiple of periods of all higher-priority tasks τ i for 1 ≤ i ≤ n − 1.Therefore, similar to the proof for Theorem 3, we can obtain that the worst-case slack time S W n of task τ n equals its best-case slack time S B n .Thus, we can obtain H slack (Γ) = 0.
Note that a strictly harmonic task set (e.g., task set Γ depicted in Table 2) according to harmonic index H slack may not be strictly harmonic according to the harmonic index H uc (see examples 1 and 2).Thus, from Corollary 1, we can find that a strictly harmonic task set according to the harmonic index H uc is just a special case of a strictly harmonic task set according to the harmonic index H slack .Therefore, the harmonic index H slack is more general than the harmonic index H uc , and it can more effectively quantify the harmonicity.

Slack Time Analysis
In order to calculate the slack variation-based harmonic index H slack for a task set Γ, we should analyze the worst-case and best-case slack times for the lowest-priority task in Γ.Now, we first identify the job of a task that experiences the worst-case slack time with Theorem 4. Theorem 4. A job of a task experiences the worst-case slack time when it is released simultaneously with the jobs of all higher-priority tasks.
Proof.Consider a task set {τ 1 , ..., τ n } ordered in decreasing priority under the RM policy.Let J n,k be a job of task τ n that is released at t 1 (i.e., r n,k = t 1 ).As illustrated in Figure 2, we consider that the jobs of a higher-priority task τ i (1 2, we can find that shifting the instance release time t 2 of task τ i forward does not increase the slack time for job J n,k until t 2 = t 1 .Therefore, the slack time for job J n,k will be minimized when t 2 coincides with t 1 .The theorem can be proved by repeating this argument for all higher-priority tasks τ i (1 ≤ i ≤ n − 1).Similarly, we can identify the job of a task that experiences the best-case slack time with the following theorem.
Theorem 5. A job of a task experiences the best-case slack time whenever its succeeding job is released concurrently with the jobs of all tasks with higher priorities.
Proof.Let {τ 1 , ..., τ n } be a task set ordered in decreasing priority under the RM policy.Consider a job J n,k of τ n that is released at t 1 − T n and its succeeding job J n,k+1 is released at t 1 (i.e., r n,k = t 1 − T n and r n,k+1 = t 1 ).As illustrated in Figure 3, we consider that the earliest job of a higher-priority task τ i (1 ≤ i ≤ n − 1) released not before t 1 is released at t 2 (i.e., t 1 ≤ t 2 ).From Figure 3, we can find that shifting the instance release time t 2 of task τ i forward does not reduce the slack time for job J n,k until t 2 = t 1 .Therefore, the slack time for job J n,k will be maximized when t 2 coincides with t 1 .The theorem can be proved by repeating this argument successively for all higher-priority tasks τ i (1 ≤ i ≤ n − 1).
Before giving the calculation method for the worst-case slack time and the best-case slack time, we first introduce some definitions about the level-i active period given in [21].For a task τ i , its pending load PL i (t) refers to the processing workload that must be finished by time t for the jobs with priorities equal to or higher than that of task τ i that are activated before t.A level-i active period is defined as the time interval [t s , t e ) which meets the conditions PL i (t s ) = 0, PL i (t e ) = 0, and PL i (t) > 0 for every time t ∈ (t s , t e ).
According to [21], for fixed-priority real-time systems, the worst-case duration W L i of a level-i active period is the minimum positive real number x ∈ R + that satisfies the condition Note that we can obtain W L i through an iterative process for Equation ( 15), beginning with a lower bound.
Theorem 6.Consider a schedulable task set Γ = {τ 1 , ..., τ n } on a uniprocessor under the rate monotonic (RM) policy.Here, tasks in Γ are ordered in decreasing priority.Let J W n be a job of task τ n released concurrently with the jobs of all tasks with higher priorities, and let r W n denote its release time.Let r W n + t end be the end time of the available slack for job J W n during the interval [r W n , r W n + T n ).Then, the amount of available slack time for J W n can be formulated as Proof.Suppose that J W n is released concurrently with the jobs of all tasks with higher priorities at time t 1 .According to Theorem 4, job J W n will experience the worst-case slack time.Figure 4 shows the workload of higher-priority tasks n + t end is the end time of the available slack for job J W n during the interval [r W n , r W n + T n ), from Figure 4, we can observe that all the higher-priority jobs released no later than r W n + t end are completed before r W n + t W end , and there is no available slack for J W n during the interval [r W n + t end , r W n + T n ).Furthermore, because job J W n is released concurrently with the jobs of all tasks with higher priorities, for each highest-priority task τ i (i < n), the count of jobs that need to be executed during the interval [r W n , r W n + t W end ) is ⌈t end /T i ⌉.Thus, the workload of tasks with higher priorities during the interval Therefore, the amount of available slack for job J W n can be obtained with Equation (16).
According to Theorem 6, we can obtain the worst-case slack time of τ n through searching time t end for job J W n .Since all tasks are released at the same time t = 0 in the beginning, we can consider r W n = 0 for job J W n .Given the worst-case length W L n−1 of a level-n − 1 active period, there must be some slack for job J W n during the interval [T n − W L n−1 , T n ).Therefore, t end for job J W n can be expressed as follows: Since t end is the end time of the last available slack for job J W n with r W n = 0 during the interval [0, T n ), a higher-priority task must be invoked at time t end .Therefore, the search space for t end can be reduced to the invoking points of higher-priority tasks during the interval n denote the search space for t end ; it can be expressed as follows: By Equations ( 17) and ( 18), the worst-case slack time S W n of τ n can be obtained by Based on Equation ( 18), the exact worst-case slack time of the lowest-priority task in a task set can be obtained in pseud-polynomial complexity with Equation ( 19), i.e., Lemma 3. Lemma 3. Consider a schedulable task set Γ = {τ 1 , ..., τ n } on a uniprocessor under the rate monotonic (RM) policy.Here, tasks in Γ are ordered in decreasing priority.We can obtain the exact worst-case slack time of task τ n with the computational complexity O(n * T n /T 1 ).
Theorem 7. Consider a schedulable task set Γ = {τ 1 , τ 2 , ..., τ n } on a uniprocessor under the rate monotonic (RM) policy.Here, tasks in Γ are ordered in decreasing priority.Let J B n be a job of task τ n whose succeeding job is released concurrently with the jobs of all tasks with higher priorities, and the release time of job J B n is denoted as r B n .Let r B n − t end be the end time of the last available slack for job J B n not later than r B n .Then, the amount of available slack time for J B n can be expressed as follows: Proof.Suppose that J B n is released at time t 1 and its succeeding job is released simultaneously with the jobs of all tasks with higher priorities at time t 1 + T n .According to Theorem 5, job J B n will experience the best-case slack time for the task τ n .Figure 5 gives the workload of higher-priority tasks n − t end is the end time of the last available slack for job J B n not later than r B n , from Figure 5, we can observe that the jobs of all tasks with higher priorities released not later than r B n − t end are finished before time r B n − t end and there is no available slack for J B n during the interval [r B n − t end , r B n ).Moreover, because the succeeding job of J B n is released concurrently with the jobs of all tasks with higher priorities, for each higher-priority task τ i (i < n), the number of jobs that need to be executed during the interval Hence, the workload of the higher-priority tasks during Therefore, the amount of available slack for J B n can be expressed with Equation (20).
Similar to the worst-case slack time analysis of τ n , t end for job J B n can be expressed as where V B n is the search space for t end of job J B n , and it can be expressed as From Equation ( 21), we can obtain the best-case slack time S B n for task τ n as Based on Equation ( 22), the exact best-case slack time for the lowest-priority task in a task set can be obtained in pseudo-polynomial complexity with Equation ( 23), i.e., Lemma 4. Lemma 4. Consider a schedulable task set Γ = {τ 1 , ..., τ n } on a uniprocessor under the rate monotonic (RM) policy.Here, tasks in Γ are ordered in decreasing priority.We can obtain the exact best-case slack time of τ n with the computational complexity O(n * T n /T 1 ).
By the definition of the slack variation-based harmonic index (i.e., Equation ( 14)), we can derive Theorem 8 by using Lemmas 3 and 4.
Theorem 8. Consider a schedulable task set Γ = {τ 1 , ..., τ n } on a uniprocessor under rate monotonic (RM) policy.Here, tasks in Γ are ordered in decreasing priority.The slack variation-based harmonic index of Γ can be derived with the computational complexity O(n * T n /T 1 ).

Enhanced Harmonic Task Partitioning
With the slack variation-based harmonic index, we propose two efficient partitioned scheduling algorithms to improve the system utilization via strategically allocating the workload among processors by leveraging the task harmonic relationship.In the following, we first introduce an algorithm (named EHAP-SV) to optimize the system usage by identifying tasks with high harmonicity and grouping them into a single processor.However, the EHAP-SV algorithm suffers from the "fragmentation" problem as it does not consider some workload characteristics in the task allocation.To address this issue, we present the WAHP-SV algorithm, a workload-aware harmonic partitioning method.WAHP-SV incorporates both harmonicity and workload characteristics into the scheduling approach to address the "fragmentation" issue in the EHAP-SV algorithm.

Harmonic Partitioning Based on Slack Analysis
Before presenting our harmonic-aware partitioning method, let us discuss the limitations of the current harmonicity-aware partitioning approach using an example.In [14], a harmonicity-aware task partitioning algorithm (named HAPS) is proposed.HAPS measures the harmonicity degree of a task set by using the utilization change-based harmonic index and allocates harmonic tasks to an identical processor.It has been demonstrated that HAPS outperforms traditional bin-packing approaches.However, HAPS cannot optimize the schedulability of certain task sets, since the harmonic index used by HAPS is too tight to effectively quantify the harmonicity of some task sets (see Example 1).In the following, we will illustrate the effect of the inaccurate harmonicity quantification on the harmonicity-aware task partitioning with an example.Example 3. Let us consider a task set Γ = {τ 1 , τ 2 , τ 3 , τ 4 , τ 5 }, given in Table 3, to be executed on processors Π = {π 1 , π 2 } under RM policy.When the HAPS strategy is employed to partition this task set, HAPS considers that tasks τ 1 , τ 2 , and τ 3 are not harmonic, and it partitions all tasks into three groups, {τ 1 , τ 4 }, {τ 3 , τ 5 }, {τ 2 }, one by one.This implies that HAPS requires three processors to schedule Γ.Hence, HAPS fails to partition Γ for processors π 1 and π 2 , even though a high overall capacity is still available on processors π 1 and π 2 .This is primarily because the harmonic index used by HAPS is too tight to effectively quantify the harmonicity of task set {τ 1 , τ 2 , τ 3 } from the perspective of the system utilization.In the following, we propose a feasible partitioning method for Γ.This strategy considers the harmonicity characteristic through slack analysis during task deployment, thereby enhancing system utilization (refer to example 4).To enhance the processor utilization through efficient harmonic-aware partitioning based on effective harmonicity quantification, we propose an enhanced harmonic-aware partitioning algorithm using the slack variation-based harmonic index (named EHAP-SV).In EHAP-SV, some candidate subsets are generated first by identifying the harmonic tasks with the slack variation-based harmonic index.Then, the highest utilization subset is picked for assignment to a processor to enhance system utilization.
The EHAP-SV algorithm is given in Algorithm 1.It begins by initializing the required processor number k to zero, and then, proceeds to allocate tasks group by group by using the slack variation-based harmonic index (lines 3-42).Every task τ i ∈ Γ is considered to be the host task in a sub-task set Γ sub i (line 5), and remaining tasks are picked to be added to Γ sub i until all feasible tasks have been exhausted (lines 6-30).To ensure the schedulability of the assigned task sets, a schedulability analysis can be performed using the efficient exact schedulability test approach proposed in [22].During the generation of the sub-task set Γ sub i , the feasible task with the minimum harmonic index is selected first (lines 14-17).For multiple feasible tasks with a minimum harmonic index, the task with higher utilization is selected first (lines [18][19][20].After all subsets are generated, the subsets with the highest utilization are selected and assigned to a core (lines 32-40).Then, these tasks are deleted from Γ (line 41).This process is iterated for the remaining tasks in task set Γ until all tasks have been allocated to processors.Theorem 9.For a task set Γ = {τ 1 , ..., τ n }, if EHAP-SV partitions it onto m processors Π = {π 1 , ..., π m } with success and schedules it under the RM scheduling policy, all tasks in Γ can satisfy their deadlines.
Proof.Let us take processor π j ∈ Π and its assigned task set Γ(π j ) into consideration.As indicated in line 12 in Algorithm 1, it is schedulable for Γ(π j ) to be executed on processor π j according to RM scheduling policy.This implies that the task set assigned to each processor is schedulable.
From Theorem 9, we can conclude that the task allocation produced by EHAP-SV consistently guarantees that all tasks in Γ meet their deadlines.
for each task τ i ∈ Γ do 5: while Γ untest ̸ = ∅ do 8: U selected ← 0 10: for each task τ j ∈ Γ untest do 12: if It is feasible for H min ← H j 16: τ selected ← τ j 17: else if H min = H j and U selected < U j then 19: τ selected ← τ j 20: end if end while 31: end for 32: end for 40: From Algorithm 1, it is evident that the computational complexity of the EHAP-SV algorithm is primarily influenced by the feasibility test's complexity, the complexity of computing the harmonic index based on slack variation, and the task set size.The feasibility tests can be achieved in pseudo-polynomial time with the WCRT analysis using the iterative technique [22].In addition, from Theorem 8, we can obtain that the calculation of the slack variation-based harmonic index also exhibits pseudo-polynomial time complexity.Therefore, we can conclude that the EHAP-SV algorithm's time complexity is pseudopolynomial.
Example 4. Let us consider the task set Γ given in Table 3 once again.As illustrated in Figure 6, it is the task partitioning process for Γ using EHAP-SV.We can see that EHAP-SV partitions all tasks in two groups, {τ 1 , τ 2 , τ 3 } and {τ 4 , τ 5 }, one by one.Consequently, EHAP-SV can allocate the task set Γ to two processors by effectively exploring the harmonic relationship based on its effective harmonicity quantification.

Workload-Aware Harmonic Partitioning
The EHAP-SV method can optimize system usage by leveraging the harmonic relationship to assign harmonic tasks to the same processor.However, it may face performance degradation when dealing with heavy-utilization tasks, as it does not consider certain workload characteristics during the task allocation.To address this issue, we design a metric that combines harmonic relationship exploration with workload awareness to guide task allocation, and design a workload-aware harmonic task partitioning method (named WAHP-SV).
Algorithm 2 gives the WAHP-SV algorithm.Unlike EHAP-SV, we introduce a new metric, denoted as ν j , for each task τ j .This metric is employed for determining tasks that exhibit both high harmonicity and high workload for generating candidate subsets in WAHP-SV.For a sub-task set Γ sub i and a task τ j , the metric ν j is defined by where U j is the utilization of task τ j and it is used for workload awareness.H slack (Γ sub i ∪ {τ j }) is a measure of the harmonicity for task set Γ sub i ∪ {τ j } and it is used for harmonic awareness.In the task assignment, the tasks with higher ν j are prioritized (lines 13-15).Theorem 10.For a task set Γ, if WAHP-SV successfully partitions it onto m processors Π = {π 1 , ..., π m } and schedules it under the RM scheduling policy, all tasks in Γ can satisfy their deadlines.
Proof.Let us take processor π j ∈ Π and its assigned task set Γ(π j ) into consideration.As indicated in line 11 in Algorithm 2, it is feasible for Γ(π j ) to be executed on processor π j under the RM policy.This indicates that it is schedulable for the task set on each processor.
From Theorem 10, we can conclude that the task allocation produced by WAHP-SV consistently guarantees that all tasks in Γ meet their deadlines.
From Algorithm 2, it is evident that the time complexity of the WAHP-SV algorithm is identical to that of the EHAP-SV algorithm.Thus, the time complexity of the WAHP-SV algorithm is also pseudo-polynomial.
It is worth noting that WAHP-SV can also partition the task set Γ given in Table 3 for two processors.Furthermore, the experimental evaluation demonstrates that WAHP-SV outperforms EHAP-SV in terms of schedulability, attributed to its ability to be aware of workload and explore harmonic relationships.

Experimental Evaluation
To assess the effectiveness of our enhanced harmonic task partitioning methods, we implemented eight algorithms in the experiment, which are listed below: • BFDU: an extension of the best-fit (BF) strategy, where tasks are ordered in decreasing utilization; • WFDU: an extension of the worst-fit (WF) strategy, where tasks are ordered in decreasing utilization; • FFDU: an extension of the first-fit (FF) strategy, where tasks are ordered in decreasing utilization; • PSER: a harmonic partition scheduling algorithm based on the period scaling from [14]; • HAPS: a harmonic partition scheduling algorithm with the harmonic index based on utilization change from [14]; • ENSE: an ensemble method of BFDU, WFDU, FFDU, PSER, and HAPS; • EHAP-SV: our enhanced harmonic partition scheduling algorithm with harmonic index based on slack variation; • WAHP-SV: our workload-aware harmonic partition scheduling algorithm with harmonic index based on slack variation.
Objectives.Our evaluation has two primary goals: to compare the performance of our enhanced harmonic task partitioning algorithms with existing algorithms regarding schedulability; and to evaluate the required number of processors for different partition approaches.

Workload
To evaluate the performance of various methods in relation to system utilization, we synthesized two types of task sets (i.e., light task sets and general task sets) by the UUniFast approach from [23].For the light task sets, task utilization is uniformly distributed within [0, 0.5], and for general task sets, task utilization is evenly distributed within [0, 1].The task period is evenly distributed within [100, 1000].For a task set Γ, we define its normalized utilization U nor (Γ) as where m is the processor number and U Γ is the utilization of Γ.We consider three values for m: 4, 8, and 16.
With the above parameters, we created task sets with normalized utilization U nor ranging from 0.7 to 0.975 with an increment of 0.025.We synthesized 1000 task sets for each U nor .7 and 8 illustrate the schedulable task set fraction plotted against the normalized system utilization in systems with 4 processors, 8 processors, and 16 processors for light task sets and general task sets, respectively.

Schedulability. Figures
We make several observations regarding the performance of the existing algorithms.First, HAPS consistently outperforms BFDU, WFDU, FFDU, and PSER in most cases.This is because HAPS can take advantage of harmonics to enhance the schedulability of the system by taking into account both the period and utilization of each task in the quantification of harmonicity, while BFDU, WFDU, and FFDU overlook the effect of harmonic relationship exploration on the system schedulability and PSER only considers the relationship among periods of tasks in the harmonicity quantification.Second, BFDU, WFDU, and FFDU outperform PSER in the systems with four and eight processors for all types of task sets.This is because BFDU, WFDU, and FFDU can enhance the system schedulability by leveraging the task workload characteristic, especially for the general task sets with some heavy tasks.Third, the schedulability enhancement of BFDU, WFDU, and FFDU over PSER is reduced as the processor number rises, and they perform worse than PSER for 16-processor systems.This can be attributed to the fact that with more processors there are more tasks in a task set, providing more chances for PSER to enhance system schedulability by exploiting the task period relationships.
Our primary result is that EHAP-SV and WAHP-SV consistently outperform all existing partitioned scheduling methods owing to the effective harmonicity quantification of the slack variation-based harmonic index.Note that EHAP-SV and WAHP-SV also always outperform the ensemble method (i.e., ENSE) of BFDU, WFDU, FFDU, PSER, and HAPS.This demonstrates that EHAP-SV and WAHP-SV can find additional schedulable task sets that have not been found so far with existing methods.The performance enhancement grows with increasing processor number, depicting the scalability of EHAP-SV and WAHP-SV.For 16-processor systems, when the system utilization is 0.975, WAHP-SV schedules about 21.9% and 33.2% of task sets for light task sets and general task sets, respectively, while all existing methods schedule almost none of them.Even without workload awareness, for general task sets, when the system utilization is 0.95, the performance improvement of EHAP-SV over the ensemble method ENSE due to the effective harmonic quantification is as much as 48.3% in a four-processor system and 152.9% in an eight-processor system.In addition, we can also see that WAHP-SV always outperforms EHAP-SV in all test cases, and the schedulability improvement of WAHP-SV over EHAP-SV becomes more significant as the task set utilization increases, especially for general task sets.As system utilization increases, tasks with higher utilization are prone to be part of a general task set, and WAHP-SV can significantly improve the partitioning of such task sets through workload awareness.In particular, when system utilization is 0.95 in four-processor systems, the schedulable ratio achieved by WAHP-SV is nearly double that of EHAP-SV.Number of processors.Figure 9 and Figure 10 illustrate the relationship between the required processor number and normalized system utilization for systems with 4, 8, and 16 processors for light task sets and general task sets, respectively.
From the experimental results, we can observe that both EHAP-SV and WAHP-SV outperform all existing methods including the ensemble method ENSE in most test cases.This can be attributed to the fact that EHAP-SV and WAHP-SV enhance the performance through efficient exploration of harmonic relationships based on effective quantification of harmonicity.The results also demonstrate that WAHP-SV outperforms EHAP-SV in some test cases, owing to its effective integration of harmonic relationship exploration and workload awareness.Additionally, we can observe that WAHP-SV can save up to one processor compared to the non-harmonic partitioned scheduling approaches (i.e., BFDU, WFDU, and FFDU) in 8-processor system and 16-processor systems for both light and general task sets.

Conclusions and Future Work
As one of the primary approaches in multiprocessor scheduling, partitioned scheduling has been widely accepted in both academic and industrial fields of IoT to efficiently process substantial streams of sensor-generated data while maintaining real-time performance.In this study, we propose an enhanced harmonic partitioned scheduling method that is based on efficient harmonic relationship exploration.In our approach, we designed a harmonic index to guide the task partition by quantifying the task set harmonicity in terms of the maximum variation in the slack time of the lowest-priority task in the task set.With our proposed harmonic index, we presented a harmonic task partitioning scheme (named HWAP-SV) for periodic real-time tasks scheduled on multiprocessors following RM policy.Furthermore, to alleviate the problem of "fragmentation" in the pure harmonic task partitioning method, we also proposed a workload-aware harmonic task partitioning scheme called WAHP-SV by designing a metric that combines harmonic relationship exploration with workload awareness to strategically allocate workloads among processors.Our evaluation shows that both EHAP-SV and WHAP-SV consistently surpass the state-of-theart partitioned scheduling methods.We believe that similar results can be obtained for the mixed-criticality task model and directed acyclic graph (DAG) task model owing to the generality of the slack variation-based harmonic index, and we would like to verify this in the future.

Figure 2 .
Figure 2. Scenario illustration for the proof of Theorem 4.

Figure 3 .
Figure 3. Scenario illustration for the proof of Theorem 5.

Figure 4 .
Figure 4. Workload of higher-priority tasks τ i(i < n) during [r W n , r W n + T n ).

Figure 5 .
Figure 5. Workload of higher-priority tasks τ i(i < n) during [r B n − t end , r B n + T n ).

Table 1 .
Major notation used in the paper.

Table 2 .
An example task set for harmonic index H uc .

Table 3 .
Task parameters of an example task set.