## 3 Our Proposed Algorithm  
The energy consumption of these data centers, currently amounting to 2% of global power usage, or 416.2 terawatt hours, is estimated to increase dramatically. By the year 2022, projections suggest it will make up 7% of the world's energy consumption, indicating a significant surge in demand [31]. Therefore, we propose a new algorithm that considers the cost and energy, in addition to the Makespan, of task execution by enhancing the PCA algorithm; our algorithm first applies the PCA algorithm, as shown in the pseudocode [8] in Algorithm 2. When the algorithm arrives at step four, the GWO algorithm is called, as shown in Algorithm 3, which represents the pseudocode of PC-GWO algorithm. ```
\({}^{*}\)1-FOR all available tasks DO  Calculate the priority of each task. END FOR 2-Sort the tasks according to the priorities in the scheduler's queues. 3-FOR all tasks Ti in meta-task DO  FOR all resources Rj DO  Calculate the completion time: (CT), j = (EC)\({}_{3}\)+ r\({}_{1}\)  END FOR  END FOR 4-Find task Tk which has the highest Priority and assign this task Tk to the resource which has the minimum completion time. 5-Remove task Tk from Meta-tasks set and update rj for the selected Rj and Update CTlj for all j. 6-IF the waiting time of any task in the lower queues has exceeded the threshold THEN  Move this/these tasks to the next upper queue. END IF. 7-IF there is a new task has arrived THEN Calculate its priority and sort it in the end of appropriate queue and repeat the above steps END IF\({}^{*}\)
```  
**Algorithm 3**********Pseudocode of PC-GWO Algorithm  
``` Step 1-FOR all tasks in meta task DO  Calculate the priority of each task. END FOR  Step 2-insert the tasks according to the priorities in the scheduler's queues. Step 3-FOR all tasks Ti in meta-task DO  FOR all resources Rj DO  Calculate the completion time: (CT)ij = (EC)ji+rj  END FOR  END FOR  Step 4-Call the GWO with the fitness function using equation (17) Step 5-Strip task Tk from Meta-tasks set and update rj for the selected Rj and update CTlj for all j. Step 6-IF the waiting time for any task in the lower queues has gone over the threshold, THEN Shift this/these tasks to the next upper queue. END IF. Step 7-IF there is a new task has arrived THEN Calculate its priority and place it at the end of the right queue and repeat the steps above. END IFWhere:

**Step 1:**: Calculate the priority of each task in the meta-task using Equation (5). **Step 2:**: Sort the tasks in the queue according to their priority using Equation (6). **Step 3:**: Calculate the completion time for all tasks in the meta-task for each available resource. **Step 4:**: Call the GWO algorithm to choose the best solutions to process the task using the fitness function by using Equation (17). **Step 5:**: Remove the task that was processed from the meta-task, update the ready time of resource j, and update the completion time of all resources. **Step 6:**: In this step, we consider the waiting time of the task in the queue to determine if it will arrive at the deadline or not by migrating the task, which is estimated to arrive at the next level. **Step 7:**: In this step, if a new task is coming, the algorithm repeats all the steps above. ## 4 Performance Evaluation and Result

This section focuses on evaluating the performance of the proposed algorithms in comparison to other algorithms. The evaluation is based on three key metrics: Makespan, cost, and energy consumption. The simulation implementing and evaluating the suggested approach necessitates a set of programming tools to execute various scenarios, along with a comprehensive comparison of the proposed solutions. In this chapter, we first explore the implementation of the proposed solution (PC-GWO). Using the Java programming language, we created a rudimentary version of the algorithm. This simulation was made on a computer equipped with an Apple M1 chip with 8 GB of memory and the operating system macOS Ventura 13.2.