# Secured Optimized Resource Allocation in Mobile Edge Computing

Authors: Asma Bibi; Muhammad Faran Majeed; Sikandar Ali; Irshad Ahmed Abbasi; Ali Samad; Samad Baseer
Journal: Mobile Information Systems
 (2022)

---

## Abstract

Mobile edge computing (MEC) uses multiple mobiles to compute several complex tasks that are unable to compute on a single device. Taking advantage of all abundant mobile resources and making a mobile cloud from them will be useful. This study aims to propose and implement a novel framework to cover challenges raised by application execution on resource-constrained devices. The purpose is to overcome the waste of resources in MEC and provide time efficiency to the data packets that are sent and received between offloaded and offloading devices. The main task of MEC is to offload tasks by first selecting resources and then allocating tasks to selected resources. A multiple linear regression algorithm is used for the selection of compatible devices. Particle swarm optimization techniques are used as a benchmark technique to design an algorithm for optimized resource allocation. Multiple mobile devices acted as a major component for making edge clouds. The study finds that response time of processing tasks is reduced, ineffectual resources become beneficial, increase in demand for mobile devices, and usage of mobile resources as a replacement for mobile edge cloud servers. Abundant resource usage of two or more edge clouds, that is, interedge resource usage is the originality of this research, while others are using intraedge resources only.


---

## Body

## 1. Introduction

