Selfish Routing Game-Based Multi-Resource Allocation and Fair Scheduling of Indivisible Jobs in Edge Environments

Distributed and heterogeneous edge computing environments require efficient allocation and scheduling of multiple users’ applications. This paper presents a game-theoretic solution to model the competition between time-sensitive internet of things (IoT) applications with indivisible loads to be allocated and scheduled to edge servers. We model the allocation problem as a selfish routing game such that no job is unsatisfied with its allocation. Also, the allocated jobs are scheduled using a weighted time-sharing approach, which assigns resources to jobs proportional to their demands and deadlines. We proved the existence of pure Nash equilibrium in the introduced game and presented a greedy and polynomial time algorithm to obtain the solution called SAFSA. Using an extended version of the CloudSim simulator, we assess our approach in different situations by employing a real-world dataset of the Google cluster. Since the proposed algorithm considers jobs’ deadlines beside resource requests in allocation and scheduling decisions, it can simultaneously minimize average response time and maximize the number of jobs completed within their deadlines.The simulation results confirm the ability of SAFSA to efficiently execute the jobs within their deadlines, especially when there are many IoT devices and edge servers in the system, which is the main characteristic of IoT environments.


I. INTRODUCTION
The heterogeneous environment of edge computing has the potential to execute the distributed and real-time applications of IoT efficiently by offloading them to remote edge servers [1], [2], [3]. There is heterogeneity in the environment and applications, such as different processing and networking resources and different resource requirements for the applications.
Even though edge computing can handle the diverse demands of IoT applications, receiving multiple applications with varying demands that insist on a particular level of performance may prevent efficient achievement for all of them. In this case, meeting the requirements of one application may stop others from benefiting [4]. It becomes more challenging when QoS requirements, such as the deadline, are involved.
The associate editor coordinating the review of this manuscript and approving it for publication was Mehdi Sookhak .
Consequently, allocating resources to applications in proportion to their demands is crucial to ensure that all of them are satisfied with their performances and QoS requirements.
Depending on whether an application's load can be arbitrarily divisible, applications are classified into two categories: divisible and indivisible loads. Typically, fair resource allocation research focuses on jobs with divisible loads, although fractional loads may not be acceptable in real-world applications [5], [6], [7], [8]. Therefore, this paper focuses on the fair allocation and scheduling of time-sensitive jobs with indivisible loads. The limited resources of edge servers make it impossible to execute all jobs within their deadlines. So, our mechanism attempts to reduce the average response time and the number of jobs that are not completed by the deadline.
In this paper, we address the following two main problems: • Selecting the appropriate edge server for each job (where): The allocation decisions of the jobs affect the performance of each other. Therefore, we developed a selfish allocation game. As part of this game model, each job seeks to select an edge server that minimizes its response time. To reduce the number of jobs violating their deadlines, we considered jobs' deadlines along with resource requirements when estimating response times.
• Scheduling the jobs allocated to each edge server (when): Our scheduling approach addresses two issues. The first issue is fair resource allocation proportional to jobs' demands and deadlines, and the second is the lack of starvation for low-priority jobs. We addressed the first issue by assigning weights corresponding to the resource demands and the deadline of the job to specify its share of each resource. On the other hand, in most scheduling approaches, like the non-preemptive ones, low-priority jobs wait until the execution of those with higher priority in the scheduling queue is completed. It can cause severe starvation for jobs with lower priority and cause their deadlines to be missed, especially in environments with many jobs, such as IoT. Time-sharing scheduling allocates resources to jobs, in turn preventing starvation. Thus, we used weighted time-sharing scheduling [9] to execute the jobs proportionally to their resource demands and deadlines, keeping starvation of low-priority jobs. We are considering fairness in assigning resources to jobs in proportion to their demands, such that all of them are satisfied with their response times. Due to the egoistic behavior of jobs in achieving better performance [10], [11], [12], we designed a selfish job allocation game. In our game model, edge servers execute jobs according to a weighted time-sharing scheduling algorithm, which allocates resources fairly between jobs. We proved the existence of pure Nash equilibrium in the introduced game and then designed an algorithm to reach it. Following is a summary of the significant contributions of this paper. • We consider the selfish allocation of indivisible jobs to multi-resource edge servers to minimize response times and fairly allocate resources proportional to jobs' resource demands and deadlines. We model this problem as a selfish game between users' jobs in which players attempt to minimize their response times. We believe this is the first work to deal with the joint fair allocation and scheduling of indivisible and time-sensitive jobs using a game-theoretic approach when edge servers have multiple resources.
• We prove the existence of pure Nash equilibrium in the defined selfish allocation and fair scheduling game. Then present a greedy and polynomial time algorithm to obtain the solution called SAFSA.
• We analyze the performance of our proposed approach using the real-world dataset of Google cluster traces and a simulation toolkit based on CloudSim [13], [14]. The evaluation results indicate that our joint allocation and scheduling game significantly minimizes the average response time and deadline miss rate of jobs.
This paper follows the following structure. Section II demonstrates a real-world scenario as a motivation for this study. Section III presents related works on fair allocation and scheduling. The system model is explained in section IV. We describe our weighted time-sharing scheduling and selfish allocation game in sections V and VI, respectively. Then we present our algorithm in Section VII. Section VIII contains the evaluation settings and the experimental analysis. The paper is concluded in section IX.

