## 3 Latency-Classification-Based Deadline-Aware Task Offloading Algorithm (LCDA)
### Task Analysis  
Unlike previous studies, we consider delay tolerance along with the deadline of a task when performing task offloading. We implement a task analysis function to categorize tasks as latency-sensitive or latency-tolerant tasks on a user device. Before offloading occurs, the task is classified as a latency-sensitive or latency-tolerant task according to the delay tolerance of applications derived by the task analysis function. The task classification is performed based on the user device's load profile or a task's characteristics. If a task is demanding rapid and accurate results or judged to be an urgent task, the task is classified as latency-sensitive. Otherwise, the task is classified as a latency-tolerant. Many research papers classify task types using techniques to identify and classify task characteristics [5; 6; 7; 8]. We define the types of tasks running on a user device, as in Equation (1).  
\[\begin{array}{c}\textit{taskType}\big{(}t_{i},w_{j}\big{)}=\\ \left\{\begin{array}{ll}\textit{latency}-\textit{sensitive},&\textit{ Deadline}<\textit{Threshold}^{\textit{Urgency}}\textit{ and }\textit{EET}\geq\textit{Deadline}\\ \textit{latency}-\textit{tolerant},&\textit{Deadline}\geq\textit{Threshold}^{ \textit{Urgency}}\textit{ and }\textit{EET}<\textit{Deadline}\end{array}\right.\end{array} \tag{1}\]  
where _taskType_(_t_,_w_) denotes the type of task (_i_) at the workflow (_j_), and the deadline is the value initially set for the task. In practice, when a user rents a virtual machine to use an edge cloud server in the MEC environment, it creates a request and then submits the request to the platform. The request includes the user's maximum allowable latency (i.e., deadline), the size of the input task, and the number of resources required by the virtual machine [2]. We use the deadline value of these. The threshold of  
Figure 3: System architecture of the LCDA.  
urgency is arbitrary values set by the user, and EET denotes the estimated average execution time of a task. This task analysis function examines a task's characteristics and places the task in the corresponding queue. In other words, if a task has urgency properties, then the task analysis function places the task in the latency-sensitive queue. Otherwise, the task is placed in the latency-tolerant queue. In addition, the type of task can be set directly by the user before the user sends a task to an edge cloud server.  
After classifying a task, we calculate the weight of each task to determine the priority for offloading in the subsequent task selection function. In general, the deadline for a task is primarily taken into account when using the workflow for task management in the cloud [9], and the criteria for calculating the weight of a task in the task analysis function are based on recursive techniques [10]. We calculate the weight for the task selection for later offloading, as defined in Equation (2).  
\[taskTimeWeight_{t_{i}}^{w_{j}}=\frac{D_{j}-SD(t_{i})}{D_{j}} \tag{2}\]  
where _taskTimeWeight_ denotes the weight of task (\(i\)) at the workflow (\(j\)), \(D\) denotes the deadline, the user-defined time constraint for each workflow, and \(SD\) is short for a sub-deadline, denoting the estimated average execution time of each task in the workflow. \(SD\) is calculated form the execution time of each task recursively from the last exit task of the workflow to the first entry task. Finally, Equation (2) determines the weight of an offloaded task: the smaller is the weight value, the higher priority is assigned to the task. This calculation is performed in the task analysis function in the user device but is executed only when the number of the original tasks in the user device changes by more than 20% in order to reduce the burden of the task analysis operation [11]. The classification information and weight value of tasks are stored for future use.