The recent increase in demand for mobile devices and the use of the cloud as virtual storage demanded the field to evolve, named mobile edge computing (MEC). Research in MEC is performed by load balancing and offloading. To decrease resource demand in MEC architectures, a pattern of traditional clouds is used. The majority of the MECs do not consider optimization and cost factors. MEC also provides the network to use the resources that have less memory, time, and energy consumption.MEC provides the opportunity to reduce latency while offloading tasks in the network. MEC allows the resources to offload tasks easily and safely in the network. MEC tries to reduce the consumption of power and energy. It removes all the delays from the network. MEC designs the nodes to offload tasks in the network to remove all the delays from the network. MEC allows the nodes to get information about the other nodes that are offloading data in the network so there will be no collision. It allows nodes to use all the resources from the network. Linear programming is the most common approach to optimize an objective function, for example, to reduce resource consumption, reduce the total execution time, reduce latency, or increase the quality of experience.One of the recent approaches to solving the offloading problem is by using deep learning [13]. Table 1 shows an overview of different surveys conducted in the field. Limitations of the surveys are also mentioned in the table.Table 1
Survey-based analysis.
Year [paper]Topic discussion and overviewLimitationFebruary 2019 [1]Machine and deep learning techniques are mostly used in papers of this survey. Machine and deep learning are used to detect the encryption traffic in offloading tasks in the network.There are grand challenges in edge computing security.March 2017 [2]Network virtualization and Lyapunov optimization-based dynamic computation offloading (LODCO) algorithm is used. Network virtualization manages the flexibility of the virtual representation provided by the MEC.Dynamic resources are added while offloading tasks in the network.December 2020 [3]Markov-based, heuristic, and metaheuristic algorithms are used.Resources that are added to offload tasks in the network increase delay.Markov-based techniques reduce the time and redundancy while offloading tasks in the network.January 2017 [4]Machine learning advanced communication techniques are used to offload tasks in the network.Slow processing increases time delay.June 2017 [5]Advanced communication techniques are used.Refraction and reflection increase delay.May 2018 [6]Migrating running service technique and compression algorithm are used. Migrating running service technique is used for migrating the task in the network.The size of the task is not reduced, so there is a delay in the network.2007 [7]IDS is used to interpret the traffic while offloading tasks in the network.The cost factor is not considered2007 [8]The pushback technique is used to aggregate the traffic while offloading tasks in the network.A comparison of complexity analysis is not performed.2014 [9]RTT communication and task scheduling algorithms are used. RTT communication is used to handle the traffic while offloading data in the network and divide the task in the node to remove the delay.Processing delay is not entertained.2020 [10]VM migration and genetic algorithm are used. VM migration is used to migrate the task in the network and makes the performance better.There is delay in resource consumption.2017 [11]The virtual machine is used to migrate the task virtually in the network and make the performance better.There is time delay.2015 [12]Lyapunov optimization and online control algorithm are mostly used in the research paper of this survey. Lyapunov optimization is used to run the online program to offload tasks in the network.Maximization of resource usage is not performed.A gap in the [14] study is that it does not consider offloading in the large-scale network, while the quality of offloading tasks in the network is not considered in [15]. Safety is not considered in [16], while task execution is difficult for the user in [17, 18]. Modern facilities to use are not well-thought-out [19]. The disadvantage in [20] is that it does not consider if any virus destroys this data, then what will be sent next. The negative of [21] is that it does not consider the multiple attacks solution. The undesirable thing about [22] is that it does not consider the solution of inputting tasks easily for the user. The ploy of [23] is that it does not consider the offloading task in the network easily and more securely. The depraved thing of [24] is that it does not consider more instructions to make the system more secure. The downside of the study is that it does not consider cryptography techniques to make the network more secure [25].Table2 presents the critical analysis.Table 2
Critical analysis.
Year [paper]Technique usedProposed techniqueResultsLimitationMay 2019 [26]Deployed cloudlets used for dividing the resources ink nodesA single node makes the network so busy that increase. DOTA, CBL, and FATO are used for dividing tasks in cloudlets.Cloudlets offload the task easily by using the techniques of DOTA, CBL, and FATO.Less energy consumption having less cost technique is not developed.October 2018 [27]New architecture for computation and storage offloading based on fog computingNew architecture for computation and storage offloading based on fog computingCOCA offloads the task from the smartphone to the fog server.The enactment of the cloud upgraded, uploading data become fast.August 2020 [28]Local computing (mobile device) that combines with the computing systemLocal computing (mobile device) combines with the computing system.System problem loss function (SYLF) minimization problemQLCOF scheme effectively reduces the SYLF.2017 [29]Mixed integer programmingNP-hard problem, EcoMDEcoMD provides an improved performance.NoneNovember 2020 [30]Elliptic curve cryptosystem.Pairing-free multiserver authentication protocolSecure mutual authentication, anonymity, and scalability are achieved.NoneMay 2020 [31]Comparison technique (proposed MUMACO with benchmark)Offloading of all applications is done to the cloudlets, but a fraction of cloudlets is idle.Time consumption, energy consumption, and load balancing are optimized.Multiobjective is performed. Optimization cannot be performedJanuary 2020 [32]Offloading algorithm (hybrid intelligent optimization algorithm)Optimization of task delay and resource consumptionThe proposed algorithm effectively improves the offloading utility as compared to baseline.Offloading in the uncertain network is not available.March 2020 [14]Comparison and optimizing technique (offloading)Performance and energy of mobile device can be improved by edging.Proposed HIQCO provides accurate results and then compared the algorithm.Storage cannot be considered in the comparison to HIQCO and baseline algorithms.August 2019 [33]MCOWA technique used for uploading tasks on the network easilyBy using MCOWA technique, algorithm problem is solved as it solved the complexity of the network.Time and energy are consummated so the network becomes fast.None2018 [34]Analysis technique used for the scalability and performance of an edge cloud systemInteredge is unchanged. Bandwidth should remain.If capacity is added to the existing edge network deprived of increasing the interedge bandwidth, then it will pay for networkwide congestion.Increasing distance and low bandwidth will increase the load.March 2020 [35]Cloud modeling operator introduced that deals with the execution of packets in the networkBy using this strategy, the performance of computing resources improves.Time and energy are consummated. Also, improve the utilization of computing resources and ensure the QoS, and this is critical to edge-cloud computing business models.The problems such as management resources of MEC and the cloud are not improved and considered.April 2020 [36]FL technique introduced for round communication between the nodes in the networkThe nodes will only send a message from one node to other when they receive a message that the network is free.By using the FL technique, the network becomes safe from the collaboration of messages. Thus, the packets will not be lost.Privacy is not considered and improved to make the network secure.April 2020 [37]GPS technique used for measuring frequency and sending the signals even from the satelliteGPS technique is used for sending the signals from satellite to the user. So the user can easily send a message from Earth to satellite, and vice versa.The offloading task increases if the user sends a message to the satellite. There will be no interruption of other networks as the nodes only send one packet at one time.No technique is used to make the signal powerful as if the signal is weak, the packet will be lost.January 2021 [38]DECCO technique used for maintaining signals from a long distanceLong distance creates the network slow. Thus, the packet delay. Energy and power consumption.DECCO used that maintain the long distances plackets. Thus energy, time, power and quality consumption.Many computing capabilities are not considered.September 2019 [39]Mobile edge computing usedThe network becomes secure and fast, and good qualities are available in the network.The network becomes fast; delay is removed from the network.Sending a large amount of data is not considered.September 2019 [40]Edge-centric IoT used that is responsible for offloading data safely in the networkSecurity is very important for offloading tasks in the network.If there is no security in the network, then the delay will occur, and the data can also be hijacked.If data is hijacked and caught by a virus, then no technical solution is considered here.January 2019 [41]GMaxEOQU and GMinEOIP used in the networkGMaxEOQU and GMinEOIP are used to minimize the quality errors in the network.If there are less nodes present in the network, then there will be a delay in the network.Offloading times by multiple nodes are not considered.February 2020 [42]QMPOS technique used in the networkQMPOS technique is used to derive the result in the network and evaluate the performance of VN.By balancing the load of VN, the task will offload within time. The network becomes burdenless.The cost of VNs is not considered.June 2020 [43]Fog computing used in the networkFog computing provides management, security, and availability of resources that helps offload tasks.Offloading tasks becomes too easy and secure. Nodes will get many resources for offloading tasks in the network.The cost of resources is not considered.June 2020 [44]SMSC and RAMWS used in the web serversSMSC works to control the requests that arrive on web servers, and RAMWS works to overcome the request time out in the web server.The web server provides the resources to the users to use the resources and offload their tasks. It also provides the user the facility to get information from the websites.Protection of web servers is not considered.August 2020 [41]Skippy technique usedServerless is used in the network that provides all resources to offload the task in the network, and Skippy helps serverless do this.A large amount of data is able to send in the network by using serverless.If any unauthorized network hacks the data, then a large amount of data will have lost in the network.March 2019 [45]Pervasive technique usedPervasive helps the computer provide all resources to the nodes to the nodes offload their task.Pervasive helps the user find anything from the computer by using it. It also provides the user to interact with the computer easily.Security is not considered.August 2018 [46]Routers used in the wireless networkRouters develop the communication between the two networks and make communication possible.Wireless network also provides the facility to the nodes and make communication easy like space.Cost is not considered.December 2016 [23]Load balancing (virtual machines) Apache JMeter (tool)The majority of MCC do not consider cost factors. For multiple users, one virtual machine architecture is most suitable.23 times task execution increases and 2/3 resource usage decreases.Execution time is more for projected architecture.2020 [14]Quality of service approachMobile edge computingLow energy consumption and low delayDo not consider offloading data on large scale.2020 [15]EOESPA, RNOESPAPD-NOMA-SCA, PD-NOMADistribute tasks in the nodes of the network.Do not consider the quality of offloading data.2020 [16]Cryptography approachRSASecure mobile devices by keys and passwordsDo not consider secure Internet.2017 [17]Reputation-based resource allocation approachGenetic algorithmOffload tasks safely in the network.Do not consider the easy way of the offloading task.2017 [19]Virtual cryptographyZero watermarking algorithmMake data safe and able to update from time to time.Do not consider modern facilities.2019 [20]Elliptic curve cryptographyAuthentication protocolEncrypt and decrypt data same as the user want.Do not consider sending data next if the virus destroys it.2021 [21]GR cryptographyLightweight cryptography algorithmMake the thing download easily and safely from the Internet.Do not consider multiple attack solutions.2020 [47]P2P cryptography currenciesBlockchain and task offloading techniquesEncrypt and decrypt data exactly in the network.Do not consider secure edge computing.2021 [22]AES-based cryptography approachDeep reinforcement learning based on an online algorithmRemove delay from the thing download and access from the Internet.Do not consider inputting task solutions.2020 [23]Cryptography hashSDNDivide task in the nodes so no collision will happen.Do not consider a secure and easy offloading task.2019 [24]AES-based cryptography approachFPGANo collision will happen to destroy the data.Do not consider a more secure system.2020 [25]AES-based cryptography approachLLCAEncrypt and decrypt data exactly in the network.Do not consider more cryptographies to make the network more secure.2020 [48]AES-based cryptography approachLSMProtect the data of user from not being able to hack for the other person.Do not consider an easy and secure offloading task network.2020 [49]AES-based cryptography approachRSACriminal record update from time to timeDo not consider more functions to offload tasks in the network.2021 [50]BlockchainACO algorithmMake the system more secure to offload data in the network.Do not consider more systems to make offloading tasks in the network more secure and easy.The rest of the paper is arranged as follows. Section2 contains a literature review. Section 3 states the problem statement while Section 4 elaborates on the proposed solution. Section 6 concludes the paper with a proper future direction.