II. MOTIVATION
In vehicular edge computing (VEC), many IoT devices in different places, such as roads, vehicles, drivers, and passengers, continuously generate data. These data bring enormous delay-sensitive and computation-sensitive applications, including intelligent navigation, autonomous driving, intelligent entertainment, accident warnings, augmented realitysupported gaming, AI-based pedestrian detection, and fuel scheduling [15], [16]. The data generated by these applications must be processed and stored on time, which is not in the ability of resource-limited IoT devices. VEC uses roadside units (RSUs) equipped with edge servers to offload and execute jobs sent from IoT devices, helping them to be executed on time. The applications have a specific data size which must be sent to RSUs through communication links. Also, they need a specific amount of computation resources [15], [17]. All of these applications are time-sensitive, and a predefined deadline can be considered for the maximum response time of the jobs. However, their sensitivity to being completed within their deadline is varied. Some applications' response time must not exceed their deadlines, and their deadline violation has catastrophic consequences. These applications have a hard deadline, like driver assistance in VEC to prevent accidents. On the other hand, some applications' deadlines are considered soft and less safety-critical, and their missing is sometimes acceptable. Applications such as intelligent entertainment or indoor positioning systems in vehicles are examples of applications with a soft deadline. In these applications, it is attempted to complete as many jobs as possible within their deadlines [18], [19], [20]. This paper focuses on applications with soft-deadline. Due to the delay sensitivity of applications and limited processing resources in edge servers, offloading the IoT devices' soft-deadline jobs to arbitrary RSUs, such as the closest unit, is not an efficient solution, especially when data load is very high because of critical situations like traffic or accidents. In this case, some RSUs may be overloaded and cannot schedule and execute their offloaded jobs on time, so the deadline of most of the soft-deadline jobs may be missed. Since these jobs are from different IoT devices, there is competition between jobs to receive their output in a minimum time, satisfying their deadlines. So, the current study helps VEC to fairly offload and schedule soft-deadline applications' jobs (e.g., intelligent entertainment or indoor positioning systems in vehicles) among RSUs to minimize the average response time and the number of jobs with a missed deadline.

