# Sharing with Live Migration Energy Optimization Scheduler for Cloud Computing Data Centers
## 4 SLM Scheduler Algorithm  
The SLM algorithm takes advantage of two main attributes: task characteristics similarity and live migration. Similarity refers to processing tasks simultaneously as a set at the same time based on their types. Since we have four types of tasks used in the SLM scheduler (read, write, download, and upload), the scheduler classifies the tasks based on their type and needed source file. For example, if we have two processes that are both reading the same file, they are going to be scheduled concurrently to improve the utilization of the bandwidth, while 'write' and 'write' or 'upload' and 'upload' cannot be processed concurrently due to overwrite conflicts. Live migration can also contribute to power saving, as VM migrations can minimize the number of running physical machines by moving tasks to underutilized machines (consolidation) [24] and moving processes from overloaded to less loaded servers (load balancing) [25]. In general, the typical parameter considered by a cloud provider to facilitate auto-scaling is the threshold. The threshold parameter defines the aggregate value calculated based on current performance metric values, at which point the auto-scaling of resources is triggered, too. The upper and lower thresholds of auto-scaling are set to 80% and 30%, respectively, derive from pre-agreed Service Level Agreements (SLAs) based on [26]. The overload migration starts if the load is higher than 80%, because the value of the upper utilization threshold is 80%. In the SLM model, migration happens between two replica servers, where the SLM data center model is created using the server replica configuration. The replica configuration means that a duplication of each server is used to function as an up-to-date replica of the master server. The following equations were used in the SLM model to calculate the cost of the VMs' migration [27]. \[T_{m_{j}}=\frac{Memory_{j}}{Bandwidth_{j}} \tag{3}\]\[U_{d_{j}}=0.1*\int_{t_{0}}^{t_{0}+T_{mj}}U_{j}(t)dt \tag{4}\]  
where \(U_{dj}\) is the total performance degradation by VM\({}_{j}\), \(t_{0}\) is the time when the migration starts, \(T_{mj}\) is the time taken to complete the migration, \(U_{j}\left(t\right)\) is the CPU utilization by VM\({}_{j}\), \(Memory_{j}\) is the amount of memory used by VM\({}_{j}\), and \(Bandwidth_{j}\) is the available network bandwidth. In order to apply the SLM algorithm, one read/download counter and one write/upload lock are defined and used, as introduced in Algorithm 1, which are identified as read/download lock and write/upload lock, respectively. The write/upload lock is turned on while performing a write or upload process. Once the process is completed, the lock will be switched back to off. This lock is to prevent any other process from starting as long as it is on. For the read/download counter, one counter is used to count the read and download operations, because a write or upload operation on a resource can start only if no other process is using it, since many read or download tasks can be processed in parallel, but do not necessarily start and end at the same time. The counter will be incremented each time a read or download process starts, and decremented each time a read or upload process has finished. The write or upload process cannot start unless this counter is zero, which is why we use this counter.