## 2. Literature Review

The authors of [26] found that cloudlets offload the task easily by using the techniques of DOTA, CBL, and FATO. Mobile devices request for the transmission of information by making sure the message is in the network so there will be no collision.MCC provides the facility to store large data over the network, and it also ensures the sending of large amounts of data on the network. Mobile edge computing improves the speed of the node by removing the slow node PCs from the network and adding the neighbor PCs. It is found in the paper that a single node makes the network so busy that it increases. DOTA, CBL, and FATO are used for dividing tasks in cloudlets. The limitation is that less energy consumption having less cost technique is not developed. It also provides good efficiency to the nodes in the network. So the nodes will offload tasks in the network with good quality. SDN provides the facility for MEC to divide the task into nodes. The nodes will offload tasks in the network sequentially. So there will be no loss of data in the network. MEC also provides the service of offloading tasks in the wireless network [51].Wang et al. proposed a new architecture for computation and storage offloading based on fog computing and found that COCA offloads the task from the smartphone to the fog server [27]. The result was deduced that with the enactment of the cloud upgrade, uploading data became fast. In this research, no technique was used for uploading large amounts of data. More resources must be added due to the hinging of the network.In [28], local computing (mobile device) combined with the computing system and found system loss function (SYLF) minimization problem. Markov decision process (MDP) designed a state loss function (STLF) to measure the quality of experience. In it, multioperator multiverge cloud state was not considered. Slow nodes must remove because multiusers increase the cost. Mobility management is the reason for the disconnected link between the devices and the edge network. It manages horizontal and vertical mobility. Heterogeneity deals with the wireless network interface, for example, Wi-Fi. Low delay and high bandwidth are the main challenges. Decrease in price by adding neighbors to offload tasks early is the main challenge. MEC provides the service of offloading tasks in the network by using the Internet. MEC allows users to download anything from the Internet keeping the security in the mobile devices. MEC provides the service of using passwords on mobile devices. It provides the facility of storing data on the Internet so that when the user accesses the Internet, he will easily access the information without any delay. MEC provides biometric security so that when the user enters his data in biometrics, his data will remain safe and will not leak to anyone. MEC makes it possible that when the person will enter his fingerprint, all his data will come out. This data will not be accessible to anyone because MEC provides security. MEC provides security to the nodes when the nodes will offload data in the network. The data will be safe and will not be disclosed to anyone. MEC provides security to the nodes by using passwords and keys that will not be shared with anyone.In [29], the authors used mixed integer programming to find NP-hard problems and EcoMD. EcoMD provides improved performance in terms of resources. But resources must be stable because increasing nodes will increase the cost. However, there are some other solutions as well that do not fit our study [52–55].The authors of [30] used the elliptic curve cryptosystem and MSA protocol for the MCC environment to find a pairing-free multiserver authentication protocol and achieved secure mutual authentication, anonymity, and scalability, but there was no mechanism of security proposed in it.In [31], the authors used the comparison technique (proposed MUMACO with benchmark) to find offloading of all applications to the cloudlets, but a fraction of cloudlets was idle. Time consumption, energy consumption, and load balancing were optimized but multiobjective optimization cannot be performed, and less cost and energy consumption resources must be used.In [32], the authors proposed offloading algorithm (hybrid intelligent optimization algorithm) and found optimization of task delay and resource consumption. The proposed algorithm effectively improves the offloading utility as compared to the baseline algorithm, but offloading in an uncertain network is not available [56].In [14], the authors introduced a cloud modeling operator that deals with the execution of packets in the network by using this strategy; the performance of computing resources improves. Also, they improve the utilization of computing resources and ensure the QoS and thus are critical to edge-cloud computing business models [57].In [33], the FL technique was introduced for round communication between the nodes in the network. The nodes will only send messages from one node to another when they receive a message that the network is free. By using the FL technique, the network becomes safe from the collaboration of messages. Thus, the packets will not be lost. Privacy is not considered and improved to make the network secure.In [34], the GPS technique is used for measuring frequency and sending the signals even from the satellite. GPS technique is used for sending the signals from satellite to the user. So the user can easily send messages from Earth to satellite, and vice versa. The offloading task increases if the user sends a message to the satellite. There will be no interruption of other networks as the nodes only send one packet at one time. No technique is used to make a signal powerful as if the signal is weak, the packet will be lost. MEC does the encryption and decryption task in the network. The nodes will encrypt data in the network. MEC makes this task possible that regardless of what the user sends for encryption, the network will decrypt the same data in the network without any delay. MEC also makes the money transaction possible and safe by using the keys such as ATM keys and PINs. The PIN is only known by the user who uses the ATM. Thus, the data and the money will be safe. MEC provides security to the criminal record. If the person does any crime, then the record will be written in the file. This file will not leak to anyone and will be updated from time to time. It is possible due to MEC. MEC provides the security and privacy for storing data in the network that when the user wants to access the data, MEC makes the task present in the network. This removes the delay from the network to access the network.In [35], the authors used the DECCO technique for maintaining signals from a long distance. Due to long distance, the network becomes slow resulting in high packet delays, energy, and power consumption. DECCO maintains the long-distance packets. Thus energy, time, power, and quality consumption are achieved. Cloud servers are far away from mobile devices that create signal issues, so the resources become weak.The authors in [36] used edge-centric IoT that is responsible for offloading data safely in the network. Its security is very important for offloading tasks in the network. If there is no security in the network, then the delay will occur, and the data can also be hijacked. If data is hijacked and caught by a virus, then no technical solution is considered here. If there is no security and privacy in the network, then the data will create delay and be hijacked. The network must be protected by passwords, and the password must be secure. The password is not shared by anyone [58, 59].In [37], the authors used GMaxEOQU and GMinEOIP in the network, and they are used to minimize the quality errors in the network. If there are less nodes present in the network, then there will be a delay in the network. Offloading time by multiple nodes is not considered. If there are less nodes used in the network, then the delay will occur [60, 61].The authors in [38] used the Skippy technique. The server is less used in the network that provides all resources to offload the task in the network, and Skippy helps serverless do this. A large amount of data is able to be sent to the network by using serverless. If any unauthorized network hacks the data, then all large amounts of data will have been lost in the network. The data must be protected by using a password, and some keys so a large amount of data will be safe.In [39], the authors used the pervasive technique. Pervasive helps the compute provide all resources to the nodes to offload their task. If any unauthorized user hacks the data, then it will give the wrong information and data to the users.In [40], the authors used load balancing (virtual machines) Apache JMeter (Tool). The majority of MCC do not consider cost factors. For multiple users, one virtual machine architecture is most suitable. The time to execute a task increases by 23 times while the resource utilization decreases by two-third. Execution time is more for projected architecture [51].In [41], the authors discussed that today, the Internet is too common, while using Internet security is also needed to offload tasks from the Internet, download anything from the Internet, and so on. Also, information on the Internet must be secure so that the user can access it at any time and access it without delay.AES is a part of the block symmetric cipher. AES provides the facility for MEC to offload the message in the network by using nodes. AES also provides the facility to encrypt and decrypt the data in the network without creating any delay in the network. AES has the ability to use different keys such as 128, 192, and 256 bits. Each bit has different features [42]. AES is required in every field where security is needed. AES provides the encryption and decryption of data from one field to the other field easily and without delay in the network [62].In paper [44], cloud computing provides the security to the user to offload tasks in the network. AES provides the facility of encryption and decryption in the cloud computing network. AES provides the facility of security to the network to exchange information without any delay [43]. As today the Internet is too common, while using the Internet, security is also needed to offload tasks from the Internet, download anything from the Internet, and so on. Also, information on the Internet must be secure so that the user can access it at any time and access it without delay [41]. AES divides the task into two portions, that is, one is the offloadable and the other is the un-offloadable program so the offloadable task can be offloaded easily in the network without any delay. AES provides some security and divides tasks into the un-offloadable task so the task can easily offload in the network without delay [45]. AES provides the security to the users to offload tasks in the network without any interference from a virus or delay in the network. AES helps the user provide antivirus to the user so the virus will not attack and destroy the user data and offload in the network without delay [46]. Edge computing became top popular as it removes the delay from the network while offloading data using the Internet. Also, it makes all Internet applications secure for offloading data. While offloading the data using the Internet, the drastic event that can happen is an attack by an attacker. Malicious attackers do the collision in the information present in the network. The collision in the information makes the information lost; thus, the data are lost and destroyed because of malicious attacks. These attacks happen due to the recovery of the secret key of AES [63]. All the internal collisions are detected by the AES, but the linear collision is not detected by the AES. S-box gives the output that talks about the collision happening internally [23].The issue with the proposals and techniques discussed above is that during the offloading process of the data from the Internet, there can be malicious attackers who can intervene in the communication and perform different kinds of attacks. To cope with these issues, we devise a mechanism through MEC that can help mitigate such attacks. Also, the response time, resource utilization, and fair usage of mobile devices are increased.