III. RELATED WORKS
Fair allocation in multi-resource environments is first introduced with the economic mechanism of dominant resource fairness (DRF) by Ghodsi [6]. The DRF is based on fairness for users' utilization, considering all server resources are pooled together into a single resource, which is incorrect for distributed computing environments, such as cloud and edge computing. Many studies are tried to improve this method by reducing the single resource server assumption [7], [21]. Meskar [8] demonstrated that DRF might not provide a fair allocation mechanism for edge computing environments, where both computation and networking resources are variable. Then, they proposed a fair allocation mechanism for these environments. Max-min fairness for jobs with multiple parallel tasks in the scheduling of distributed computing platforms is studied in [22]. In this study, the utility of each job is a decreasing function of its completion time. The authors first present two notions of approximation in max-min fairness of multi-task jobs, then scheduling is introduced considering these notations. The problem of fair allocating multiple resources in multiple servers among users in mobile edge computing is studied in [23]. This paper considers that each user cannot establish a wireless connection to multiple edge servers, and her/his jobs are executed on exactly one edge server, also Leontief utilities are assumed for the users. It introduces a mechanism called MAGIKS to reach the fair Nash equilibrium solution. It is a polynomial time mechanism, provided that resource demands are discrete.
Data centers consist of multiple heterogeneous resources, and fair allocation is challenging. In [24], Poullie et al. introduced a survey on fair allocation in data centers. Besides presenting a definition of fairness in multi-resource allocation and relevant state-of-the-art, the authors explained utility functions and allocation characteristics to support fair data center resource allocation. The study of [25] presents multi-user task scheduling among fog nodes with two priority queues. Tasks can be scheduled in a fog node that receives offloaded tasks or in a neighboring fog node. In this study, fairness is defined as a stable allocation of tasks among scheduling queues, not the satisfaction of tasks. The paper of [26] tries to establish fairness among offloading services of resource-limited ground nodes (GNs), considering the trade-off of energy consumption between computing and caching operations. It attempts to assign UAV's computation resources among GNs equivalently. Furthermore, there are studies considering the fairness of an allocation solution regarding servers' utilization [27], [28], [29].
Round-robin [30] is a fair scheduling algorithm that assigns resources to jobs in equal time-slices in turn. Although this simple algorithm tries to allocate equal resources to all jobs, it is not efficient when there are many jobs with predefined QoS requirements like the deadline [31]. Many studies have investigated extending the round-robin algorithm to consider the priority of the jobs [32], [33], [34]. Stoica, et al. proposed a weighted round-robin algorithm in [35] for scheduling real-time processes in time-sharing systems. Also, a weighted round-robin algorithm for packet scheduling is proposed in [36].
The study of [31] also introduced a learning-based approach to allocate and schedule the jobs among edge servers fairly, considering the dynamic nature of network conditions and server loads. This solution introduces a weighted round-robin scheduling algorithm combined with deep reinforcement learning to schedule the jobs within the edge servers.
There are research studies on job allocation and scheduling in edge and cloud infrastructures, considering QoS requirements of users such as the deadline, not addressing a fair solution [37], [38], [39]. Liu, et al. studied task scheduling in a mobile cloud computing environment to minimize the application's total execution cost and load based on a novel scheduling algorithm called HEFT-T [40]. The authors considered interdependent tasks and two cases of unconstrained and deadline-constrained tasks. The paper of [41] introduced a game-theoretic solution for multi-user computation offloading in a three-tier mobile cloud computing environment, attempting to find the Nash equilibrium strategy for mobile users' offloading. Yuqing Li, et al. studied cooperative service placement and scheduling in edge clouds in [42]. This solution reduces cost by exploiting spatial-temporal diversities in workload and resource cost among federated edge clouds. The authors investigate this problem in two steps. This problem is formulated first without considering deadlines, and then tasks' deadlines are added to the problem, and a cooperative solution is presented. The paper of [43] presented an approximated solution for the computation offloading of delay-sensitive tasks in mobile edge computing to maximize energy saving. The paper of [44] introduced a three-layer task offloading and allocation framework in a mobile computing environment for multiple tasks of a single application, taking into account the task dependencies and users' mobility, to reduce the processing delay.
There is a significant difference between the studies presented and ours. The differences between our work and [8] are as follows. First, our approach attempts to reach a game-theoretic solution using the Nash equilibrium such that no player is dissatisfied with her/his job's response time. Second, we introduced a joint allocation and scheduling solution in multi-resource environments of edge computing. Third, we consider jobs' deadlines in the scheduling and try to minimize the deadline miss rate of jobs. In the MAGIKS mechanism [23], the assumption of executing each user's job at exactly one edge server is similar to that considered in the current study. In contrast to our study, the edge servers in MAGIKS are homogeneous. Also, it did not consider any QoS constraint (e.g., deadline) for the jobs. Most previous works on single/multi-resource fair allocation [6], [7], [8], [21] consider jobs to be divisible, whereas our study considers indivisible loads. In addition, the paper of [41] differs from ours in some directions. Our solution addresses joint allocation and scheduling problems considering the fair assignment of jobs with QoS constraint of the deadline. However, the paper of [41] models the response time of applications using queueing theory without considering any QoS constraint. In addition, there are differences between our work and [31]. Our joint allocation and scheduling game-theoretic solution outputs a pure Nash equilibrium where no player (i.e., job) desires to change its allocation strategy, while [31] is a learning-based technique.
We did not find in the literature any game-theoretic approach presenting a fair joint allocation and scheduling solution for time-sensitive jobs with indivisible loads in a multi-resource edge computing environment. Figure 1 shows an overall view of the considered system model. It consists of n IoT devices and m edge servers. Each IoT device belongs to a user and receives/sends data from/to its surrounding environment. The IoT device's input data triggers an IoT application associated with its specified user. We assume the applications as independent jobs with indivisible loads that are time-sensitive. So, two terms, IoT application and job, are the same throughout this paper. The set of input jobs to the system in each time is represented by τ = {T 1 , T 2 , . . . , T n }, and T i represents the job associated with user i. There are m access points with different wireless link bandwidths. Each access point is associated with a server with k type of computational resources at the network's edge. We consider every access point and associated server an edge server with a total of k + 1 resources, where link bandwidth is its k + 1th resource. So, we assume the set of edge servers as E = {R 1 , R 2 , . . . , R m }. Each edge server R j is represented as (R j cc=1:k , R j b ), where R j c indicates the capacity of the computational resource of type c in the server and R j b represents the link capacity for the jth access point. So, we assume each job demands k types of computational resources besides the link bandwidth as k +1th resource. We are representing every job T i with a tuple (T i c c=1:k , T i b ; d i ) where T i c represents T i 's demand of computational resource of type c, and T i b is T i 's link request or data size which should be transmitted from the wireless communication link. We assume the resource demands of all jobs for each resource type are non-zero:

IV. SYSTEM MODEL
T i c c=1:k > 0, and T i b > 0 ; ∀i. Every job T i announces a deadline d i , and desires to be executed within this time.
It should be noted that we used the capacity of the links in bit rate, not the actual physical channel's bandwidth (Hz). Considering the actual physical bandwidth of edge servers' links in Hz will result in different values for the equations of this paper. Using the following Shannon's theory [45], [46], links' capacity in bit-rate calculates from physical bandwidth (Hz).
where, S is the average signal power and N is the average noise power. Each edge server executes the jobs of a set of IoT devices. The assumption is that jobs allocated to one edge server are not transferred to another. Every job desires to be executed by its deadline while minimizing response time. However, this can not be obtained for all jobs due to the limitations in edge servers' resources and different resource requirements and deadlines. Thus, our resource allocation and scheduling solution seeks to minimize the average response time of input jobs and the number of jobs that miss their deadline. A list of all notations used in this paper is presented in table 1.

