## 5 Evaluated Algorithms
### Carbon- and Power-Efficient Optimal Frequency VM Placement (C-PEF)
In each machine, _P1_ is the current dynamic power of the machine, _P2_ is the dynamic power after the _NUM_ has been placed and _R1_ represents the remaining execution time interval of each task running in the machine at time \(t_{o}\). The hosts are sorted based on \(\Delta P\). The _SelectedHosts_ are \(\{M_{4}\),\(M_{3}\),\(M_{2}\),\(M_{5}\),\(M_{1}\}\). The number of tasks with the minimum remaining execution time (R1) at time \(t_{o}\) in \(M_{1}\) is 4(Task\({}_{2}\)), for \(M_{2}\) is 9(Task\({}_{2}\)), for \(M_{3}\) is 5(Task\({}_{1}\)), for\(M_{4}\) is 3(Task\({}_{1}\)), and for \(M_{5}\) is 2(Task\({}_{1}\)). Here, the execution time of NVM-R1 (\(\Delta R\)) for\(M_{1}\) is 4, for \(M_{2}\) is (\(-\)1), for \(M_{3}\)is3, for \(M_{4}\)is5, and for \(M_{5}\)is6. \(M_{2}\) has a greater minimum remaining execution time than the NVM execution time, so the _selectedhost_ = \(\{M_{4}\}\), while all others are considered as \"_choosyhosts_\". _Pow1_ represents the assumed dynamic power after the completion of the task with the minimum remaining execution time. Based on _C-Exp-Pow_, \(M_{3}\) is chosen as the _Desthost_, irrespective of \(M_{4}\), which has the minimum \(\Delta P\). The time complexity of Algorithm 2 can be analyzed by considering \(n\) VM requests in _ReqQ_. The sort function inline 3 with \(c\) clusters takes O(\(c\) log(\(c\))) times. Considering \(f\) frequency levels, line 8-17 and line 25-27 with \(m\) number of hosts take O (_m_) times. The sort function in lines 21 and 29 takes O (\(m\)log(\(m\))) times. The algorithm complexity is derived as O (\(n\) (\(\text{log}(c)+\textit{cf}\) (\(m+m\) log \(m+m+m\) log \(m\))).The final complexity is O(\(nc\)_fm_log(\(m\)))). ### Carbon-Aware First-Fit Optimal Frequency VM Placement (C-FFF)

The C-FFF algorithmic approach is detailed in Algorithm 3. The aim of the C-FFF algorithm is to distribute the load within the cluster. Each server is set to its minimum utilization level. The utilization level is increased gradually when the VM allocation is not feasible at the current utilization level. This approach differs from C-PEF in terms of host selection. There is no greedy selection performed for the minimum increase in overall power consumption, and the VM is placed in the first-fit host when feasibility is confirmed at the current utilization level. Algorithm 3 receives the _Clusterlist_ of all data centers, the _Hostlist_ of each cluster, and the VM resource request through _ReqQ_. Lines 2 and 3 consolidate the entire cluster list into the _Totclusterlist_. The algorithm considers the carbon footprint rate (CFR) and power usage effectiveness (PUE) for cluster selection and sorts the _Totclusterlist_ in ascending order based on PUE\(\times\)CFR. The C-FFF algorithm differs from C-PEF in terms of host selection. C-FFF does not use the greedy approach on the feasible host with minimum power, as with C-PEF; instead, it places the VM in the first feasible host that is limited to the current p-state. For \(n\) VM requests, \(m\) number of hosts, \(f\) frequency levels, and \(c\) number of clusters, the complexity of the algorithm is derived as O(\(\textit{nf}\)mclog(\(c\))). ### Carbon- and Power-Efficient VM Placement (C-PE)

The cluster selection is the same as with C-FFF, meaning it is based on PUE and CFR. The standard power-efficient algorithm does consider the DVFS and remaining execution time for outgoing tasks for VM allocation [25]. In this work, the C-PE algorithm performs cluster selection similarly to C-PEF and C-FFF, but differs in its host selection policy. The aim of the C-PE algorithm is to find a feasible host for a VM, considering the maximum utilization level. The host selection is based on a minimum increase in overall power consumption (i.e., minimum \(\Delta P\)). The _Selected Hosts_ are sorted based on estimated \(\Delta P\) (line 14 of C-PEF). The destination host is selected as in Algorithm 2, with maximum utilization.