## 3. Our Contributions to the Field

Design and implementation of a novel task placement framework that does the following.(1)
Reduces response time of processing tasks,(2)
Un-usable resources become useful,(3)
Demand of mobile device will increase, and(4)
Usage of mobile resources as a replacement of cloud servers.


## 4. Problem Statement

When MEC requests to buy computer resources while executing a task, it faces a delay in request and response to and from MEC, so this delay increases time. Similarly, many mobile resources were being wasted by users despite having 4 to 8 GB RAM and 128 GB plus storage.In this section, we briefly state the three main problems to highlight the problem scenario and drawbacks that can occur due to these problems.


### 4.1. Problem I: Utilization of Mobile Idle Resources

MEC provides the facility of low delay rate, low cost, and high efficiency of offloading tasks in the network. So mobile resources can be used to make a local edge cloud for working in an efficient manner.


### 4.2. Problem II: Task Execution Delay

When MEC requests to buy computer resources while executing a task, it faces a delay in request and response to and from MEC and computer resources. This paper is basically solving a problem as per a scenario in which a user wants to process a huge amount of data at that time and users have mobile devices with either them or with their friends, so users can make the local cloud without having remote servers.The following research questions are formed from the above problems:(1)
Question 1: How to reduce the response time of processing by making an edge instead of waiting for a single device?(2)
Question 2: How to save wastage of resources on mobile, and how will they be utilized in a timely and effective manner?