V. WEIGHTED TIME-SHARING SCHEDULING
The process of transmitting and executing the jobs in the system is as follows. Every job T j transfers from its associated IoT device to an edge server, executing the job according to its resource requirements. Then the processing output of the job is sent back to that device. The output data size is in bytes, and very small compared to the job's size, which is ignorable [31], [47], [48]. Therefore, we consider the response time of a job as the sum of two values: the transmission time, which is the time of sending the job from the IoT device to the edge server, and the computation time, which is the time of processing the job in k computation resources of the edge server. So, a job is executable if transmitted through the wireless communication link, and its data is placed on the allocated edge server.
Considering the competition among users' jobs to minimize their response times, we formulated the joint allocation and scheduling problem as a selfish game among jobs. Nonpreemptive scheduling methods lead to starvation for jobs with low-priority, which likely miss their deadlines [31]. So, these scheduling approaches are not fair in assigning resources to jobs. Hence, we used a weighted time-sharing scheduling method to allocate resources to jobs proportional to their demands and deadlines, using k +1 weight parameters as their share of resources. Our selfish allocation and fair scheduling solution attempt to yield a strategy profile of the game in which all users' jobs are satisfied with their response times.
Jobs determine one value for their deadlines and desire the sum of transmission time in the communication link, and the execution time in computation resources does not violate this value. So we split each job's deadline into transmission and computation deadlines for executing the job in the edge servers' resources. In more detail, if job T i is allocated to edge server R j , its transmission and computation deadlines are represented by d i,j b , and d i,j c , respectively. All computation resources of R j , suppose d i,j c for their deadlines, which is obtained using the maximum ratio of request to the resource capacity among computation resources. We can estimate these parameters as follows.
Our weighted time-sharing scheduling estimates weights for jobs to determine their shares of the edge server's resources.
If w i,j κ is job T i 's weight in resource κ of edge server R j , bellow equation evaluates this job's share of this resource [35].
where I j κ is the set of jobs in the scheduling queue of resource κ of edge server R j .
Computation resources can process at most one job at a time, so these resources are assigned to every job successively, corresponding to the job's share. On the other hand, edge server R j 's link bandwidth divides into χ separate parts (for example, different frequency bands in the frequency division multiple access (FDMA) or different time slots in the time division multiple access (TDMA) ), where χ is the number of jobs allocated to R j . The share of link bandwidth for job T i is proportional to its demand and deadline. Although multiple access methods can reduce wireless interference to some extent, the interference between edge servers is still established. Please note that we refer to these examples to provide intuition on the function of the introduced scheduling method. So, the challenges related to interference management are not in the scope of this article. However, there are several studies in the literature [49], [50], [51], [52] to address these challenges, that can be used in the current study.
We estimate the weight of every job T i on resource κ of edge server R j according to equation (4).
where, d i,j κ is the deadline of job T i on resource κ of edge server R j , T i κ is job T i 's request for this resource, and R j κ is the capacity of resource of type κ in edge server R j . So, we can estimate every w i,j κ as follows.
Our weighted time-sharing scheduling assigns resources to jobs according to their shares, estimated using equation (3). Therefore if R x i is the allocated edge server to job T i , and X = (x 1 , . . . , x i , . . . , x n ) is the allocation decision for input jobs, the below equation estimates the response time of T i .
where x ic is the sum of weights of jobs in resource c of edge server R x i , and x i b is the sum of weights of jobs in the link bandwidth of R x i . Hence, we have formulated the joint fair allocation and scheduling problem to minimize jobs' response time in the introduced system model. According to the illustrated scheduling, in each edge server R j , the shares and response time of every job T i depends on the number of jobs assigned to that edge server and their demands and deadlines. As a result, we model the joint allocation and scheduling problem as a selfish game, which we will explain in the next section.

VI. SELFISH JOB ALLOCATION GAME
According to the defined system model, we want to allocate users' jobs to edge servers such that resources are assigned proportional to jobs' demands and deadlines, and no job is unsatisfied with its response time. Every job attempts toward its benefit without caring for others. Therefore, we are facing a selfish allocation game among n users' jobs as players of the game [53], [54], [55]. We modeled this strategic problem as a routing game. The routing game is defined among players who want to transfer their loads in a network, including links with specified capacities. Every link has a cost, a function of the amount of traffic that uses the link. Selfish players choose routes to minimize the cost incurred. In equilibrium, all players choose a path of minimum cost [55], [56].
Since the jobs have indivisible loads, every job is assigned to exactly one edge server. So, the players' strategy is choosing one edge server among m edge servers (i.e., pure strategy). We used a variable x i ∈ [1, m] to represent the strategy of player i in our selfish game; it denotes the index of the edge server selected by job T i . Therefore, the strategy profile of our routing game can be shown using vector X = (x 1 , . . . , x i , . . . , x n ), where every entry x i of this vector represents the allocation decision of player i.
Considering the cost of job T i in selecting an edge server, as the cost of all jobs selecting that edge server, we define each edge server R j 's cost as follows.
According to equations (6) and (7), minimizing the cost of each edge server is obtained by reducing the cost of every job assigned to that edge server. In the defined selfish routing game, each player attempts to minimize her/his response time. The most common concept in solving such games is the Nash equilibrium [53], [55]. The following claim explains when strategy profile X is a Nash equilibrium of the defined game.
Claim 1: X = (x 1 , . . . , x i , . . . , x n ) represents a Nash equilibrium in our selfish allocation and fair scheduling game if we have the following for all jobs T i .
where x −i represents the allocation strategy of players other than i. So, in the Nash equilibrium, no player can decrease her/his response time by changing her/his allocation. In general, Nash equilibria are defined in terms of probability distributions over the set of pure strategies called mixed strategies. Since we considered indivisible jobs which must be assigned to specific edge servers, we are interested only in pure strategy Nash equilibrium [28], [53].
Theorem 1: At least one pure Nash equilibrium exists for the proposed selfish allocation and fair scheduling game.
To prove theorem 1, we define lexicographically minimum vectors as follows.