## 4.1. Problem I: Utilization of Mobile Idle Resources

MEC provides the facility of low delay rate, low cost, and high efficiency of offloading tasks in the network. So mobile resources can be used to make a local edge cloud for working in an efficient manner.


## 4.2. Problem II: Task Execution Delay

When MEC requests to buy computer resources while executing a task, it faces a delay in request and response to and from MEC and computer resources. This paper is basically solving a problem as per a scenario in which a user wants to process a huge amount of data at that time and users have mobile devices with either them or with their friends, so users can make the local cloud without having remote servers.The following research questions are formed from the above problems:(1)
Question 1: How to reduce the response time of processing by making an edge instead of waiting for a single device?(2)
Question 2: How to save wastage of resources on mobile, and how will they be utilized in a timely and effective manner?


## 5. Proposed Solution

The particle swarm optimization technique is used and modified according to MEC requirements to gain efficiency by finding the optimal nodes, which will be used in the MEC. To find the best node, we will check its previous record of connecting time delay and its distance from its master device. We will provide a list of nodes to the swarm algorithm, and it will compare the first node with other nodes and will place the node having less connecting time and a short distance from the master device. At the first index, the comparison will continue till we sequence the list in the best node in ascending order in the FCFS list position. So we will have the best device and the best mobile edge for task execution. To overcome the problem of time delay, it is better that the MEC server should remain connected with MEC clients so that the delay of connection would not appear when a task appears as MEC is already connected so it will start executing the task without having the connection delay. To overcome the problem of resource wastage, the solution is to use mobile resources if it is available and ready to use. MEC uses multiple mobiles to compute multiple complex tasks, which are nearly impossible to compute on a single device.This study aims to propose and implement a novel framework to cover challenges raised by application execution on resource-constrained devices. Two main tasks that the proposed solution is performing are task allocation and task execution. Breakdowns of these tasks are given below.


### 5.1. Task Allocation

(1)
Secured resource discovery of mobile devices for connecting to edge servers(2)
Secured resource allocation algorithms used for checking device capability (whether the device is capable of executing the task); optimization methods will be used(3)
Secured resource allocation algorithms used for making an effective offloading communication that will make sure that offloading resource communication is secure(4)
Transfer of data from a mobile device to the edge nodes


### 5.2. Task Execution

(1)
Scheduling of tasks at the edge nodes by the offloaded device(2)
Offloading of task by the offloaded device (sending task)(3)
Transfer of results back to the source mobile device(4)
Edge server that will gather results and perform integration of it


### 5.3. Flow Diagram

Figure1 shows the flow diagram of the scheme.Figure 1
Flowchart of optimized resource allocation in MEC.


### 5.4. Algorithms

Algorithms 1 and 2 represent problems I and II, while for optimization, we present Algorithm 3.Algorithm 1: Algorithm for problem I.
(1)
Buy Resources (Br), MEC Task (Mt)(2)
Input (Br)(3)
Output: {true}(4)
Input: {Mt}(5)
Calculate the MEC Task using ComputeTask (Mt) Send(6)
Result of MED(7)
Output {Result}