Definition 1 (Lexicographically Minimum Vector):
For any two m × 1 vectors x and y; x is lexicographically less than y, if there is an index k ≤ m such that for each index i ≤ k, x i = y i , while x k < y k . The lexicographically minimum vector is the least element of this total order.
Having definition 1, we can prove theorem 1 [56]. Proof: Every pure strategy profile X induces a sorted cost vector ζ =< cost R 1 , cost R 2 , . . . , cost R m >, in nonincreasing order such that cost R 1 ≥ cost R 2 ≥ . . . ≥ cost R m . We show that the pure Nash equilibrium strategy profile of X * corresponds to the lexicographically minimum sorted cost vector of ζ * .
To reach a contradiction, suppose that X * is not a Nash equilibrium. So, there exists a job T i i∈ [1:n] which assigned its load on edge server R j , (i.e. x i = j) and an edge server R j j ∈ [1:m] , Hence, if job T i changes her strategy from edge server R j to R j , the cost of edge server R j after the change is also smaller than R j 's cost in X. Therefore, the sorted cost vector after job T i changing its strategy from edge server R j to R j is lexicographically less than ζ * , which is a contradiction. According to proof of theorem 1, the lexicographically minimum cost vector of edge servers corresponds to a pure Nash equilibrium of the introduced game. Since jobs' demands of resources are non-zero, they must select edge servers to minimize their response times to reach a pure Nash equilibrium. This reduces the sum of the response times of all jobs selecting that edge server (i.e., the cost of the edge server). Therefore, in the pure Nash equilibrium of our game, every job must select an edge server such that its response time is minimized and it has no incentive to change the selected strategy. The following section presents a greedy and polynomial time algorithm to reach the pure Nash equilibrium of the introduced selfish allocation and fair scheduling game.