### 5.5. Implementation Steps

The following steps are performed while implementing the proposed solution:(1)
We will make a connection between offloader and offloadies devices using a nearby API and distribute the task in form of bytes. There are strategies such as P2P, P2Cluster, and others to create a connection among the devices. We will be using connection P2Star because it suits our scenario. P2Star will offload tasks in the local cloud more quickly than other connections strategies. Algorithms are used in this connection for making the handling of the offloading tasks better.(2)
After choosing a strategy, the offloader device will start discovering the offloadies, and offloadies will start advertising so that they are discoverable, and a connection can be established among the devices.(3)
Now as offloadies are discoverable, offloader will start connecting with the offloadies one by one and accept their connection of offloadies to work as a slave for the master device and to compute the task provided by the offloader devices and send back the results.(4)
After establishing the connection between the offloadies, these devices will send their specification information and available resource information so that the offloader can decide which devices are capable of serving the master device and which offloadies are not capable.(5)
After discovering the ability of devices on the basis of RAM, CPU, battery, and available RAM, the offloader will filter the devices and ignore the rest of the devices [56].(6)
Now, the offloader will split the task into a number of available devices and send the task to available devices for the sake of processing. In our case, the task is image processing; however, it also depends upon the application requirements of the user [64–66].(7)
The offloadies will process the image processing task on their end using the OpenCV library using their own power and processing power.(8)
After processing, each offloadies will send back the result to the offloader device, and the offloader will use that result for its own use.Algorithm 2: Algorithm for problem II. Connection Request (Cr), Task (T),
(1)
Device RAM Memory (Rm), Result of Offloadies (Rs),(2)
Energy (E), FCaompatibleDevice () is a function in Android to check for RAM,(3)
Compatible Device (Cd), CPU, and Device minimum requirements.(4)
Input: (Cr)(5)
for each MEC Server do(6)
Output: {Rm, E, CPU}(7)
end for(7)
for each Device ddo(8)
Calculate the Compatibility check using FCompatibleDevice (), add the device to the Cd list(9)
end for(10)
for each Cd do(11)
Rs = Output {task}(12)
end forAlgorithm 3: Algorithm for optimization.
(1)
DL = device list, D = device, Nd = nearest devices, NCR = connection request of nearest device, CD = compatible device, and T = task(2)
input {DL}(3)
for each DL do(4)
Calculate the distance of D(5)
ifD {i}.Distance < D{I + 1}.Distance then(6)
ND.add (D {i})(7)
end if(8)
if (i < DL.size() then(9)
Move to Step 3(10)
Output {ND}(11)
end if(12)
MES Input {NCR}(13)
end for(14)
for each ND do(15)
if ND {i}.ram>3 GB && ND {i}.CPU>2.4 GHz then(16)
CD.add (ND {i})(17)
end if(18)
ifi< CD.size() then(19)
Move to Step 9(20)
end if(21)
Output {CD}(22)
Input {T}(23)
Calculate Result using function Compute_Result ()(24)
Output {Result}(25)
end for


### 5.6. Main Function of Code in Kotlin Language

(i)
fun on ConnectionResult (endpointId: String?,(ii)
result: ConnectionResolution) {(iii)
when (result.getStatus ().getStatusCode ()) { ConnectionsStatusCodes.STATUS_OK-> {(iv)
var devices:SlaveDevices = ArrayList < SlaveDevices> var nearestDevices = ArrayList < SlaveDevices>(v)
var compatibleResources = ArrayList < SlaveDevices > devices.forEach (){(vi)
if (device[i].distance < device.[i + 1].distance&&device [i].communicationdelay < de vice.[i + 1].communicationdelay){(vii)
nearestDevices.add (device)}} nearestDevices.forEach {(viii)
if (nearestDevices [i].ram > 3 && nearestDevices [i].cpu > 24) { compatibleResources.add (nearestDevices)}}(ix)
var noofimages = 0; noofimages = imageList.size/compatibleResources.size compatibleResources.forEach {(x)
var list = imageList.subList (noofimages) imageList.removeAll (list) SendTask (list)}}(xi)
ConnectionsStatusCodes.STATUS_CONNECTION_REJECTED -> {} ConnectionsStatusCodes.STATUS_ERROR -> {}(xii)
else -> {}}}.


## 5.1. Task Allocation

(1)
Secured resource discovery of mobile devices for connecting to edge servers(2)
Secured resource allocation algorithms used for checking device capability (whether the device is capable of executing the task); optimization methods will be used(3)
Secured resource allocation algorithms used for making an effective offloading communication that will make sure that offloading resource communication is secure(4)
Transfer of data from a mobile device to the edge nodes


## 5.2. Task Execution

(1)
Scheduling of tasks at the edge nodes by the offloaded device(2)
Offloading of task by the offloaded device (sending task)(3)
Transfer of results back to the source mobile device(4)
Edge server that will gather results and perform integration of it


## 5.3. Flow Diagram

Figure1 shows the flow diagram of the scheme.Figure 1
Flowchart of optimized resource allocation in MEC.


## 5.4. Algorithms

Algorithms 1 and 2 represent problems I and II, while for optimization, we present Algorithm 3.Algorithm 1: Algorithm for problem I.
(1)
Buy Resources (Br), MEC Task (Mt)(2)
Input (Br)(3)
Output: {true}(4)
Input: {Mt}(5)
Calculate the MEC Task using ComputeTask (Mt) Send(6)
Result of MED(7)
Output {Result}


## 5.5. Implementation Steps

The following steps are performed while implementing the proposed solution:(1)
We will make a connection between offloader and offloadies devices using a nearby API and distribute the task in form of bytes. There are strategies such as P2P, P2Cluster, and others to create a connection among the devices. We will be using connection P2Star because it suits our scenario. P2Star will offload tasks in the local cloud more quickly than other connections strategies. Algorithms are used in this connection for making the handling of the offloading tasks better.(2)
After choosing a strategy, the offloader device will start discovering the offloadies, and offloadies will start advertising so that they are discoverable, and a connection can be established among the devices.(3)
Now as offloadies are discoverable, offloader will start connecting with the offloadies one by one and accept their connection of offloadies to work as a slave for the master device and to compute the task provided by the offloader devices and send back the results.(4)
After establishing the connection between the offloadies, these devices will send their specification information and available resource information so that the offloader can decide which devices are capable of serving the master device and which offloadies are not capable.(5)
After discovering the ability of devices on the basis of RAM, CPU, battery, and available RAM, the offloader will filter the devices and ignore the rest of the devices [56].(6)
Now, the offloader will split the task into a number of available devices and send the task to available devices for the sake of processing. In our case, the task is image processing; however, it also depends upon the application requirements of the user [64–66].(7)
The offloadies will process the image processing task on their end using the OpenCV library using their own power and processing power.(8)
After processing, each offloadies will send back the result to the offloader device, and the offloader will use that result for its own use.Algorithm 2: Algorithm for problem II. Connection Request (Cr), Task (T),
(1)
Device RAM Memory (Rm), Result of Offloadies (Rs),(2)
Energy (E), FCaompatibleDevice () is a function in Android to check for RAM,(3)
Compatible Device (Cd), CPU, and Device minimum requirements.(4)
Input: (Cr)(5)
for each MEC Server do(6)
Output: {Rm, E, CPU}(7)
end for(7)
for each Device ddo(8)
Calculate the Compatibility check using FCompatibleDevice (), add the device to the Cd list(9)
end for(10)
for each Cd do(11)
Rs = Output {task}(12)
end forAlgorithm 3: Algorithm for optimization.
(1)
DL = device list, D = device, Nd = nearest devices, NCR = connection request of nearest device, CD = compatible device, and T = task(2)
input {DL}(3)
for each DL do(4)
Calculate the distance of D(5)
ifD {i}.Distance < D{I + 1}.Distance then(6)
ND.add (D {i})(7)
end if(8)
if (i < DL.size() then(9)
Move to Step 3(10)
Output {ND}(11)
end if(12)
MES Input {NCR}(13)
end for(14)
for each ND do(15)
if ND {i}.ram>3 GB && ND {i}.CPU>2.4 GHz then(16)
CD.add (ND {i})(17)
end if(18)
ifi< CD.size() then(19)
Move to Step 9(20)
end if(21)
Output {CD}(22)
Input {T}(23)
Calculate Result using function Compute_Result ()(24)
Output {Result}(25)
end for


## 5.6. Main Function of Code in Kotlin Language

(i)
fun on ConnectionResult (endpointId: String?,(ii)
result: ConnectionResolution) {(iii)
when (result.getStatus ().getStatusCode ()) { ConnectionsStatusCodes.STATUS_OK-> {(iv)
var devices:SlaveDevices = ArrayList < SlaveDevices> var nearestDevices = ArrayList < SlaveDevices>(v)
var compatibleResources = ArrayList < SlaveDevices > devices.forEach (){(vi)
if (device[i].distance < device.[i + 1].distance&&device [i].communicationdelay < de vice.[i + 1].communicationdelay){(vii)
nearestDevices.add (device)}} nearestDevices.forEach {(viii)
if (nearestDevices [i].ram > 3 && nearestDevices [i].cpu > 24) { compatibleResources.add (nearestDevices)}}(ix)
var noofimages = 0; noofimages = imageList.size/compatibleResources.size compatibleResources.forEach {(x)
var list = imageList.subList (noofimages) imageList.removeAll (list) SendTask (list)}}(xi)
ConnectionsStatusCodes.STATUS_CONNECTION_REJECTED -> {} ConnectionsStatusCodes.STATUS_ERROR -> {}(xii)
else -> {}}}.


## 6. Simulation and Results

This section thoroughly describes the equations, simulation, and results of the study.


### 6.1. Equations

The following generalized equations are formed:(1)Rs,t=Rc,t+Us,t,where Rs,t is reserved resources of server at t-th time location, Rc,t is reserved resources of the client at t-th time location, and Uc,t is unused resources of the clients at t-th time location.(2)Rs,t=Rc,t+UWc,t,where Rs,t is reserved resources of server at t-th time location, Rc,t is reserved resources of the client at t-th time location, and UWc,t. is unused-wholesaled resources of clients at t-th time location.(3)Rs,t′=Rc,t′+UBc,t′,where Rs,t is reserved resources of server at k-th time location, Rc,t is reserved resources of the client at k-th time location, and U B is unused-buyback resources of clients at the k time locationEquations (1)–(3) show the generalized working of the proposed solution by seeing results that total resource utilization occurred in this pattern, while the following equation is showing the total time that is consumed in executing a task:(4)Time=CD+TsDLRAM CPU,where total consumption time for all tasks = T T, communication delay = CD, tasks list = Ts, and number of devices = DL.


### 6.2. Results without Optimization

It can be seen in Table 3 that without optimization the time consumption is 4 seconds for a task. It is due to the lack of a particle swarm algorithm. Also, the CPU percentage is high with relatively high memory in use. Table3 represents the results without optimization.Table 3
Results without optimization.
Device numberNumber of imagesTime (seconds)Memory (MB)CPU percentage (%)Network (Kb)Energy1245470Light medium322.5303.50Light lowN2N + 1.5


### 6.3. Results of Proposed Solution (after Optimization)

Previously, time consumption was 4 seconds for a task, and now after optimization, 1 second decreases because we have chosen the device, which is nearest by applying the particle swarm algorithm. Similarly, for three devices, the time was 2.5 previously, and now, it is 1.5 seconds. The memory usage also decreased. While CPU consumption previously in 1 device was 7%, after optimization, it is 2%, and for 3 devices, it is 3.5%, and after optimization, it is 2.5%. Table4 presents the results of the proposed solution after optimization.Table 4
Results of the proposed solution (after optimization).
Device numberNumber of imagesTime (seconds)Memory (MB)CPU percentage (%)Network (Kb)Energy1233220Light low321.5202.50Light lowN2N


### 6.4. Simulation Results

In Figures2–4, simulation results are clearly showing that the results without optimization are improved by applying optimization techniques of particle swarm. Moreover, adding a greater number of devices improved the results significantly.Figure 2
Results without optimization.Figure 3
Results after applying optimization with three devices.Figure 4
Results after applying optimization with one device.


## 6.1. Equations

The following generalized equations are formed:(1)Rs,t=Rc,t+Us,t,where Rs,t is reserved resources of server at t-th time location, Rc,t is reserved resources of the client at t-th time location, and Uc,t is unused resources of the clients at t-th time location.(2)Rs,t=Rc,t+UWc,t,where Rs,t is reserved resources of server at t-th time location, Rc,t is reserved resources of the client at t-th time location, and UWc,t. is unused-wholesaled resources of clients at t-th time location.(3)Rs,t′=Rc,t′+UBc,t′,where Rs,t is reserved resources of server at k-th time location, Rc,t is reserved resources of the client at k-th time location, and U B is unused-buyback resources of clients at the k time locationEquations (1)–(3) show the generalized working of the proposed solution by seeing results that total resource utilization occurred in this pattern, while the following equation is showing the total time that is consumed in executing a task:(4)Time=CD+TsDLRAM CPU,where total consumption time for all tasks = T T, communication delay = CD, tasks list = Ts, and number of devices = DL.


## 6.2. Results without Optimization

It can be seen in Table 3 that without optimization the time consumption is 4 seconds for a task. It is due to the lack of a particle swarm algorithm. Also, the CPU percentage is high with relatively high memory in use. Table3 represents the results without optimization.Table 3
Results without optimization.
Device numberNumber of imagesTime (seconds)Memory (MB)CPU percentage (%)Network (Kb)Energy1245470Light medium322.5303.50Light lowN2N + 1.5


## 6.3. Results of Proposed Solution (after Optimization)

Previously, time consumption was 4 seconds for a task, and now after optimization, 1 second decreases because we have chosen the device, which is nearest by applying the particle swarm algorithm. Similarly, for three devices, the time was 2.5 previously, and now, it is 1.5 seconds. The memory usage also decreased. While CPU consumption previously in 1 device was 7%, after optimization, it is 2%, and for 3 devices, it is 3.5%, and after optimization, it is 2.5%. Table4 presents the results of the proposed solution after optimization.Table 4
Results of the proposed solution (after optimization).
Device numberNumber of imagesTime (seconds)Memory (MB)CPU percentage (%)Network (Kb)Energy1233220Light low321.5202.50Light lowN2N


## 6.4. Simulation Results

In Figures2–4, simulation results are clearly showing that the results without optimization are improved by applying optimization techniques of particle swarm. Moreover, adding a greater number of devices improved the results significantly.Figure 2
Results without optimization.Figure 3
Results after applying optimization with three devices.Figure 4
Results after applying optimization with one device.


## 7. Conclusion and Future Work

Hence, it is concluded that in this paper, selection of optimized resources and then their allocation in mobile edge computing decreased time, energy, and memory while executing tasks. These tasks if executed on a single device can increase these resources in a linear order. Complex and tedious tasks can easily be executed by making a mobile edge, and resources can be utilized in a better way. Edge can reduce consumption delay (CD) by addingN number of devices, which will improve the utilization of resources and will ensure the quality of service. Mobile edge shares resources to other edges by wholesale (sending resources) and buyback (receiving resources) scheme. In the future, wholesale and buyback resources from edge-to-edge servers will be used for profit maximization. Experimentation research techniques will be used to optimize resource allocation between two MECs, and algorithms will be designed for optimal memory, CPU, time, and power consumption between two MECs. Besides this, mobile edge computing has still faced a lot of challenges, and these are mobility management, heterogeneity, price, scalability, and security. We will also work on these mentioned sides in the future.



---

*Source: 9952993-2022-08-21.xml*