VII. ALGORITHMIC SOLUTION
In this section, we present a greedy and polynomial time algorithm called SAFSA (selfish allocation and fair scheduling algorithm) to compute a pure Nash equilibrium strategy profile of the introduced game.
SAFSA assigns jobs to edge servers greedy in terms of resource demands and deadlines, algorithm 1 represents its pseudo-code. Inputs of the algorithm represented in the first line, including the set of input jobs of {T }, the set of available edge servers of {E}, j b as the sum of weights of jobs assigned to the link bandwidth of every edge server R j , and j c is the sum of weights of jobs assigned to each computation resource c of every edge server R j . Initially, SAFSA assigns every input job to an edge server where the sum of the ratio of resource demand to the resource capacity (i.e.,

T iκ
Rj κ ) for all resource types of κ is minimized. So, the weights of jobs do not consider in the initial assignment (lines 2 to 4). Also, the cost of edge servers' resources initializes to zero (lines 5-7). After the initial assignment of jobs, VOLUME 10, 2022 the following process (i.e., lines 9-20) will be done on each edge server. Edge server R j gives the highest priority to job T 1 if the sum of T 1κ κ=1:k+1 R jκ κ=1:k+1 ×d 1,jκ κ=1:k+1 is greater than that of jobs with R j as their strategy (line 10). The reason is that in the introduced weighted time-sharing scheduling, the weight of job T i in each resource κ ∈ [1 : k + 1] of edge server R j is directly related to the ratio of T iκ R jκ ×d i,jκ (according to equation (5)). If no job is allocated to R j , then T 1 will assign to this edge server with weight one, and the sum of weights of resources will be updated (lines [12][13]. Otherwise, the sum of weights will be updated after calculating the weight of job T 1 according to equation (5) (lines [15][16]. After assigning job T 1 to R j , the execution time of this job on each resource of R j will be added to the cost of that resource. Finally, T 1 will be removed from the set of input jobs (i.e., set {T }) (lines [18][19].
In the following, edge server R j will be selected for the allocation strategy of every job T i in the set of unassigned input jobs of {T } if the cost of this server is minimized by adding the ratio of T iκ R jκ ×w i,jκ × j κ to the current cost of every resource κ of R j . Where w i,j κ is a temporary weight of T i in resource κ ∈ [1 : k + 1] of R j by having the current sum of weights in the resources (lines 21-23). Then, SAFSA reruns the process of selecting the job with the highest priority in every edge server (lines 9-20). The algorithm repeats until all jobs are assigned to the edge servers (lines [8][9][10][11][12][13][14][15][16][17][18][19][20][21][22][23][24].
Claim 2: SAFSA computes the pure Nash equilibrium of the introduced selfish allocation and fair scheduling game in a polynomial time.
Proof: We assume X (s) = (x s 1 , x s 2 , . . . , x s s ) is the output strategy profile of SAFSA for the first s jobs with the highest priority, and C i (X (s)) is the response time of job T i in X (s). We represent the allocation strategy of T i in X (s) with x s i , and x s −i is the allocation strategy of jobs other than T i . Since the initial assignment is based on jobs' resource demands and edge servers' available resources, the claim is correct if there is one job in the system. We inductively consider that for all s ≥ 1, s ∈ [1 : n], X (s) is a pure Nash equilibrium for the first s jobs with the highest priority. Then we show that X (s + 1) is a pure Nash equilibrium for the jobs in [1 : s + 1].
Job T s+1 will be assigned to edge server R j where its response time is minimized considering the available resources of the edge servers and the jobs allocated to them. Also, T s+1 's weight in R j 's resources is more than all jobs selected that edge server as their strategy. So T s+1 cannot decrease its response time by changing its allocation strategy, and we have the following inequality: Also, for each job T l = T s+1 assigning to edge server R q = R j , we have the following: Since T l had been assigned to an edge server other than R j , inserting T s+1 into the input jobs does not affect its response time, and the equality is correct. Also, the inequality holds because X (s) is assumed to be the Nash equilibrium of the game. On the other hand, the following inequality is correct for each job T m = T s+1 that is assigned to R j .
Since the jobs are assigned to edge servers in order of priority, the priority of T m in R j is higher than T s+1 , and T m has no incentive to change its allocation. Therefore, the players (i.e., jobs) have no incentive to change their allocation, and X = (x 1 , x 2 , . . . , x n ) is the pure Nash equilibrium of the introduced selfish allocation and fair scheduling game. The main operation of determining a job with the highest priority for each edge server is in the loop of lines 8-24 of algorithm 1. It is in the order of O(nmk), where n is the number of input jobs, m is the number of edge servers, and k is the number of resources in each edge server. Each iteration of this loop assigns at least one job to its appropriate edge server. So, the computation complexity of this algorithm is O(n 2 mk), and SAFSA can calculate the pure Nash equilibrium of the introduced selfish allocation and fair scheduling game in a polynomial time.
SAFSA runs in a central server with general knowledge of the system. This central server can be a broker in the edge layer or the cloud layer, and the output of this algorithm is the allocation and scheduling decision for the input jobs.

VIII. EXPERIMENTS
We simulate our joint allocation and scheduling scheme using an extended version of the CloudSim framework [13] and an initial implementation of SAFSA. The simulation environment consists of 50 IoT devices and 5 edge servers. We considered one computation resource of CPU, along with the link bandwidth, in each edge server. Edge servers in the simulations have link capacities from {1 GB/s, 5 GB/s, 10 GB/s}, and processing powers from {800 MIPS, 1500 MIPS, 2000 MIPS, 3300 MIPS}. Table 2 represents the parameters of the simulation environment.
We used Google cluster traces [57] representing resource requirements and usage data for tasks in several days of using Google machines. The traces provide information on job duration, resource demands, and resource usage. We used 500 traces in this analysis. Most resource requirements and usage in the traces include CPU, memory, disk space, and disk time fraction. However, the Google cluster traces do not have any information on bandwidth usage. Therefore, Algorithm 1 Selfish Allocation and Fair Scheduling Algorithm (SAFSA) 1: Inputs: {T}: the set of input jobs; {E}: the set of edge servers; j b : the sum of weights of jobs assigned to the link bandwidth resource of every edge server R j ; j c : the sum of weights of jobs assigned to each computation resource c of every edge server R j 2: for each job i = 1 : n do 3: x i = arg min j∈{1:m} {max c=1:k ( } 4: end for 5: for each edge server j = 1 : m do 6: λ j κ κ=1:k+1 = 0 λ j κ is the cost of resource κ in R j 7: end for 8: repeat 9: for each edge server j = 1 : m do 10: Consider T 1 is the job with the highest priority in R j 11: if no job was assigned to R j then 12: w 1,j κ κ=1:k+1 = 1 13: j κ κ=1:k+1 = w 1,j κ κ=1:k+1 14: else 15: calculate w 1,j κ according to equation (5) 16: for each job i in {T } do 22: x i = arg min j∈{1:m} {max c=1:k (λ j c + T ic R jc w i,jc is a temporary weight of T i in R j having j cc=1:k , j κ+1 23: end for 24: until {T } = ∅ 25: return X = {x 1 , x 2 , . . . ., x n } we borrowed the instructions of [58] to model the bandwidth demand of jobs according to their CPU usage. Considering W indicates the number of CPU cycles used by an application, and L is the number of data bits as the input to the application, we have W = L × Y , where Y is a random variable with Gamma distribution. We used the shape parameter α = 4, and rate parameter β = 200, to generate Y , according to [58]. The experiments are performed on a personal computer with Intel(R) Core(TM) i5, 2.5 GHz CPU and 8 GB RAM. We divide the set of input jobs into n equally non-overlapping groups where group i indicates the input jobs of IoT device i. The input jobs are entered with a specific arrival rate. We used two performance metrics in the evaluations. The first is the average response time of jobs, and the second is the deadline miss rate, which is the number of jobs that take longer to complete than their deadlines divided by the total number of jobs. We have repeated all experiments at least 100 times, so each point on the plots is the average result of at least 100 different simulation runs. The proposed algorithm of SAFSA is compared with the following four methods: • Max-min+FCFS: In this scheme, the jobs are allocated to edge servers using the minimum dominated resource concept of DRF [6]. Also, the allocated jobs are scheduled in the edge servers' resources using the first come, first service (FCFS) algorithm [9]. itemMax-min+RR: This scheme also uses the DRF [6] method for allocating jobs. However, the allocated jobs are scheduled using the round-robin [30] algorithm.
• Greedy+FCFS: In this scheme, every job selects an edge server such that the sum of the ratio of resource demand to the available resource of the edge server for all resource types is minimized. Then the allocated jobs are scheduled using the FCFS algorithm.
• Greedy+RR: This scheme also allocates jobs greedily according to the sum of the ratio of resource demand to the available resource of the edge server for all resource types. This method schedules the jobs using the round-robin.
We called evaluated schemes that use the max-min allocation as max-min based schemes and the methods that use the greedy allocation as greedy based schemes.

A. EVALUATION EXPERIMENTS
We first analyze response time and deadline miss rate for ten jobs of the dataset to study the ability of SAFSA compared to other evaluated schemes. The specifications of these jobs, including the deadline, the input data size, and the number of CPU cycles needed to complete the jobs, are represented in figure 2, respectively. Figure 3 shows the average results for 100 simulation runs of these jobs. The results confirm that response times for greedy based schemes with FCFS and RR scheduling are higher than all other methods. Except for two jobs of 4 and 8, where the response time of SAFSA is a little higher than max-min based schemes, SAFSA has a better response time for other jobs. As you can see in figure 2, deadlines for jobs 4 and 8 are higher than others. At the same time, their data size and required CPU cycles are not very high. So, the priority of these jobs in SAFSA is lower than other jobs having smaller deadlines and higher resource requests, which leads to a little higher response time than max-min based approaches. Nevertheless, thanks to their high deadlines, they can be completed within their deadlines with either SAFSA or max-min based approaches. In other words, SAFSA has 100% superior response time than greedy based schemes and 80% greater than that of max-min based schemes with RR and FCFS scheduling.
Regarding the deadline miss-rate of jobs, all compared schemes can execute all jobs except job 7 before their deadlines. It is due to the very small deadline of this job compared to other jobs. The greedy based schemes can not execute job 7 within its deadline in all 100 runs. Furthermore, max-min based methods missed this job's deadline 70 and 80 times,   respectively. At the same time, SAFSA gives a high priority to job 7 and succeeded in executing all jobs within their deadlines. So, the deadline miss rate of our scheme is zero for all ten jobs. Figure 4 represents the performance of different schemes by increasing the number of input jobs to the system from 50 to 500. In this analysis, the arrival rate of jobs did not change. In all evaluated schemes, increasing the number of jobs increments the average response time. Greedy based schemes with RR and FCFS scheduling have a higher response time than other evaluated methods in all cases.

1) IMPACT OF THE NUMBER OF INPUT JOBS
SAFSA attempts to simultaneously decrease the deadline miss rate and average response time by considering the shares of jobs allocated to each edge server. At the same time, approaches similar to max-min based only consider the resource request of the jobs. In these schemes minimizing the response time of jobs with high resource requests and deadlines can decrease the average response of the jobs. However, neglecting jobs with fewer requests and very short deadlines can cause them to miss deadlines. Therefore, max-min based approaches can compete with SAFSA in terms of the average response time, while their performance is not acceptable in minimizing the deadline miss rate of jobs. Since in SAFSA, the set of jobs assigned to each edge server affects the allocation decision of a new job, the performance of our method is robust by increasing the number of input jobs. This feature is proved in figure 4a, where the performance of SAFSA improves and distances from max-min based approaches by increasing the number of input jobs. Max-min based methods have equal response time for both RR and FCFS scheduling in all cases. It indicates the significant importance of allocating jobs to edge servers compared to scheduling in the servers.
On the other hand, in terms of deadline miss rate, SAFSA outperforms in comparison to all other schemes with significant performance. Increasing the number of input jobs increases the time needed to execute them over limited resources. However, in some cases, the jobs' deadline is large enough such that they can be executed at their deadlines. So, an appropriate allocation and scheduling approach can be robust against increasing the deadline miss rate as the number of jobs increments. Therefore there is not necessarily a reverse relation between the average response time and deadline miss rate of the jobs. This situation can be established in the analysis of this section and the following sections.
In this evaluation, by increasing the number of input jobs, the deadline miss rate increases in the evaluated schemes, while SAFSA prevents deadline violations when the number of input jobs increases. Results from this evaluation confirm that SAFSA is robust in minimizing average response time and deadline miss rate for the different number of input jobs.

2) IMPACT OF THE NUMBER OF EDGE SERVERS
In this part, we have analyzed the performance of the proposed scheme in an edge computing system with 50 IoT devices entering 500 jobs when the number of edge servers changes from 4 to 15. Decreasing the number of edge servers leads to limitations in the communication and computation resources, which increases competition among jobs in allocating resources. A successful approach must complete more jobs within their deadlines when limited resources are available. Figure 5 indicates greedy-based approaches' performance does not change by increasing the number of edge servers. This is because all jobs greedily select an edge server with higher resource capacity and do not assign to other edge servers, even if idle. It significantly reduces greedy allocation performance with RR and FCFS scheduling methods. However, the average response times of max-min based approaches and SAFSA decrease by increasing the number of edge servers. Since the jobs do not have many options to change their allocation strategy when there is a low number of edge servers, SAFSA's average response time is close to max-min based approaches in this case (figure 5). By incrementing the number of edge servers and increasing jobs' options for allocation strategies in SAFSA, its average response time difference with max-min based approaches increases. The configurations of edge servers are obtained arbitrarily according to table 2. So, the new edge server may not have better resource capacity than available edge servers, preventing jobs from choosing it for their initial allocation strategy. It can bring fluctuations in the results of SAFSA and max-min based approaches for the different number of edge servers.
According to figure 5b, the deadline miss rates of max-min based allocation schemes with RR and FCFS scheduling are decreasing by increasing the number of edge servers. However, they can not reach that of SAFSA, and it always succeeds in terms of deadline miss rate over other evaluated approaches, thanks to considering the jobs' deadlines besides their resource demands, in the introduced weighted timesharing scheduling. This result confirms the ability of SAFSA to decrease both average response time and deadline miss rate, while max-min based approaches' success is just in terms of the average response time.

3) IMPACT OF THE NUMBER OF IoT DEVICES
Analyzing the methods by increasing the number of IoT devices from 50 to 700 is represented in Figure 6. Incrementing the number of IoT devices in the system leads to enlarging the input jobs, increasing the average response time of all evaluated schemes. However, the slopes of greedy based approaches' average response time curves are steeper than other schemes. It indicates the poor function of these methods for a large number of IoT devices. This performance is predictable from section VIII-A1 in analyzing the methods regarding the number of input jobs. Since both max-min based schemes and SAFSA pay attention to the resource requirements of the jobs, they provide comparable average response times (figure 6a). However, by increasing the VOLUME 10, 2022  number of IoT devices, SAFSA's performance surpasses that of max-min based approaches. This result, along with that of section VIII-A1, confirms SAFSA's efficient and robust performance by increasing the number of input jobs and IoT devices.
On the other hand, figure 6b indicates the deadline miss rate of SAFSA is lower than that of other evaluated schemes for different numbers of IoT devices. It is because of considering the jobs' deadlines besides their resource demands in allocation and scheduling decisions of SAFSA. In contrast, other schemes like max-min based approaches only focus on jobs' resource demands. Although SAFSA has a similar average response time or even worse in some limited points in comparison to max-min based approaches, its outstanding ability to decrease the deadline miss rate of the jobs for all different numbers of IoT devices confirms SAFSA's capability in decreasing both response time and deadline miss rate of jobs by changing the number of IoT devices. This power is evident for a large number of IoT devices, a key feature of IoT applications. Figure 7 exhibits the performance of the analyzed methods with different arrival rates of 500 jobs to the edge computing system. We represent jobs' arrival rates with values from 0 to 7, where 0 indicates a very high job arrival rate and 7 indicates a very low arrival rate. By decreasing the arrival rate of jobs, the average response time diminishes in both SAFSA and max-min based schemes. Nevertheless, according to figure 7a, the average response time of SAFSA is lower than all other evaluated schemes for different arrival rates. Since SAFSA considers jobs' deadlines besides resource requirements on their allocation and scheduling, it decreases deadline miss rate by reducing jobs' arrival rates. In contrast, other methods do not significantly change their deadline miss rates for different arrival rates. This indicates the outstanding ability of our scheme in minimizing both response time and deadline miss rate for different arrival rates of jobs.

IX. CONCLUSION
We proposed a joint allocation and scheduling scheme for multi-user edge computing environments in which competition among users' jobs is modeled as a selfish game. We considered heterogeneous communication and computation resources in the edge computing system and the multi-resource requirements of IoT applications with deadline constraints. Also, we have focused on jobs with indivisible loads in which they are allocated and scheduled on one edge server. The satisfaction of jobs is considered with allocating resources proportional to their resource demands and deadlines. A selfish allocation game and a weighted time-sharing scheduling method were introduced to achieve this objective. By demonstrating the existence of pure Nash equilibrium, we provided a greedy and polynomial time algorithm to achieve selfish allocation and fair scheduling solution called SAFSA. We assessed the performance of SAFSA using a real-world dataset of Google cluster [57], and an extended version of the CloudSim simulator [14]. The evaluations are performed in terms of average response time and the ratio of jobs with missed deadlines in an edge computing system with two types of resources (i.e., CPU and link bandwidth) for the edge servers. SAFSA's performance was compared with greedy and max-min allocations also FCFS and RR scheduling. SAFSA minimizes both measurements simultaneously, while others just focus on improving the average response time. The evaluations confirm this result for different circumstances of the edge computing environment, especially a large number of input jobs and IoT devices, a characteristic of IoT applications. To extend the current study, it is encouraging to consider the QoS requirements of users along with the constraints of resources such as energy. A further exciting topic for future research is the joint allocation and scheduling of dependent jobs.