Reliability Enhancement of Edge Computing Paradigm Using Agreement

Driven by the vision of the Internet of Things (IoT), there has been a dramatic shift in mobile computing in recent years from centralized mobile cloud computing (MCC) to mobile edge computing (MEC). The main features of MECs are to promote mobile computing, network control, and storage to the edge of the network in order to achieve computationally intensive and latency-critical applications on resource-constrained mobile devices. Therefore, MEC is proposed to enable computing directly at the edge of the network, which can deliver new applications and services, especially for the IoT. In order to provide a highly flexible and reliable platform for the IoT, a MEC-based IoT platform (MIoT) is proposed in this study. Through the MIoT, the information asymmetrical symmetry between the consumer and producer can be reduced to a certain extent. Because of the IoT platform, fault tolerance is an important research topic. In order to deal with the impact of a faulty component, it is important to reach an agreement in the event of a failure before performing certain special tasks. For example, the initial time of all devices and the time stamp of all applications should be the same in a smart city before further processing. However, previous protocols for distributed computing were not sufficient for MIoT. Therefore, in this study, a new polynomial time and optimal algorithm is proposed to revisit the agreement problem. The algorithm makes all fault-free nodes decide on the same initial value with minimal rounds of message exchanges and tolerate the maximal number of allowable faulty components in the MIoT.


Introduction
The Internet of Things (IoT) paradigm is based on intelligent self-configuring nodes (things) that are interconnected in a dynamic and global network infrastructure. The IoT can provide many applications, including electronic commerce, smart home, smart city, and intelligent transportation system. The IoT has promoted interaction between people and smart cities, infrastructure, and services that improve the quality of life. It enables ubiquitous pervasive computing scenarios. The IoT typically features small, real-world things, limited storage and processing capabilities, and related issues related to reliability, performance, security, and privacy [1]. Since cloud computing (CC) has virtually unlimited capacity in terms of storage and processing power, most IoT issues are at least partially solved. Therefore, the IT paradigm that combines the two technologies of cloud and IoT can provide current and future Internet.
Moreover, high battery consumption still poses a significant obstacle, restricting the use of highly demanding applications [8]. This motivates development of the MCC concept, allowing CC for mobile users [9]. In MCC, user equipment (UE) can utilize powerful remote centralized CC and storage resources that are accessible through the mobile operator's core network and the Internet. However, in terms of network topology, the MCC, because it is far away from the user, imposes a huge extra load on the radio and backhaul of the mobile network, and has a high latency due to the data being sent to a powerful server farm.
In order to solve the problem of long latency, the cloud services should be moved to the vicinity of the UEs, i.e., to the edge of the mobile network, such as edge computing [8]. Edge computing can be understood as a special case of MCC. However, in the conventional MCC, the cloud service is accessed through the Internet connection; in the case of edge computing, it is assumed that the computing/storage resources are near the UEs. Therefore, compared with MCC, MEC can provide significantly lower latencies and jitter. Moreover, while the MCC is a completely centralized approach, the farm of computers is usually placed in one or several locations, and edge computing should be deployed in a fully distributed manner. On the other hand, edge computing provides only limited computing and storage resources relative to MCC.
The MEC brings many benefits to all stakeholders such as mobile operators, service providers, and users. As described in [9], MEC can distinguish between three major categories of use cases, including consumer-oriented services, operator and third party services, and network performance and QoE (Quality of Experience) improvement services, depending on the subjects that can benefit from them. An example of the use cases and scenarios for the MEC is shown in Figure 1 [9]. A novel architecture of MEC is proposed by Roman et al. [3], as shown in Figure 2. There are three basic components to the architecture: 1) Edge devices include all types of mobile devices (UEs) connected to the Internet; 2) Edge cloud is the less resourceful cloud deployed in each of the mobile base station. Edge cloud is responsible for traditional network traffic control, including forwarding and filtering, as well as hosting a variety of mobile edge applications such as edge health care, smart tracking, and more; 3) Public cloud is the cloud infrastructure hosted in the Internet. The prime objectives of MEC are [3]: A novel architecture of MEC is proposed by Roman et al. [3], as shown in Figure 2. There are three basic components to the architecture: (1) Edge devices include all types of mobile devices (UEs) Symmetry 2019, 11, 167 4 of 17 connected to the Internet; (2) Edge cloud is the less resourceful cloud deployed in each of the mobile base station. Edge cloud is responsible for traditional network traffic control, including forwarding and filtering, as well as hosting a variety of mobile edge applications such as edge health care, smart tracking, and more; (3) Public cloud is the cloud infrastructure hosted in the Internet. The prime objectives of MEC are [3]: (1) Optimization of mobile resources by hosting compute intensive application at the edge network.
(2) Optimization of the large data before sending to the cloud. With the advancement and development of various information technologies, computing problem have become larger and more complex [4]. The CC environment allows users to access Internet application more quickly. Most CC infrastructures include reliable services provided through data centers and are bui on servers with different levels of virtualization technologies [10]. As long as users can access the networ infrastructure, users can access these services. Commercial offerings must meet the quality of servic requirements of customers, and typically offer service-level agreements [4]. Therefore, a distributed system must have high stability to handle instances where many users utilize a given environment. In this section the proposed IoT platform is discussed.
In order to provide a highly flexible and reliable platform of IoT, a MEC-based IoT platform (MIoT) i proposed in this study. The topology of MIoT is shown in Figure 3. There are two layers in the MIoT MEC-layer and CC-layer. The MEC-layer is constructed by a set of MEC clusters; each MEC cluster i composed of a large number of MEC servers (MEC nodes), responsible for the processing of specifi information and judgments. The CC-layer is made up of many cloud nodes, which provide cloud users services. In the MIoT environment, through the combination of a large number of mobile devices (UEs various types of data can be collected and a wide range of services can be provided. With the advancement and development of various information technologies, computing problems have become larger and more complex [4]. The CC environment allows users to access Internet applications more quickly. Most CC infrastructures include reliable services provided through data centers and are built on servers with different levels of virtualization technologies [10]. As long as users can access the network infrastructure, users can access these services. Commercial offerings must meet the quality of service requirements of customers, and typically offer service-level agreements [4]. Therefore, a distributed system must have high stability to handle instances where many users utilize a given environment. In this section, the proposed IoT platform is discussed. In order to provide a highly flexible and reliable platform of IoT, a MEC-based IoT platform (MIoT) is proposed in this study. The topology of MIoT is shown in Figure 3. There are two layers in the MIoT: MEC-layer and CC-layer. The MEC-layer is constructed by a set of MEC clusters; each MEC cluster is composed of a large number of MEC servers (MEC nodes), responsible for the processing of specific information and judgments. The CC-layer is made up of many cloud nodes, which provide cloud users' services. In the MIoT environment, through the combination of a large number of mobile devices (UEs), various types of data can be collected and a wide range of services can be provided.
In short, MIoT is proposed by the MEC, where data can be analyzed and processed by the MEC-layer instead of being centralized in the CC. By coordinating and managing the computing and storage resources at the edge of the network, more and more connected devices and the emerging needs of IoT can be processed by the MEC. When the technological requirements and constraints of the IoT applications are properly fulfilled, it is up to the platform designer to decide whether an endpoint should be served by the CC, the MEC, or an adequate combination of the two at any given time during the service lifetime. Based on the above characteristics, the MEC can serve as a suitable platform for providing key services and applications for the IoT, including connecting vehicles, smart cities, and shopping centers. requirements of customers, and typically offer service-level agreements [4]. Therefore, a distributed system must have high stability to handle instances where many users utilize a given environment. In this section, the proposed IoT platform is discussed.
In order to provide a highly flexible and reliable platform of IoT, a MEC-based IoT platform (MIoT) is proposed in this study. The topology of MIoT is shown in Figure 3. There are two layers in the MIoT: MEC-layer and CC-layer. The MEC-layer is constructed by a set of MEC clusters; each MEC cluster is composed of a large number of MEC servers (MEC nodes), responsible for the processing of specific information and judgments. The CC-layer is made up of many cloud nodes, which provide cloud users' services. In the MIoT environment, through the combination of a large number of mobile devices (UEs), various types of data can be collected and a wide range of services can be provided. In short, MIoT is proposed by the MEC, where data can be analyzed and processed by the MEC-layer instead of being centralized in the CC. By coordinating and managing the computing and storage resources at the edge of the network, more and more connected devices and the emerging needs of IoT can be processed by the MEC. When the technological requirements and constraints of the IoT applications are properly fulfilled, it is up to the platform designer to decide whether an endpoint should be served by the CC, the MEC, or an adequate combination of the two at any given time during the service lifetime. Based on the above characteristics, the MEC can serve as a suitable platform for providing key services and applications for the IoT, including connecting vehicles, smart cities, and shopping centers. Recently, the Intelligent Transportation System (ITS) has become increasingly popular in many countries. When the traffic control system of ITS is constructed by MIoT, connecting vehicles are used to get the data required by the ITS [11]. The MEC-layer is used to capture the traffic status of each intersection. The CC-layer is used as a traffic control center. An example of the traffic control system constructed by MIoT is shown in Figure 4. Recently, the Intelligent Transportation System (ITS) has become increasingly popular in many countries. When the traffic control system of ITS is constructed by MIoT, connecting vehicles are used to get the data required by the ITS [11]. The MEC-layer is used to capture the traffic status of each intersection. The CC-layer is used as a traffic control center. An example of the traffic control system constructed by MIoT is shown in Figure 4.

Agreement Problems.
In an IoT environment, a mechanism to allow a given set of nodes to agree on a common value, such as the initial time and the time stamp, is necessary for a reliable smart city [12][13]. Such a unanimity problem is called an agreement problem [14]. It requires a number of independent nodes to reach agreement in cases where some of those nodes might be faulty. Namely, the goal of agreement is making the fault-free nodes reach a common value. There are three kinds of agreement issues, Byzantine agreement [6,15], consensus [16], and interaction consistency (IC) [17][18] (Wang et al., 2018). In our study, the consensus problem of the MEC-layer and the IC problem of the CC-layer in MIoT will be explored separately.
The consensus problem is defined by Meyer and Pradhan [16]. The solutions to the consensus problem are defined as protocols that achieve a consensus and use the minimum number of rounds of message exchanges to achieve the maximum number of allowable faulty nodes. In this study, the solution to the consensus problem involves the MEC-layer of MIoT. The idea is to make the fault-free MEC nodes in the MEC-layer of MIoT reach a consensus. Each MEC node of the MEC-layer chooses an initial value to start with, and they communicate with each other by exchanging messages. The MEC nodes are understood to have reached a consensus if the following conditions are satisfied [16]: Consensus: All fault-free MEC nodes agree on a common value.

Validity:
If the initial value of each fault-free MEC node ni is vi then all fault-free MEC nodes shall agree on the value vi. A closely related sub-problem, the interactive consistency problem (IC problem) has been studied extensively [17][18] (Wang et al., 2018). In this study, the solution to the IC problem involves the CC-layer of MIoT. The idea of IC is to make the fault-free cloud nodes in the CC-layer reach interactive consistency. Each

Agreement Problems
In an IoT environment, a mechanism to allow a given set of nodes to agree on a common value, such as the initial time and the time stamp, is necessary for a reliable smart city [12,13]. Such a unanimity problem is called an agreement problem [14]. It requires a number of independent nodes to reach agreement in cases where some of those nodes might be faulty. Namely, the goal of agreement is making the fault-free nodes reach a common value. There are three kinds of agreement issues, Byzantine agreement [6,15], consensus [16], and interaction consistency (IC) [17,18] (Wang et al., 2018). In our study, the consensus problem of the MEC-layer and the IC problem of the CC-layer in MIoT will be explored separately.
The consensus problem is defined by Meyer and Pradhan [16]. The solutions to the consensus problem are defined as protocols that achieve a consensus and use the minimum number of rounds of message exchanges to achieve the maximum number of allowable faulty nodes. In this study, the solution to the consensus problem involves the MEC-layer of MIoT. The idea is to make the fault-free MEC nodes in the MEC-layer of MIoT reach a consensus. Each MEC node of the MEC-layer chooses an initial value to start with, and they communicate with each other by exchanging messages. The MEC nodes are understood to have reached a consensus if the following conditions are satisfied [16]:

Consensus:
All fault-free MEC nodes agree on a common value.

Validity:
If the initial value of each fault-free MEC node n i is v i then all fault-free MEC nodes shall agree on the value v i .
A closely related sub-problem, the interactive consistency problem (IC problem) has been studied extensively [17,18] (Wang et al., 2018). In this study, the solution to the IC problem involves the CC-layer of MIoT. The idea of IC is to make the fault-free cloud nodes in the CC-layer reach interactive consistency. Each cloud node chooses an initial value and communicates with the others by exchanging messages. There is interactive consistency in that each cloud node i has its initial value v i and agrees on a set of common values. Therefore, interactive consistency has been achieved if the following conditions are met [17,18]: Consistency: Each fault-free cloud node agrees on a set of common values V = [v 1 , v 2 , . . . , v n ].

Validity:
If the initial value of fault-free cloud node i is v i , then the i-th value in the common vector V should be v i .
The IoT environment is an Internet-based development. It is a style of computing in which dynamically scalable and often virtualized resources are provided as a service over the Internet. Nevertheless, in an IoT environment, the connected topology is not very significant. In this study, the consensus problem is to be solved on the MEC-layer and the IC problem is to be solved on the CC-layer of the proposed MIoT platform. In addition, the proposed algorithm MECAA can use a minimum number of message exchanges and can tolerate a maximum number of allowable faulty components to make each fault-free node reach an agreement in cases of node failure. Due to agreement being a purely mathematical problem, the correctness of all previous research is proven by mathematical methods [14][15][16][17][18][19][20][21]. The proposed polynomial time algorithm is a static and exact algorithm; a mathematical proof is provided to illustrate the correctness and time complexity in this study. Theoretical analysis of algorithms for Byzantine Agreement can provide insight into their efficiency.

Failure Types
In a distributed system, the network components may not always work well. A node is said to be fault-free if it follows algorithm specifications during the execution of an algorithm; otherwise, the node is said to be faulty.
The symptoms of node failure can be classified into two categories. There are dormant faults and malicious faults [15]. Dormant faults of nodes include crashes and omissions. A crash fault occurs when the node is damaged. Omission faults occur when nodes cannot send or receive messages on time or at all. In the event of a malicious failure, the behavior of the faulty node is unpredictable and arbitrary. The message transmitted by the malicious faulty node is random or arbitrary. This is the most destructive type of failure and leads to the most serious problems. If the agreement problem can be resolved in the case of a malicious fault, then the agreement problem can also be resolved in other failure modes.

The Proposed Protocol
In this study, the agreement problem is discussed in the proposed MIoT platform; no delay of nodes or communication media is included in our discussion. Therefore, the nodes executing our new algorithm should receive messages from other nodes within a predictable period of time. If the message is not received on time, the message must have been influenced by faulty components.
In the agreement problem, the number of faulty components allowed is determined by the total number of nodes. In Lamport et al.'s algorithm [15], the constraint is n > 3f, where n is the number of nodes and f is the total number of allowable malicious faulty nodes in the distributed system. In this research, MECAA is used to solve the agreement problem in MIoT with malicious fallible nodes. With consideration for efficient agreement, the UEs of MIoT is used to request the specific IoT application, the procedure Consensus is applied to the MEC nodes of the MEC-layer, and the procedure Interactive Consistency is applied to each cloud node in the CC-layer.
Therefore, the constraints of the MECAA are as follows.
• (Constraint of MEC-layer): n Ej > parameters of Agreement include σ, vs, and nA, where σ is the required rounds, vs is the number of nodes participating in the agreement. In order for all fault-free nodes node must collect enough exchanged messages from all other nodes if they ar exchanging the received values helps fault-free nodes to collect enough exchanged m Fischer and Lynch proved that (n-1)/3+1 is the rounds of message exchan agreement problem, where n is the number of nodes in the underlying network [17 of Fischer and Lynch, (n-1)/3+1 rounds of message exchanges are the lowe agreement problem. Therefore, the required rounds σ is (nEj-1)/3+1 when MEC n Agreement of procedure Consensus, where nEj is the number of MEC nodes in MEC cl nEj>3. Moreover, the required rounds σ is (nC-1)/3+1 when cloud nodes execute procedure Interactive Consistency, where nC is the number of cloud nodes in the CC-l

 
The received messages of Request Gathering Step are stored in a tr request-gathering tree (rg-tree), which is similar to that proposed by Bar-Noy et al. maintains such an rg-tree during the execution of MECAA. In the first round of t node i transmits its initial request to other nodes. However, that each receiver nod sender of a request is assumed. When a fault-free node receives the request sent received value, denoted as req(i), at the root of its rg-tree. In the second round, eac value of its rg-tree to all other nodes. If node 1 sends request req(i) to node 2, then n request, denoted as req(i1), in vertex i1 of its rg-tree. Similarly, if node 2 sends req received request is named req(i12) and stored in vertex i12 of node 1's rg-tree in th request req(i12…n), stored in the vertex i12…n of a rg-tree, implies that the reque through the node i, the node 1,…, the node n; and the node n is the latest node to request is transmitted through a node more than once, the name of the node w instance, request req (11), stored in vertex 11, indicates that the request is sent to nod therefore, name 1 appears twice in vertex name 11. In summary, the root of rg-tree is that the stored request is sent from node i in the first round; the vertex of an rg-tree names. The node name list contains the names of the nodes through which the store Figure 6 shows an example of rg-tree.
(n Ej − 1)/3 parameters of Agreement include σ, vs, and nA, where σ is the required r the number of nodes participating in the agreement. In order for all fau node must collect enough exchanged messages from all other nod exchanging the received values helps fault-free nodes to collect enough Fischer and Lynch proved that (n-1)/3+1 is the rounds of mes agreement problem, where n is the number of nodes in the underlying of Fischer and Lynch, (n-1)/3+1 rounds of message exchanges a agreement problem. Therefore, the required rounds σ is (nEj-1)/3+1 w Agreement of procedure Consensus, where nEj is the number of MEC nod nEj>3. Moreover, the required rounds σ is (nC-1)/3+1 when cloud no procedure Interactive Consistency, where nC is the number of cloud node

 
The received messages of Request Gathering Step are store request-gathering tree (rg-tree), which is similar to that proposed by B maintains such an rg-tree during the execution of MECAA. In the firs node i transmits its initial request to other nodes. However, that each sender of a request is assumed. When a fault-free node receives the r received value, denoted as req(i), at the root of its rg-tree. In the secon value of its rg-tree to all other nodes. If node 1 sends request req(i) to n request, denoted as req(i1), in vertex i1 of its rg-tree. Similarly, if node received request is named req(i12) and stored in vertex i12 of node 1's request req(i12…n), stored in the vertex i12…n of a rg-tree, implies th through the node i, the node 1,…, the node n; and the node n is the la request is transmitted through a node more than once, the name of instance, request req (11), stored in vertex 11, indicates that the request therefore, name 1 appears twice in vertex name 11. In summary, the roo that the stored request is sent from node i in the first round; the vertex names. The node name list contains the names of the nodes through wh Figure 6 shows an example of rg-tree. + 2f mEj where n Ej is the number of MEC nodes and f mEj is the total number of allowable malicious faulty MEC nodes in MEC cluster E j of the MEC-layer. This constraint specifies the number of MEC nodes required in MEC cluster E j .
• (Constraint of CC-layer): The (Constraint of CC-layer) is similar to the (Constraint of MEC-layer) in that n C > MECAA is initiated by the UEs to ask for a specific application service. The nodes of MEC-layer ne execute procedure Consensus and the nodes of CC-layer need to execute procedure Interactive Consistenc procedures Consensus and Interactive Consistency, the function Agreement will be called up. There are steps of function Agreement, one is the Request Gathering Step, and the other is the Request Deciding Step parameters of Agreement include σ, vs, and nA, where σ is the required rounds, vs is the initial value, and the number of nodes participating in the agreement. In order for all fault-free nodes to reach agreement, node must collect enough exchanged messages from all other nodes if they are fault-free. As a re exchanging the received values helps fault-free nodes to collect enough exchanged messages.
Fischer and Lynch proved that (n-1)/3+1 is the rounds of message exchanges sufficient to solv agreement problem, where n is the number of nodes in the underlying network [17][18]. Based on the w of Fischer and Lynch, (n-1)/3+1 rounds of message exchanges are the lower bound for solving agreement problem. Therefore, the required rounds σ is (nEj-1)/3+1 when MEC nodes execute the fun Agreement of procedure Consensus, where nEj is the number of MEC nodes in MEC cluster Ej of MEC-layer nEj>3. Moreover, the required rounds σ is (nC-1)/3+1 when cloud nodes execute the function Agreeme procedure Interactive Consistency, where nC is the number of cloud nodes in the CC-layer and nC>3.

 
The received messages of Request Gathering Step are stored in a tree structure called request-gathering tree (rg-tree), which is similar to that proposed by Bar-Noy et al. [19]. Each fault-free maintains such an rg-tree during the execution of MECAA. In the first round of the Request Gathering node i transmits its initial request to other nodes. However, that each receiver node can always identif sender of a request is assumed. When a fault-free node receives the request sent from node i, it store received value, denoted as req(i), at the root of its rg-tree. In the second round, each node transmits the value of its rg-tree to all other nodes. If node 1 sends request req(i) to node 2, then node 2 stores the rece request, denoted as req(i1), in vertex i1 of its rg-tree. Similarly, if node 2 sends request req(i1) to node 1 received request is named req(i12) and stored in vertex i12 of node 1's rg-tree in the third round. Gene request req(i12…n), stored in the vertex i12…n of a rg-tree, implies that the request just received was through the node i, the node 1,…, the node n; and the node n is the latest node to pass the request. Wh request is transmitted through a node more than once, the name of the node will also be repeated instance, request req (11), stored in vertex 11, indicates that the request is sent to node 1, then to node 1 a therefore, name 1 appears twice in vertex name 11. In summary, the root of rg-tree is always named i to de that the stored request is sent from node i in the first round; the vertex of an rg-tree is labeled by a list of names. The node name list contains the names of the nodes through which the stored request was transfe Figure 6 shows an example of rg-tree.
MECAA is initiated by the UEs to ask for a specific application service. The nodes of M execute procedure Consensus and the nodes of CC-layer need to execute procedure Interacti procedures Consensus and Interactive Consistency, the function Agreement will be called u steps of function Agreement, one is the Request Gathering Step, and the other is the Request D parameters of Agreement include σ, vs, and nA, where σ is the required rounds, vs is the initia the number of nodes participating in the agreement. In order for all fault-free nodes to reach node must collect enough exchanged messages from all other nodes if they are fault-f exchanging the received values helps fault-free nodes to collect enough exchanged messages Fischer and Lynch proved that (n-1)/3+1 is the rounds of message exchanges suffi agreement problem, where n is the number of nodes in the underlying network [17][18]. Ba of Fischer and Lynch, (n-1)/3+1 rounds of message exchanges are the lower bound agreement problem. Therefore, the required rounds σ is (nEj-1)/3+1 when MEC nodes exe Agreement of procedure Consensus, where nEj is the number of MEC nodes in MEC cluster Ej o nEj>3. Moreover, the required rounds σ is (nC-1)/3+1 when cloud nodes execute the func procedure Interactive Consistency, where nC is the number of cloud nodes in the CC-layer and

 
The received messages of Request Gathering Step are stored in a tree struc request-gathering tree (rg-tree), which is similar to that proposed by Bar-Noy et al. [19]. Eac maintains such an rg-tree during the execution of MECAA. In the first round of the Reque node i transmits its initial request to other nodes. However, that each receiver node can alw sender of a request is assumed. When a fault-free node receives the request sent from no received value, denoted as req(i), at the root of its rg-tree. In the second round, each node t value of its rg-tree to all other nodes. If node 1 sends request req(i) to node 2, then node 2 st request, denoted as req(i1), in vertex i1 of its rg-tree. Similarly, if node 2 sends request req( received request is named req(i12) and stored in vertex i12 of node 1's rg-tree in the third r request req(i12…n), stored in the vertex i12…n of a rg-tree, implies that the request just r through the node i, the node 1,…, the node n; and the node n is the latest node to pass the request is transmitted through a node more than once, the name of the node will also instance, request req (11), stored in vertex 11, indicates that the request is sent to node 1, then therefore, name 1 appears twice in vertex name 11. In summary, the root of rg-tree is always n that the stored request is sent from node i in the first round; the vertex of an rg-tree is labeled names. The node name list contains the names of the nodes through which the stored reques Figure 6 shows an example of rg-tree. + 2f mC where n C is the number of cloud nodes and f mC is the total number of allowable malicious faulty cloud nodes in the CC-layer.
(Constraint of MEC-layer) specifies the number of MEC nodes in MEC cluster E j of MEC-layer required; due to the unit of the MEC cluster E j of MEC-layer is MEC node, so that an agreement can be achieved if n Ej > MECAA is initiated by the UEs to ask for a specific application service. The nodes of MEC-layer nee execute procedure Consensus and the nodes of CC-layer need to execute procedure Interactive Consistenc procedures Consensus and Interactive Consistency, the function Agreement will be called up. There are steps of function Agreement, one is the Request Gathering Step, and the other is the Request Deciding Step. parameters of Agreement include σ, vs, and nA, where σ is the required rounds, vs is the initial value, and the number of nodes participating in the agreement. In order for all fault-free nodes to reach agreement, node must collect enough exchanged messages from all other nodes if they are fault-free. As a re exchanging the received values helps fault-free nodes to collect enough exchanged messages.
Fischer and Lynch proved that (n-1)/3+1 is the rounds of message exchanges sufficient to solv agreement problem, where n is the number of nodes in the underlying network [17][18]. Based on the w of Fischer and Lynch, (n-1)/3+1 rounds of message exchanges are the lower bound for solving agreement problem. Therefore, the required rounds σ is (nEj-1)/3+1 when MEC nodes execute the func Agreement of procedure Consensus, where nEj is the number of MEC nodes in MEC cluster Ej of MEC-layer nEj>3. Moreover, the required rounds σ is (nC-1)/3+1 when cloud nodes execute the function Agreemen procedure Interactive Consistency, where nC is the number of cloud nodes in the CC-layer and nC>3.

 
The received messages of Request Gathering Step are stored in a tree structure called request-gathering tree (rg-tree), which is similar to that proposed by Bar-Noy et al. [19]. Each fault-free n maintains such an rg-tree during the execution of MECAA. In the first round of the Request Gathering S node i transmits its initial request to other nodes. However, that each receiver node can always identify sender of a request is assumed. When a fault-free node receives the request sent from node i, it stores received value, denoted as req(i), at the root of its rg-tree. In the second round, each node transmits the value of its rg-tree to all other nodes. If node 1 sends request req(i) to node 2, then node 2 stores the rece request, denoted as req(i1), in vertex i1 of its rg-tree. Similarly, if node 2 sends request req(i1) to node 1 received request is named req(i12) and stored in vertex i12 of node 1's rg-tree in the third round. Gener request req(i12…n), stored in the vertex i12…n of a rg-tree, implies that the request just received was through the node i, the node 1,…, the node n; and the node n is the latest node to pass the request. Wh request is transmitted through a node more than once, the name of the node will also be repeated. instance, request req (11), stored in vertex 11, indicates that the request is sent to node 1, then to node 1 ag therefore, name 1 appears twice in vertex name 11. In summary, the root of rg-tree is always named i to de that the stored request is sent from node i in the first round; the vertex of an rg-tree is labeled by a list of n names. The node name list contains the names of the nodes through which the stored request was transfer Figure 6 shows an example of rg-tree.
(n Ej − 1)/3 MECAA is initiated by the UEs to ask for a specific application service. The nodes of M execute procedure Consensus and the nodes of CC-layer need to execute procedure Interactiv procedures Consensus and Interactive Consistency, the function Agreement will be called up steps of function Agreement, one is the Request Gathering Step, and the other is the Request D parameters of Agreement include σ, vs, and nA, where σ is the required rounds, vs is the initial the number of nodes participating in the agreement. In order for all fault-free nodes to reach node must collect enough exchanged messages from all other nodes if they are fault-fr exchanging the received values helps fault-free nodes to collect enough exchanged messages Fischer and Lynch proved that (n-1)/3+1 is the rounds of message exchanges suffic agreement problem, where n is the number of nodes in the underlying network [17][18]. Bas of Fischer and Lynch, (n-1)/3+1 rounds of message exchanges are the lower bound agreement problem. Therefore, the required rounds σ is (nEj-1)/3+1 when MEC nodes exec Agreement of procedure Consensus, where nEj is the number of MEC nodes in MEC cluster Ej o nEj>3. Moreover, the required rounds σ is (nC-1)/3+1 when cloud nodes execute the funct procedure Interactive Consistency, where nC is the number of cloud nodes in the CC-layer and

 
The received messages of Request Gathering Step are stored in a tree struct request-gathering tree (rg-tree), which is similar to that proposed by Bar-Noy et al. [19]. Eac maintains such an rg-tree during the execution of MECAA. In the first round of the Reques node i transmits its initial request to other nodes. However, that each receiver node can alw sender of a request is assumed. When a fault-free node receives the request sent from nod received value, denoted as req(i), at the root of its rg-tree. In the second round, each node tr value of its rg-tree to all other nodes. If node 1 sends request req(i) to node 2, then node 2 sto request, denoted as req(i1), in vertex i1 of its rg-tree. Similarly, if node 2 sends request req(i received request is named req(i12) and stored in vertex i12 of node 1's rg-tree in the third ro request req(i12…n), stored in the vertex i12…n of a rg-tree, implies that the request just re through the node i, the node 1,…, the node n; and the node n is the latest node to pass the request is transmitted through a node more than once, the name of the node will also b instance, request req (11), stored in vertex 11, indicates that the request is sent to node 1, then therefore, name 1 appears twice in vertex name 11. In summary, the root of rg-tree is always n that the stored request is sent from node i in the first round; the vertex of an rg-tree is labeled names. The node name list contains the names of the nodes through which the stored request Figure 6 shows an example of rg-tree. MECAA is initiated by the UEs to ask for a specific application service. The nodes of MEC-layer nee execute procedure Consensus and the nodes of CC-layer need to execute procedure Interactive Consistency procedures Consensus and Interactive Consistency, the function Agreement will be called up. There are steps of function Agreement, one is the Request Gathering Step, and the other is the Request Deciding Step. parameters of Agreement include σ, vs, and nA, where σ is the required rounds, vs is the initial value, and n the number of nodes participating in the agreement. In order for all fault-free nodes to reach agreement, e node must collect enough exchanged messages from all other nodes if they are fault-free. As a res exchanging the received values helps fault-free nodes to collect enough exchanged messages.
Fischer and Lynch proved that (n-1)/3+1 is the rounds of message exchanges sufficient to solve agreement problem, where n is the number of nodes in the underlying network [17][18]. Based on the wo of Fischer and Lynch, (n-1)/3+1 rounds of message exchanges are the lower bound for solving agreement problem. Therefore, the required rounds σ is (nEj-1)/3+1 when MEC nodes execute the func Agreement of procedure Consensus, where nEj is the number of MEC nodes in MEC cluster Ej of MEC-layer nEj>3. Moreover, the required rounds σ is (nC-1)/3+1 when cloud nodes execute the function Agreemen procedure Interactive Consistency, where nC is the number of cloud nodes in the CC-layer and nC>3.

 
The received messages of Request Gathering Step are stored in a tree structure called request-gathering tree (rg-tree), which is similar to that proposed by Bar-Noy et al. [19]. Each fault-free n maintains such an rg-tree during the execution of MECAA. In the first round of the Request Gathering S node i transmits its initial request to other nodes. However, that each receiver node can always identify sender of a request is assumed. When a fault-free node receives the request sent from node i, it stores received value, denoted as req(i), at the root of its rg-tree. In the second round, each node transmits the value of its rg-tree to all other nodes. If node 1 sends request req(i) to node 2, then node 2 stores the recei request, denoted as req(i1), in vertex i1 of its rg-tree. Similarly, if node 2 sends request req(i1) to node 1, received request is named req(i12) and stored in vertex i12 of node 1's rg-tree in the third round. Genera request req(i12…n), stored in the vertex i12…n of a rg-tree, implies that the request just received was through the node i, the node 1,…, the node n; and the node n is the latest node to pass the request. Whe request is transmitted through a node more than once, the name of the node will also be repeated. instance, request req (11), stored in vertex 11, indicates that the request is sent to node 1, then to node 1 ag therefore, name 1 appears twice in vertex name 11. In summary, the root of rg-tree is always named i to den that the stored request is sent from node i in the first round; the vertex of an rg-tree is labeled by a list of n names. The node name list contains the names of the nodes through which the stored request was transfer Figure 6 shows an example of rg-tree. MECAA is initiated by the UEs to ask for a specific application service. The nodes of ME execute procedure Consensus and the nodes of CC-layer need to execute procedure Interactive procedures Consensus and Interactive Consistency, the function Agreement will be called up steps of function Agreement, one is the Request Gathering Step, and the other is the Request De parameters of Agreement include σ, vs, and nA, where σ is the required rounds, vs is the initial the number of nodes participating in the agreement. In order for all fault-free nodes to reach a node must collect enough exchanged messages from all other nodes if they are fault-fre exchanging the received values helps fault-free nodes to collect enough exchanged messages.
Fischer and Lynch proved that (n-1)/3+1 is the rounds of message exchanges suffici agreement problem, where n is the number of nodes in the underlying network [17][18]. Base of Fischer and Lynch, (n-1)/3+1 rounds of message exchanges are the lower bound agreement problem. Therefore, the required rounds σ is (nEj-1)/3+1 when MEC nodes execu Agreement of procedure Consensus, where nEj is the number of MEC nodes in MEC cluster Ej of nEj>3. Moreover, the required rounds σ is (nC-1)/3+1 when cloud nodes execute the functio procedure Interactive Consistency, where nC is the number of cloud nodes in the CC-layer and n  

The received messages of Request Gathering
Step are stored in a tree structu request-gathering tree (rg-tree), which is similar to that proposed by Bar-Noy et al. [19]. Each maintains such an rg-tree during the execution of MECAA. In the first round of the Request node i transmits its initial request to other nodes. However, that each receiver node can alw sender of a request is assumed. When a fault-free node receives the request sent from nod received value, denoted as req(i), at the root of its rg-tree. In the second round, each node tra value of its rg-tree to all other nodes. If node 1 sends request req(i) to node 2, then node 2 sto request, denoted as req(i1), in vertex i1 of its rg-tree. Similarly, if node 2 sends request req(i1 received request is named req(i12) and stored in vertex i12 of node 1's rg-tree in the third ro request req(i12…n), stored in the vertex i12…n of a rg-tree, implies that the request just rec through the node i, the node 1,…, the node n; and the node n is the latest node to pass the r request is transmitted through a node more than once, the name of the node will also b instance, request req (11), stored in vertex 11, indicates that the request is sent to node 1, then therefore, name 1 appears twice in vertex name 11. In summary, the root of rg-tree is always na that the stored request is sent from node i in the first round; the vertex of an rg-tree is labeled names. The node name list contains the names of the nodes through which the stored request w Figure 6 shows an example of rg-tree.
In this study, MECAA is proposed to solve the agreement problem with fallible nodes underlying the MIoT platform. The proposed algorithm MECAA is divided into two parts based on the two layers of MIoT. The nodes of the MEC-layer execute procedure Consensus, and the nodes of the CC-layer execute procedure Interactive Consistency.
When UE makes a specific service request, the request for the specific application service is transferred to the corresponding MEC cluster of the MEC-layer. In procedure Consensus, the MEC node takes the majority value of the requests received from UEs firstly, and the majority value is used as the initial value (v i ) of MEC node to execute function Agreement. When the Consensus value of each MEC cluster is obtained, the value is represented as the result of a specific service. Finally, the Consensus value is transferred to the CC-layer. In procedure Interactive Consistency, the primary work of cloud nodes in the CC-layer is to collect the results of different specific services, and then the request vector of the interactive consistency can be obtained to provide an integrated service such as connecting vehicles, smart cities, and shopping centers. The progression steps of MECAA are shown in Figure 5. provide an integrated service such as connecting vehicles, smart cities, and shopping centers. The progression steps of MECAA are shown in Figure 5. MECAA is initiated by the UEs to ask for a specific application service. The nodes of MEC-layer need to execute procedure Consensus and the nodes of CC-layer need to execute procedure Interactive Consistency. In procedures Consensus and Interactive Consistency, the function Agreement will be called up. There are two steps of function Agreement, one is the Request Gathering Step, and the other is the Request Deciding Step. The parameters of Agreement include σ, vs, and nA, where σ is the required rounds, vs is the initial value, and nA is the number of nodes participating in the agreement. In order for all fault-free nodes to reach agreement, each node must collect enough exchanged messages from all other nodes if they are fault-free. As a result, exchanging the received values helps fault-free nodes to collect enough exchanged messages.
Fischer and Lynch proved that (n-1)/3+1 is the rounds of message exchanges sufficient to solve an MECAA is initiated by the UEs to ask for a specific application service. The nodes of MEC-layer need to execute procedure Consensus and the nodes of CC-layer need to execute procedure Interactive Consistency. In procedures Consensus and Interactive Consistency, the function Agreement will be called up. There are two steps of function Agreement, one is the Request Gathering Step, and the other is the Request Deciding Step. The parameters of Agreement include σ, v s , and n A , where σ is the required rounds, v s is the initial value, and n A is the number of nodes participating in the agreement. In order for all fault-free nodes to reach agreement, each node must collect enough exchanged messages from all other nodes if they are fault-free. As a result, exchanging the received values helps fault-free nodes to collect enough exchanged messages.
Fischer and Lynch proved that the number of nodes participating in the agreement. In order for all fault-free nodes to node must collect enough exchanged messages from all other nodes if they are exchanging the received values helps fault-free nodes to collect enough exchanged me Fischer and Lynch proved that (n-1)/3+1 is the rounds of message exchanges agreement problem, where n is the number of nodes in the underlying network [17-1 of Fischer and Lynch, (n-1)/3+1 rounds of message exchanges are the lower b agreement problem. Therefore, the required rounds σ is (nEj-1)/3+1 when MEC nod Agreement of procedure Consensus, where nEj is the number of MEC nodes in MEC clus nEj>3. Moreover, the required rounds σ is (nC-1)/3+1 when cloud nodes execute the procedure Interactive Consistency, where nC is the number of cloud nodes in the CC-lay

 
The received messages of Request Gathering Step are stored in a tree request-gathering tree (rg-tree), which is similar to that proposed by Bar-Noy et al. [1 maintains such an rg-tree during the execution of MECAA. In the first round of the node i transmits its initial request to other nodes. However, that each receiver node sender of a request is assumed. When a fault-free node receives the request sent fro received value, denoted as req(i), at the root of its rg-tree. In the second round, each n value of its rg-tree to all other nodes. If node 1 sends request req(i) to node 2, then nod request, denoted as req(i1), in vertex i1 of its rg-tree. Similarly, if node 2 sends reque received request is named req(i12) and stored in vertex i12 of node 1's rg-tree in the t request req(i12…n), stored in the vertex i12…n of a rg-tree, implies that the request through the node i, the node 1,…, the node n; and the node n is the latest node to pa request is transmitted through a node more than once, the name of the node will instance, request req (11), stored in vertex 11, indicates that the request is sent to node therefore, name 1 appears twice in vertex name 11. In summary, the root of rg-tree is alw that the stored request is sent from node i in the first round; the vertex of an rg-tree is l names. The node name list contains the names of the nodes through which the stored r Figure 6 shows an example of rg-tree.
node must collect enough exchanged messages from all other nodes if exchanging the received values helps fault-free nodes to collect enough exch Fischer and Lynch proved that (n-1)/3+1 is the rounds of message agreement problem, where n is the number of nodes in the underlying net of Fischer and Lynch, (n-1)/3+1 rounds of message exchanges are th agreement problem. Therefore, the required rounds σ is (nEj-1)/3+1 when Agreement of procedure Consensus, where nEj is the number of MEC nodes in nEj>3. Moreover, the required rounds σ is (nC-1)/3+1 when cloud nodes procedure Interactive Consistency, where nC is the number of cloud nodes in

 
The received messages of Request Gathering Step are stored i request-gathering tree (rg-tree), which is similar to that proposed by Bar-N maintains such an rg-tree during the execution of MECAA. In the first ro node i transmits its initial request to other nodes. However, that each rece sender of a request is assumed. When a fault-free node receives the requ received value, denoted as req(i), at the root of its rg-tree. In the second rou value of its rg-tree to all other nodes. If node 1 sends request req(i) to node request, denoted as req(i1), in vertex i1 of its rg-tree. Similarly, if node 2 se received request is named req(i12) and stored in vertex i12 of node 1's rg-t request req(i12…n), stored in the vertex i12…n of a rg-tree, implies that th through the node i, the node 1,…, the node n; and the node n is the latest request is transmitted through a node more than once, the name of the instance, request req (11), stored in vertex 11, indicates that the request is se therefore, name 1 appears twice in vertex name 11. In summary, the root of r that the stored request is sent from node i in the first round; the vertex of an names. The node name list contains the names of the nodes through which t Figure 6 shows an example of rg-tree. + 1 is the rounds of message exchanges sufficient to solve an agreement problem, where n is the number of nodes in the underlying network [17,18]. Based on the works of Fischer and Lynch, steps of function Agreement, one is the Request Gathering Step, and the other is the Requ parameters of Agreement include σ, vs, and nA, where σ is the required rounds, vs is the the number of nodes participating in the agreement. In order for all fault-free nodes to node must collect enough exchanged messages from all other nodes if they are fa exchanging the received values helps fault-free nodes to collect enough exchanged mes Fischer and Lynch proved that (n-1)/3+1 is the rounds of message exchanges agreement problem, where n is the number of nodes in the underlying network [17-18 of Fischer and Lynch, (n-1)/3+1 rounds of message exchanges are the lower bo agreement problem. Therefore, the required rounds σ is (nEj-1)/3+1 when MEC node Agreement of procedure Consensus, where nEj is the number of MEC nodes in MEC cluste nEj>3. Moreover, the required rounds σ is (nC-1)/3+1 when cloud nodes execute the procedure Interactive Consistency, where nC is the number of cloud nodes in the CC-laye

 
The received messages of Request Gathering Step are stored in a tree request-gathering tree (rg-tree), which is similar to that proposed by Bar-Noy et al. [19 maintains such an rg-tree during the execution of MECAA. In the first round of the R node i transmits its initial request to other nodes. However, that each receiver node ca sender of a request is assumed. When a fault-free node receives the request sent from received value, denoted as req(i), at the root of its rg-tree. In the second round, each no value of its rg-tree to all other nodes. If node 1 sends request req(i) to node 2, then nod request, denoted as req(i1), in vertex i1 of its rg-tree. Similarly, if node 2 sends request received request is named req(i12) and stored in vertex i12 of node 1's rg-tree in the th request req(i12…n), stored in the vertex i12…n of a rg-tree, implies that the request j through the node i, the node 1,…, the node n; and the node n is the latest node to pas request is transmitted through a node more than once, the name of the node will instance, request req (11), stored in vertex 11, indicates that the request is sent to node 1 therefore, name 1 appears twice in vertex name 11. In summary, the root of rg-tree is alw that the stored request is sent from node i in the first round; the vertex of an rg-tree is la names. The node name list contains the names of the nodes through which the stored re Figure 6 shows an example of rg-tree.
and nA, where σ is the required round the number of nodes participating in the agreement. In order for all fault-free node must collect enough exchanged messages from all other nodes if t exchanging the received values helps fault-free nodes to collect enough excha Fischer and Lynch proved that (n-1)/3+1 is the rounds of message e agreement problem, where n is the number of nodes in the underlying netw of Fischer and Lynch, (n-1)/3+1 rounds of message exchanges are the agreement problem. Therefore, the required rounds σ is (nEj-1)/3+1 when Agreement of procedure Consensus, where nEj is the number of MEC nodes in nEj>3. Moreover, the required rounds σ is (nC-1)/3+1 when cloud nodes ex procedure Interactive Consistency, where nC is the number of cloud nodes in th   The received messages of Request Gathering Step are stored in request-gathering tree (rg-tree), which is similar to that proposed by Bar-No maintains such an rg-tree during the execution of MECAA. In the first rou node i transmits its initial request to other nodes. However, that each receiv sender of a request is assumed. When a fault-free node receives the reques received value, denoted as req(i), at the root of its rg-tree. In the second roun value of its rg-tree to all other nodes. If node 1 sends request req(i) to node 2 request, denoted as req(i1), in vertex i1 of its rg-tree. Similarly, if node 2 sen received request is named req(i12) and stored in vertex i12 of node 1's rg-tr request req(i12…n), stored in the vertex i12…n of a rg-tree, implies that the through the node i, the node 1,…, the node n; and the node n is the latest n request is transmitted through a node more than once, the name of the instance, request req (11), stored in vertex 11, indicates that the request is sen therefore, name 1 appears twice in vertex name 11. In summary, the root of rg that the stored request is sent from node i in the first round; the vertex of an names. The node name list contains the names of the nodes through which th Figure 6 shows an example of rg-tree. + 1 rounds of message exchanges are the lower bound for solving the agreement problem. Therefore, the required rounds σ is procedures Consensus and Interactive Consistency, steps of function Agreement, one is the Request Gath parameters of Agreement include σ, vs, and nA, wher the number of nodes participating in the agreemen node must collect enough exchanged messages exchanging the received values helps fault-free nod Fischer and Lynch proved that (n-1)/3+1 is agreement problem, where n is the number of nod of Fischer and Lynch, (n-1)/3+1 rounds of me agreement problem. Therefore, the required round Agreement of procedure Consensus, where nEj is the n nEj>3. Moreover, the required rounds σ is (nC-1)/3 procedure Interactive Consistency, where nC is the nu

 
The received messages of Request Gather request-gathering tree (rg-tree), which is similar to maintains such an rg-tree during the execution of node i transmits its initial request to other nodes. H sender of a request is assumed. When a fault-free received value, denoted as req(i), at the root of its value of its rg-tree to all other nodes. If node 1 send request, denoted as req(i1), in vertex i1 of its rg-tre received request is named req(i12) and stored in v request req(i12…n), stored in the vertex i12…n of through the node i, the node 1,…, the node n; and request is transmitted through a node more than instance, request req (11), stored in vertex 11, indica therefore, name 1 appears twice in vertex name 11. that the stored request is sent from node i in the firs names. The node name list contains the names of th Figure 6 shows an example of rg-tree.
(n Ej − 1)/3 steps of function Agreement, one is the parameters of Agreement include σ, vs, a the number of nodes participating in th node must collect enough exchanged exchanging the received values helps fa Fischer and Lynch proved that  agreement problem, where n is the nu of Fischer and Lynch, (n-1)/3+1 ro agreement problem. Therefore, the req Agreement of procedure Consensus, whe nEj>3. Moreover, the required rounds σ procedure Interactive Consistency, wher

 
The received messages of Req request-gathering tree (rg-tree), which maintains such an rg-tree during the e node i transmits its initial request to o sender of a request is assumed. When received value, denoted as req(i), at th value of its rg-tree to all other nodes. If request, denoted as req(i1), in vertex i1 received request is named req(i12) and request req(i12…n), stored in the verte through the node i, the node 1,…, the request is transmitted through a nod instance, request req (11), stored in vert therefore, name 1 appears twice in vert that the stored request is sent from nod names. The node name list contains the Figure 6 shows an example of rg-tree. + 1 when MEC nodes execute the function Agreement of procedure Consensus, where n Ej is the number of MEC nodes in MEC cluster E j of MEC-layer and n Ej > 3. Moreover, the required rounds σ is MECAA is initiated by the UEs to execute procedure Consensus and the n procedures Consensus and Interactive C steps of function Agreement, one is the parameters of Agreement include σ, vs, a the number of nodes participating in th node must collect enough exchanged exchanging the received values helps fa Fischer and Lynch proved that ( agreement problem, where n is the num of Fischer and Lynch, (n-1)/3+1 rou agreement problem. Therefore, the requ Agreement of procedure Consensus, whe nEj>3. Moreover, the required rounds σ procedure Interactive Consistency, where

 
The received messages of Req request-gathering tree (rg-tree), which i maintains such an rg-tree during the ex node i transmits its initial request to ot sender of a request is assumed. When received value, denoted as req(i), at the value of its rg-tree to all other nodes. If request, denoted as req(i1), in vertex i1 received request is named req(i12) and request req(i12…n), stored in the verte through the node i, the node 1,…, the n request is transmitted through a node instance, request req (11), stored in verte therefore, name 1 appears twice in verte that the stored request is sent from nod names. The node name list contains the Figure 6 shows an example of rg-tree.
(n C − 1)/3 execute procedure Consensu procedures Consensus and steps of function Agreemen parameters of Agreement in the number of nodes partic node must collect enough exchanging the received va Fischer and Lynch pr agreement problem, where of Fischer and Lynch, (n agreement problem. Theref Agreement of procedure Con nEj>3. Moreover, the requir procedure Interactive Consis

 
The received messa request-gathering tree (rg-t maintains such an rg-tree d node i transmits its initial r sender of a request is assu received value, denoted as value of its rg-tree to all oth request, denoted as req(i1), received request is named request req(i12…n), stored through the node i, the nod request is transmitted thro instance, request req (11), sto therefore, name 1 appears t that the stored request is se names. The node name list Figure 6 shows an example + 1 when cloud nodes execute the function Agreement of procedure Interactive Consistency, where n C is the number of cloud nodes in the CC-layer and n C > 3.
The received messages of Request Gathering Step are stored in a tree structure called the request-gathering tree (rg-tree), which is similar to that proposed by Bar-Noy et al. [19]. Each fault-free node maintains such an rg-tree during the execution of MECAA. In the first round of the Request Gathering Step, node i transmits its initial request to other nodes. However, that each receiver node can always identify the sender of a request is assumed. When a fault-free node receives the request sent from node i, it stores the received value, denoted as req(i), at the root of its rg-tree. In the second round, each node transmits the root value of its rg-tree to all other nodes. If node 1 sends request req(i) to node 2, then node 2 stores the received request, denoted as req(i1), in vertex i1 of its rg-tree. Similarly, if node 2 sends request req(i1) to node 1, the received request is named req(i12) and stored in vertex i12 of node 1's rg-tree in the third round. Generally, request req(i12 . . . n), stored in the vertex i12 . . . n of a rg-tree, implies that the request just received was sent through the node i, the node 1, . . . , the node n; and the node n is the latest node to pass the request. When a request is transmitted through a node more than once, the name of the node will also be repeated. For instance, request req(11), stored in vertex 11, indicates that the request is sent to node 1, then to node 1 again; therefore, name 1 appears twice in vertex name 11. In summary, the root of rg-tree is always named i to denote that the stored request is sent from node i in the first round; the vertex of an rg-tree is labeled by a list of node names. The node name list contains the names of the nodes through which the stored request was transferred. Figure 6 shows an example of rg-tree.   In the Request Gathering Step of function Agreement, the vertices with repeated node names in each rg-tree will be deleted. Finally, all fault-free nodes use function VOTE to remove the faulty influence from faulty nodes to obtain the common value. When the function VOTE is applied to the root of each corresponding rg-tree, and then the common value VOTE(i) is obtained. The proposed algorithm MECAA is presented in Table 1.

1.
The requests for the application services are sent to the corresponding MEC cluster of MEC-layer by UEs.

2.
The MEC nodes of the MEC-layer execute procedure Consensus.

3.
The cloud nodes of the CC-layer execute procedure Interactive Consistency.
Procedure Consensus (for the MEC node e ij in the MEC cluster E j of MEC-layer, 1 ≤ i ≤ n Ej where n Ej is the number of MEC nodes in MEC cluster E j of MEC-layer and n Ej > 3) 1.
The MEC node e ij receives the requests sent from UEs.

2.
The received requests are taken as the majority. And the majority value is used as the initial value (v i ) of e ij when function Agreement is executed.

3.
Compute the number of rounds required, σ = MECAA is initiated by the UEs to ask for a specific application service. The n execute procedure Consensus and the nodes of CC-layer need to execute procedur procedures Consensus and Interactive Consistency, the function Agreement will be steps of function Agreement, one is the Request Gathering Step, and the other is the parameters of Agreement include σ, vs, and nA, where σ is the required rounds, vs is the number of nodes participating in the agreement. In order for all fault-free node node must collect enough exchanged messages from all other nodes if they a exchanging the received values helps fault-free nodes to collect enough exchanged Fischer and Lynch proved that (n-1)/3+1 is the rounds of message exchan agreement problem, where n is the number of nodes in the underlying network [1 of Fischer and Lynch, (n-1)/3+1 rounds of message exchanges are the low agreement problem. Therefore, the required rounds σ is (nEj-1)/3+1 when MEC Agreement of procedure Consensus, where nEj is the number of MEC nodes in MEC nEj>3. Moreover, the required rounds σ is (nC-1)/3+1 when cloud nodes execute procedure Interactive Consistency, where nC is the number of cloud nodes in the CC

 
The received messages of Request Gathering Step are stored in a t request-gathering tree (rg-tree), which is similar to that proposed by Bar-Noy et a maintains such an rg-tree during the execution of MECAA. In the first round of node i transmits its initial request to other nodes. However, that each receiver no sender of a request is assumed. When a fault-free node receives the request sen received value, denoted as req(i), at the root of its rg-tree. In the second round, ea value of its rg-tree to all other nodes. If node 1 sends request req(i) to node 2, then request, denoted as req(i1), in vertex i1 of its rg-tree. Similarly, if node 2 sends re received request is named req(i12) and stored in vertex i12 of node 1's rg-tree in t request req(i12…n), stored in the vertex i12…n of a rg-tree, implies that the requ through the node i, the node 1,…, the node n; and the node n is the latest node to request is transmitted through a node more than once, the name of the node instance, request req (11), stored in vertex 11, indicates that the request is sent to no therefore, name 1 appears twice in vertex name 11. In summary, the root of rg-tree i that the stored request is sent from node i in the first round; the vertex of an rg-tree names. The node name list contains the names of the nodes through which the stor Figure 6 shows an example of rg-tree.
(n Ej − 1)/3 Figure 5. The progression steps of MECA MECAA is initiated by the UEs to ask for a specific application ser execute procedure Consensus and the nodes of CC-layer need to execut procedures Consensus and Interactive Consistency, the function Agreem steps of function Agreement, one is the Request Gathering Step, and the parameters of Agreement include σ, vs, and nA, where σ is the required r the number of nodes participating in the agreement. In order for all fau node must collect enough exchanged messages from all other node exchanging the received values helps fault-free nodes to collect enough Fischer and Lynch proved that (n-1)/3+1 is the rounds of mes agreement problem, where n is the number of nodes in the underlying of Fischer and Lynch, (n-1)/3+1 rounds of message exchanges ar agreement problem. Therefore, the required rounds σ is (nEj-1)/3+1 w Agreement of procedure Consensus, where nEj is the number of MEC nod nEj>3. Moreover, the required rounds σ is (nC-1)/3+1 when cloud nod procedure Interactive Consistency, where nC is the number of cloud node

 
The received messages of Request Gathering Step are store request-gathering tree (rg-tree), which is similar to that proposed by Ba maintains such an rg-tree during the execution of MECAA. In the firs node i transmits its initial request to other nodes. However, that each sender of a request is assumed. When a fault-free node receives the r received value, denoted as req(i), at the root of its rg-tree. In the second value of its rg-tree to all other nodes. If node 1 sends request req(i) to n request, denoted as req(i1), in vertex i1 of its rg-tree. Similarly, if node received request is named req(i12) and stored in vertex i12 of node 1's request req(i12…n), stored in the vertex i12…n of a rg-tree, implies th through the node i, the node 1,…, the node n; and the node n is the la request is transmitted through a node more than once, the name of instance, request req (11), stored in vertex 11, indicates that the request i therefore, name 1 appears twice in vertex name 11. In summary, the roo that the stored request is sent from node i in the first round; the vertex names. The node name list contains the names of the nodes through wh Figure 6 shows an example of rg-tree. + 1. Execute function Agreement(σ, v i , n Ej ), then the agreement vector of the specific application service requests is obtained. 4.
Take the majority value of the agreement vector, and then the Consensus value is obtained.

5.
The Consensus value is transferred to CC-layer.
Procedure Interactive Consistency (for the cloud node c i in the CC-layer, 1 ≤ j ≤ n C , where n C is the number of cloud nodes in the CC-layer and n C > 3)

1.
The cloud node c j receives the Consensus values transferred from nodes in the MEC cluster E j of MEC-layer.

2.
The received Consensus values from nodes in the MEC cluster E j of MEC-layer are taken as the majority.
And the majority value is used as the initial value (v j ) of c j when function Agreement is executed.

3.
Compute the number of rounds required, σ = MECAA is initiated by the UEs to ask for a specific application service. The n execute procedure Consensus and the nodes of CC-layer need to execute procedur procedures Consensus and Interactive Consistency, the function Agreement will be steps of function Agreement, one is the Request Gathering Step, and the other is the parameters of Agreement include σ, vs, and nA, where σ is the required rounds, vs i the number of nodes participating in the agreement. In order for all fault-free nod node must collect enough exchanged messages from all other nodes if they exchanging the received values helps fault-free nodes to collect enough exchanged Fischer and Lynch proved that (n-1)/3+1 is the rounds of message excha agreement problem, where n is the number of nodes in the underlying network [ of Fischer and Lynch, (n-1)/3+1 rounds of message exchanges are the low agreement problem. Therefore, the required rounds σ is (nEj-1)/3+1 when MEC Agreement of procedure Consensus, where nEj is the number of MEC nodes in MEC nEj>3. Moreover, the required rounds σ is (nC-1)/3+1 when cloud nodes execute procedure Interactive Consistency, where nC is the number of cloud nodes in the CC

 
The received messages of Request Gathering Step are stored in a t request-gathering tree (rg-tree), which is similar to that proposed by Bar-Noy et a maintains such an rg-tree during the execution of MECAA. In the first round of node i transmits its initial request to other nodes. However, that each receiver no sender of a request is assumed. When a fault-free node receives the request sen received value, denoted as req(i), at the root of its rg-tree. In the second round, ea value of its rg-tree to all other nodes. If node 1 sends request req(i) to node 2, then request, denoted as req(i1), in vertex i1 of its rg-tree. Similarly, if node 2 sends re received request is named req(i12) and stored in vertex i12 of node 1's rg-tree in request req(i12…n), stored in the vertex i12…n of a rg-tree, implies that the requ through the node i, the node 1,…, the node n; and the node n is the latest node t request is transmitted through a node more than once, the name of the node instance, request req (11), stored in vertex 11, indicates that the request is sent to no therefore, name 1 appears twice in vertex name 11. In summary, the root of rg-tree i that the stored request is sent from node i in the first round; the vertex of an rg-tre names. The node name list contains the names of the nodes through which the stor Figure 6 shows an example of rg-tree. MECAA is initiated by the UEs to ask for a specific application ser execute procedure Consensus and the nodes of CC-layer need to execut procedures Consensus and Interactive Consistency, the function Agreem steps of function Agreement, one is the Request Gathering Step, and the parameters of Agreement include σ, vs, and nA, where σ is the required r the number of nodes participating in the agreement. In order for all fau node must collect enough exchanged messages from all other node exchanging the received values helps fault-free nodes to collect enough Fischer and Lynch proved that (n-1)/3+1 is the rounds of mes agreement problem, where n is the number of nodes in the underlying of Fischer and Lynch, (n-1)/3+1 rounds of message exchanges ar agreement problem. Therefore, the required rounds σ is (nEj-1)/3+1 w Agreement of procedure Consensus, where nEj is the number of MEC nod nEj>3. Moreover, the required rounds σ is (nC-1)/3+1 when cloud no procedure Interactive Consistency, where nC is the number of cloud node   The received messages of Request Gathering Step are store request-gathering tree (rg-tree), which is similar to that proposed by Ba maintains such an rg-tree during the execution of MECAA. In the firs node i transmits its initial request to other nodes. However, that each sender of a request is assumed. When a fault-free node receives the r received value, denoted as req(i), at the root of its rg-tree. In the second value of its rg-tree to all other nodes. If node 1 sends request req(i) to n request, denoted as req(i1), in vertex i1 of its rg-tree. Similarly, if node received request is named req(i12) and stored in vertex i12 of node 1's request req(i12…n), stored in the vertex i12…n of a rg-tree, implies th through the node i, the node 1,…, the node n; and the node n is the la request is transmitted through a node more than once, the name of instance, request req (11), stored in vertex 11, indicates that the request i therefore, name 1 appears twice in vertex name 11. In summary, the roo that the stored request is sent from node i in the first round; the vertex names. The node name list contains the names of the nodes through wh Figure 6 shows an example of rg-tree.
The obtained vector is IC value.
Agreement(σ, v s , n A ) (σ is the required rounds, v s is the initial value and n A is the number of nodes participating in the agreement)

Request Gathering Step:
If r = 1 then: (1) Each node broadcasts its initial value v s to other nodes in the same cluster simultaneously. (2) Each node receives and stores the n A values sent from n A nodes of the same cluster in the corresponding root of its rg-tree.
For 2 < r ≤ σ, do: (1) Each node transmits the values at level r−1 in its rg-tree to other nodes in the same cluster simultaneously. (2) Each receiver node stores the received values in the corresponding vertices at level r of its rg-tree.

Request Deciding
Step: Step 1: Reorganize each rg-tree by deleting the vertices with repeated node names.
Step 2: Using function VOTE with the root i of each node's rg-tree and obtaining the common value VOTE(i).

VOTE(α)=
If the α is a leaf, then outputs the value α.
If the majority value does not exist, then output the default value ϕ.
However, analysis of algorithms under varying parameters and practical constraints through computer simulation can be key to understanding the performance and trade-offs of theoretically well-performing algorithms [20]. In order to facilitate the simulation experiment, the pseudo code of the proposed MECAA is shown in Table 2. There are four parts of MECAA, including Consensus(n Ej , E j ), Interactive Consistency(n C , E j ), Agreement(σ, v s , n A ), and vote_value(α). The functions involved in MECAA are listed as follows: trans(req, E j ): transfer the request of a specific application service to MEC cluster E j . recv(req, E j ): receive the requests sent from UEs in the MEC cluster E j . majority(recv(req, E j )): take the majority of the received requests from UEs. recv(cv, E j ): receive the Consensus values transferred from nodes in the MEC cluster E j . send(i, <v s >, n A ): node i sends the initial value v s to all n A nodes in the same cluster. rvst(i, n A , <v s , >, rg-tree(root)): node i receives and stores the n A <v s , > sent from n A nodes of same cluster in the corresponding root of its rg-tree. send(i, <val, r − 1>, n A ): node i sends the values at level r − 1 in its rg-tree to other n A nodes in same cluster. rvst(i, n A , <val, r − 1>, re-tree(r)): node i receives and stores the n A <val, r − 1> sent from n A nodes of same cluster in the corresponding vertices at level r of its rg-tree. retree(i, rg-tree): delete the vertices in node i's rg-tree with repeated node names. vote_value(new_rg-tree): compute the function value at the root of the new_rg-tree. tree_maj(α): take the majority value of new_rg-tree.

An Example of the Execution of MECAA
An example of executing MECAA, the application of connected vehicles by MIoT, is presented in Figure  7. Each vehicle (UE) asks for the service of traffic status. The request of each UE is shown in Figure 7a. And, the requests of UEs are transferred to MEC cluster E1 of MEC-layer.
In procedure Consensus, each node in MEC cluster E1 receives the requests transferred from UEs. The received requests are taken as the majority and the majority value is used as the initial value (vi) of node in MEC cluster E1 when function Agreement is executed. The initial value may be the initial time or the time stamp of the central traffic controller. Then, the number of rounds required, σ = (nEj-1)/3+1, is computed and function Agreement(σ, vi, nEj) is executed. The initial value of each node in MEC cluster E1 of MEC-layer is shown in Figure 7b.

An Example of the Execution of MECAA
An example of executing MECAA, the application of connected vehicles by MIoT, is presented in Figure 7. Each vehicle (UE) asks for the service of traffic status. The request of each UE is shown in Figure 7a. And, the requests of UEs are transferred to MEC cluster E 1 of MEC-layer.    In procedure Consensus, each node in MEC cluster E 1 receives the requests transferred from UEs. The received requests are taken as the majority and the majority value is used as the initial value (v i ) of node in MEC cluster E 1 when function Agreement is executed. The initial value may be the initial time or the time stamp of the central traffic controller. Then, the number of rounds required, σ = the number of nodes participating in the agreement. In order for all fault-free nodes to reach agreement, each node must collect enough exchanged messages from all other nodes if they are fault-free. As a result, exchanging the received values helps fault-free nodes to collect enough exchanged messages.
Fischer and Lynch proved that (n-1)/3+1 is the rounds of message exchanges sufficient to solve an agreement problem, where n is the number of nodes in the underlying network [17][18]. Based on the works of Fischer and Lynch, (n-1)/3+1 rounds of message exchanges are the lower bound for solving the agreement problem. Therefore, the required rounds σ is (nEj-1)/3+1 when MEC nodes execute the function Agreement of procedure Consensus, where nEj is the number of MEC nodes in MEC cluster Ej of MEC-layer and nEj>3. Moreover, the required rounds σ is (nC-1)/3+1 when cloud nodes execute the function Agreement of procedure Interactive Consistency, where nC is the number of cloud nodes in the CC-layer and nC>3.

 
The received messages of Request Gathering Step are stored in a tree structure called the request-gathering tree (rg-tree), which is similar to that proposed by Bar-Noy et al. [19]. Each fault-free node maintains such an rg-tree during the execution of MECAA. In the first round of the Request Gathering Step, node i transmits its initial request to other nodes. However, that each receiver node can always identify the sender of a request is assumed. When a fault-free node receives the request sent from node i, it stores the received value, denoted as req(i), at the root of its rg-tree. In the second round, each node transmits the root value of its rg-tree to all other nodes. If node 1 sends request req(i) to node 2, then node 2 stores the received request, denoted as req(i1), in vertex i1 of its rg-tree. Similarly, if node 2 sends request req(i1) to node 1, the received request is named req(i12) and stored in vertex i12 of node 1's rg-tree in the third round. Generally, request req(i12…n), stored in the vertex i12…n of a rg-tree, implies that the request just received was sent through the node i, the node 1,…, the node n; and the node n is the latest node to pass the request. When a request is transmitted through a node more than once, the name of the node will also be repeated. For instance, request req (11), stored in vertex 11, indicates that the request is sent to node 1, then to node 1 again; therefore, name 1 appears twice in vertex name 11. In summary, the root of rg-tree is always named i to denote that the stored request is sent from node i in the first round; the vertex of an rg-tree is labeled by a list of node names. The node name list contains the names of the nodes through which the stored request was transferred. Figure 6 shows an example of rg-tree.
(n Ej − 1)/3 node must collect enough exchanged messages from all other nodes if they are fault-free. As a res exchanging the received values helps fault-free nodes to collect enough exchanged messages.
Fischer and Lynch proved that (n-1)/3+1 is the rounds of message exchanges sufficient to solve agreement problem, where n is the number of nodes in the underlying network [17][18]. Based on the wo of Fischer and Lynch, (n-1)/3+1 rounds of message exchanges are the lower bound for solving agreement problem. Therefore, the required rounds σ is (nEj-1)/3+1 when MEC nodes execute the funct Agreement of procedure Consensus, where nEj is the number of MEC nodes in MEC cluster Ej of MEC-layer nEj>3. Moreover, the required rounds σ is (nC-1)/3+1 when cloud nodes execute the function Agreemen procedure Interactive Consistency, where nC is the number of cloud nodes in the CC-layer and nC>3.

 
The received messages of Request Gathering Step are stored in a tree structure called request-gathering tree (rg-tree), which is similar to that proposed by Bar-Noy et al. [19]. Each fault-free n maintains such an rg-tree during the execution of MECAA. In the first round of the Request Gathering S node i transmits its initial request to other nodes. However, that each receiver node can always identify sender of a request is assumed. When a fault-free node receives the request sent from node i, it stores received value, denoted as req(i), at the root of its rg-tree. In the second round, each node transmits the r value of its rg-tree to all other nodes. If node 1 sends request req(i) to node 2, then node 2 stores the recei request, denoted as req(i1), in vertex i1 of its rg-tree. Similarly, if node 2 sends request req(i1) to node 1, received request is named req(i12) and stored in vertex i12 of node 1's rg-tree in the third round. Genera request req(i12…n), stored in the vertex i12…n of a rg-tree, implies that the request just received was s through the node i, the node 1,…, the node n; and the node n is the latest node to pass the request. Whe request is transmitted through a node more than once, the name of the node will also be repeated. instance, request req (11), stored in vertex 11, indicates that the request is sent to node 1, then to node 1 ag therefore, name 1 appears twice in vertex name 11. In summary, the root of rg-tree is always named i to den that the stored request is sent from node i in the first round; the vertex of an rg-tree is labeled by a list of n names. The node name list contains the names of the nodes through which the stored request was transferr Figure 6 shows an example of rg-tree. + 1, is computed and function Agreement(σ, v i , n Ej ) is executed. The initial value of each node in MEC cluster E 1 of MEC-layer is shown in Figure 7b.
For this example, two rounds (σ = steps of function Agreement, one is the Request Gathering Step, and the other is the R parameters of Agreement include σ, vs, and nA, where σ is the required rounds, vs is the number of nodes participating in the agreement. In order for all fault-free nodes node must collect enough exchanged messages from all other nodes if they ar exchanging the received values helps fault-free nodes to collect enough exchanged m Fischer and Lynch proved that (n-1)/3+1 is the rounds of message exchan agreement problem, where n is the number of nodes in the underlying network [17 of Fischer and Lynch, (n-1)/3+1 rounds of message exchanges are the lowe agreement problem. Therefore, the required rounds σ is (nEj-1)/3+1 when MEC n Agreement of procedure Consensus, where nEj is the number of MEC nodes in MEC cl nEj>3. Moreover, the required rounds σ is (nC-1)/3+1 when cloud nodes execute procedure Interactive Consistency, where nC is the number of cloud nodes in the CC-l

 
The received messages of Request Gathering Step are stored in a tr request-gathering tree (rg-tree), which is similar to that proposed by Bar-Noy et al. maintains such an rg-tree during the execution of MECAA. In the first round of t node i transmits its initial request to other nodes. However, that each receiver nod sender of a request is assumed. When a fault-free node receives the request sent received value, denoted as req(i), at the root of its rg-tree. In the second round, eac value of its rg-tree to all other nodes. If node 1 sends request req(i) to node 2, then n request, denoted as req(i1), in vertex i1 of its rg-tree. Similarly, if node 2 sends req received request is named req(i12) and stored in vertex i12 of node 1's rg-tree in th request req(i12…n), stored in the vertex i12…n of a rg-tree, implies that the reque through the node i, the node 1,…, the node n; and the node n is the latest node to request is transmitted through a node more than once, the name of the node w instance, request req (11), stored in vertex 11, indicates that the request is sent to nod therefore, name 1 appears twice in vertex name 11. In summary, the root of rg-tree is that the stored request is sent from node i in the first round; the vertex of an rg-tree names. The node name list contains the names of the nodes through which the stored Figure 6 shows an example of rg-tree.
(n E1 − 1)/3 parameters of Agreement include σ, vs, and nA, where σ is the required r the number of nodes participating in the agreement. In order for all fau node must collect enough exchanged messages from all other node exchanging the received values helps fault-free nodes to collect enough Fischer and Lynch proved that (n-1)/3+1 is the rounds of mes agreement problem, where n is the number of nodes in the underlying of Fischer and Lynch, (n-1)/3+1 rounds of message exchanges a agreement problem. Therefore, the required rounds σ is (nEj-1)/3+1 w Agreement of procedure Consensus, where nEj is the number of MEC nod nEj>3. Moreover, the required rounds σ is (nC-1)/3+1 when cloud no procedure Interactive Consistency, where nC is the number of cloud node

 
The received messages of Request Gathering Step are store request-gathering tree (rg-tree), which is similar to that proposed by Ba maintains such an rg-tree during the execution of MECAA. In the firs node i transmits its initial request to other nodes. However, that each sender of a request is assumed. When a fault-free node receives the r received value, denoted as req(i), at the root of its rg-tree. In the second value of its rg-tree to all other nodes. If node 1 sends request req(i) to n request, denoted as req(i1), in vertex i1 of its rg-tree. Similarly, if node received request is named req(i12) and stored in vertex i12 of node 1's request req(i12…n), stored in the vertex i12…n of a rg-tree, implies th through the node i, the node 1,…, the node n; and the node n is the la request is transmitted through a node more than once, the name of instance, request req (11), stored in vertex 11, indicates that the request i therefore, name 1 appears twice in vertex name 11. In summary, the roo that the stored request is sent from node i in the first round; the vertex names. The node name list contains the names of the nodes through wh Figure 6 shows an example of rg-tree.
steps of function Agreement, one is the Request Gathering Step, a parameters of Agreement include σ, vs, and nA, where σ is the req the number of nodes participating in the agreement. In order fo node must collect enough exchanged messages from all oth exchanging the received values helps fault-free nodes to collect Fischer and Lynch proved that (n-1)/3+1 is the rounds agreement problem, where n is the number of nodes in the und of Fischer and Lynch, (n-1)/3+1 rounds of message excha agreement problem. Therefore, the required rounds σ is (nEj-1 Agreement of procedure Consensus, where nEj is the number of M nEj>3. Moreover, the required rounds σ is (nC-1)/3+1 when cl procedure Interactive Consistency, where nC is the number of clou

 
The received messages of Request Gathering Step ar request-gathering tree (rg-tree), which is similar to that propose maintains such an rg-tree during the execution of MECAA. In node i transmits its initial request to other nodes. However, th sender of a request is assumed. When a fault-free node receiv received value, denoted as req(i), at the root of its rg-tree. In the value of its rg-tree to all other nodes. If node 1 sends request re request, denoted as req(i1), in vertex i1 of its rg-tree. Similarly, received request is named req(i12) and stored in vertex i12 of n request req(i12…n), stored in the vertex i12…n of a rg-tree, im through the node i, the node 1,…, the node n; and the node n i request is transmitted through a node more than once, the n instance, request req (11), stored in vertex 11, indicates that the r therefore, name 1 appears twice in vertex name 11. In summary, that the stored request is sent from node i in the first round; the names. The node name list contains the names of the nodes thro Figure 6 shows an example of rg-tree.
parameters of Agreement include σ, vs, and nA, where σ the number of nodes participating in the agreement. In node must collect enough exchanged messages from exchanging the received values helps fault-free nodes to Fischer and Lynch proved that (n-1)/3+1 is the agreement problem, where n is the number of nodes in of Fischer and Lynch, (n-1)/3+1 rounds of messag agreement problem. Therefore, the required rounds σ Agreement of procedure Consensus, where nEj is the num nEj>3. Moreover, the required rounds σ is (nC-1)/3+1 procedure Interactive Consistency, where nC is the numbe

 
The received messages of Request Gathering request-gathering tree (rg-tree), which is similar to that maintains such an rg-tree during the execution of MEC node i transmits its initial request to other nodes. How sender of a request is assumed. When a fault-free nod received value, denoted as req(i), at the root of its rg-tr value of its rg-tree to all other nodes. If node 1 sends re request, denoted as req(i1), in vertex i1 of its rg-tree. Si received request is named req(i12) and stored in vertex request req(i12…n), stored in the vertex i12…n of a rg through the node i, the node 1,…, the node n; and the request is transmitted through a node more than on instance, request req (11), stored in vertex 11, indicates t therefore, name 1 appears twice in vertex name 11. In su that the stored request is sent from node i in the first ro names. The node name list contains the names of the no Figure 6 shows an example of rg-tree.
where n E1 is the number of nodes in MEC cluster E 1 ) are required to exchange the messages when Agreement is executed. In this example, there are five nodes in MEC cluster E 1 and MEC node e 15 is assumed in malicious fault. Figure 7b gives the initial value of each node in MEC cluster E 1 . During the first round of Request Gathering Step, each node of MEC cluster E 1 transmits the initial value to all nodes of MEC cluster E 1 simultaneously, and stores the received n E1 (=5) values in the corresponding root of each rg-tree, as shown in Figure 7c. In the second round, each node transmits the values in the root of the corresponding rg-tree to other nodes in MEC cluster E 1 simultaneously, and stores the received values in level 1 of the n E1 (=5) corresponding rg-trees. The progression of nodes e 11 and e 13 during Request Gathering Step is shown in Figure 7d,f. Subsequently, in the Request Deciding Step, the rg-tree is reorganized by deleting those vertices with repeated node names. The corresponding rg-tree of nodes e 11 and e 13 is shown in Figure 7e,g. Then, function VOTE is applied on the rg-tree root of each node to take the majority value. The majority value of the agreement vector is taken, and the Consensus value is obtained. The Consensus value of nodes e 11 and e 13 is obtained and shown in Figure 7h. Finally, the Consensus value of each MEC cluster in the MEC-layer is transferred to the CC-layer.
In procedure Interactive Consistency, the cloud node in the CC-layer receives the Consensus value from nodes in the MEC cluster of MEC-layer. The received Consensus values from nodes in the MEC cluster are taken as the majority. The majority value is used as the initial value of the cloud node when function Agreement is executed. The initial value of each node in the CC-layer is shown in Figure 7i. For this example, two rounds (σ = provide an integrated service such as connecting vehicles, smart cities progression steps of MECAA are shown in Figure 5. MECAA is initiated by the UEs to ask for a specific application service. T execute procedure Consensus and the nodes of CC-layer need to execute proce procedures Consensus and Interactive Consistency, the function Agreement wi steps of function Agreement, one is the Request Gathering Step, and the other is parameters of Agreement include σ, vs, and nA, where σ is the required rounds, the number of nodes participating in the agreement. In order for all fault-free node must collect enough exchanged messages from all other nodes if th exchanging the received values helps fault-free nodes to collect enough exchan Fischer and Lynch proved that (n-1)/3+1 is the rounds of message ex agreement problem, where n is the number of nodes in the underlying netwo of Fischer and Lynch, (n-1)/3+1 rounds of message exchanges are the agreement problem. Therefore, the required rounds σ is (nEj-1)/3+1 when M Agreement of procedure Consensus, where nEj is the number of MEC nodes in M nEj>3. Moreover, the required rounds σ is (nC-1)/3+1 when cloud nodes exe procedure Interactive Consistency, where nC is the number of cloud nodes in the  

The received messages of Request Gathering
Step are stored in request-gathering tree (rg-tree), which is similar to that proposed by Bar-Noy maintains such an rg-tree during the execution of MECAA. In the first round node i transmits its initial request to other nodes. However, that each receive sender of a request is assumed. When a fault-free node receives the request received value, denoted as req(i), at the root of its rg-tree. In the second round value of its rg-tree to all other nodes. If node 1 sends request req(i) to node 2, request, denoted as req(i1), in vertex i1 of its rg-tree. Similarly, if node 2 send received request is named req(i12) and stored in vertex i12 of node 1's rg-tree request req(i12…n), stored in the vertex i12…n of a rg-tree, implies that the through the node i, the node 1,…, the node n; and the node n is the latest no request is transmitted through a node more than once, the name of the no instance, request req (11), stored in vertex 11, indicates that the request is sent t therefore, name 1 appears twice in vertex name 11. In summary, the root of rg-t that the stored request is sent from node i in the first round; the vertex of an rg names. The node name list contains the names of the nodes through which the Figure 6 shows an example of rg-tree.
provide an integrated service such as connecting vehicles, s progression steps of MECAA are shown in Figure 5. and nA, where σ is the requi the number of nodes participating in the agreement. In order for a node must collect enough exchanged messages from all other exchanging the received values helps fault-free nodes to collect eno Fischer and Lynch proved that (n-1)/3+1 is the rounds of agreement problem, where n is the number of nodes in the under of Fischer and Lynch, (n-1)/3+1 rounds of message exchang agreement problem. Therefore, the required rounds σ is (nEj-1)/3 Agreement of procedure Consensus, where nEj is the number of MEC nEj>3. Moreover, the required rounds σ is (nC-1)/3+1 when clou procedure Interactive Consistency, where nC is the number of cloud

 
The received messages of Request Gathering Step are request-gathering tree (rg-tree), which is similar to that proposed maintains such an rg-tree during the execution of MECAA. In th node i transmits its initial request to other nodes. However, that sender of a request is assumed. When a fault-free node receives received value, denoted as req(i), at the root of its rg-tree. In the s value of its rg-tree to all other nodes. If node 1 sends request req(i) request, denoted as req(i1), in vertex i1 of its rg-tree. Similarly, if received request is named req(i12) and stored in vertex i12 of nod request req(i12…n), stored in the vertex i12…n of a rg-tree, impli through the node i, the node 1,…, the node n; and the node n is t request is transmitted through a node more than once, the nam instance, request req (11), stored in vertex 11, indicates that the req therefore, name 1 appears twice in vertex name 11. In summary, th that the stored request is sent from node i in the first round; the ve names. The node name list contains the names of the nodes throug Figure 6 shows an example of rg-tree.
provide an integrated service such as connecting progression steps of MECAA are shown in Figure 5. MECAA is initiated by the UEs to ask for a specifi execute procedure Consensus and the nodes of CC-laye procedures Consensus and Interactive Consistency, the steps of function Agreement, one is the Request Gatherin parameters of Agreement include σ, vs, and nA, where σ the number of nodes participating in the agreement. In node must collect enough exchanged messages from exchanging the received values helps fault-free nodes to Fischer and Lynch proved that (n-1)/3+1 is the agreement problem, where n is the number of nodes in of Fischer and Lynch, (n-1)/3+1 rounds of messag agreement problem. Therefore, the required rounds σ Agreement of procedure Consensus, where nEj is the num nEj>3. Moreover, the required rounds σ is (nC-1)/3+1 procedure Interactive Consistency, where nC is the numbe

 
The received messages of Request Gathering request-gathering tree (rg-tree), which is similar to that maintains such an rg-tree during the execution of MEC node i transmits its initial request to other nodes. How sender of a request is assumed. When a fault-free nod received value, denoted as req(i), at the root of its rg-tr value of its rg-tree to all other nodes. If node 1 sends re request, denoted as req(i1), in vertex i1 of its rg-tree. Si received request is named req(i12) and stored in vertex request req(i12…n), stored in the vertex i12…n of a rg through the node i, the node 1,…, the node n; and the request is transmitted through a node more than on instance, request req (11), stored in vertex 11, indicates t therefore, name 1 appears twice in vertex name 11. In su that the stored request is sent from node i in the first ro names. The node name list contains the names of the no Figure 6 shows an example of rg-tree.
provide an integrated service such as con progression steps of MECAA are shown in Fig   Figure 5. The MECAA is initiated by the UEs to ask for execute procedure Consensus and the nodes of procedures Consensus and Interactive Consisten steps of function Agreement, one is the Request parameters of Agreement include σ, vs, and nA, the number of nodes participating in the agree node must collect enough exchanged messa exchanging the received values helps fault-free Fischer and Lynch proved that (n-1)/3+ agreement problem, where n is the number of of Fischer and Lynch, (n-1)/3+1 rounds o agreement problem. Therefore, the required ro Agreement of procedure Consensus, where nEj is nEj>3. Moreover, the required rounds σ is (nC procedure Interactive Consistency, where nC is th

 
The received messages of Request G request-gathering tree (rg-tree), which is simila maintains such an rg-tree during the executio node i transmits its initial request to other nod sender of a request is assumed. When a fault received value, denoted as req(i), at the root o value of its rg-tree to all other nodes. If node 1 request, denoted as req(i1), in vertex i1 of its r received request is named req(i12) and stored request req(i12…n), stored in the vertex i12… through the node i, the node 1,…, the node n; request is transmitted through a node more instance, request req (11), stored in vertex 11, in therefore, name 1 appears twice in vertex name that the stored request is sent from node i in th names. The node name list contains the names Figure 6 shows an example of rg-tree. + 1 = 2, where n C is the number of nodes in the CC-layer) are required to execute Agreement. In this example, there are five nodes in the CC-layer and cloud node c 3 is assumed to have a malicious fault. Figure 7i is the initial value of each node in the CC-layer. During the first round of Request Gathering Step, each node of the CC-layer transmits the initial value to all nodes of the CC-layer and stores the received n C (=5) values in the corresponding root of each rg-tree simultaneously, as shown in Figure 7j. In the second round, each node transmits the values in the root of the corresponding rg-tree to other nodes in the CC-layer simultaneously, and stores the received values in level 1 of the n C (=5) corresponding rg-trees. The progression of nodes c 1 and c 4 during Request Gathering Step is shown in Figure 7k,m. Subsequently, in the Request Deciding Step, the rg-tree is reorganized and the corresponding rg-tree of nodes c 1 and c 4 is shown in Figure 7l,n. Then, function VOTE is applied on the rg-tree root of each node to take the majority value.
The majority value obtained through function Agreement is mapped to a traffic status. The IC value is a vector, and each element in the vector is the majority value obtained through Agreement function. Each element is used to present the request of a specific application. The IC value of nodes c 1 and c 4 is shown in Figure 7o. Eventually, an agreement is reached in MIoT. Finally, the service of traffic control system can be supported by each cloud node in the CC-layer.

The Complexity of MECAA
The following theorems are used to prove the complexity of MECAA, following the method of [21]. The complexity of MECAA is evaluated in terms of (1) the minimal number of rounds of message exchanges, and (2) the maximum number of allowable faulty nodes. Theorems 1 and 2 below will show that the optimal solution is reached.

Theorem 1. The number of required rounds of message exchanges by MECAA is the minimum.
Proof: The total number of required rounds of message exchanges by MECAA can be discussed by two layers of MIoT.
(1) MEC-layer: Because message passing is required only in the Request Gathering Step, the Request Gathering Step is time consuming. Dolev and Reischuk pointed out that parameters of Agreement include σ, vs, and nA, w the number of nodes participating in the agree node must collect enough exchanged messag exchanging the received values helps fault-free Fischer and Lynch proved that (n-1)/3+ agreement problem, where n is the number of of Fischer and Lynch, (n-1)/3+1 rounds of agreement problem. Therefore, the required ro Agreement of procedure Consensus, where nEj is nEj>3. Moreover, the required rounds σ is (nC procedure Interactive Consistency, where nC is th

 
The received messages of Request G request-gathering tree (rg-tree), which is simila maintains such an rg-tree during the execution node i transmits its initial request to other nod sender of a request is assumed. When a fault received value, denoted as req(i), at the root of value of its rg-tree to all other nodes. If node 1 request, denoted as req(i1), in vertex i1 of its r received request is named req(i12) and stored request req(i12…n), stored in the vertex i12… through the node i, the node 1,…, the node n; request is transmitted through a node more instance, request req (11), stored in vertex 11, in therefore, name 1 appears twice in vertex name that the stored request is sent from node i in th names. The node name list contains the names Figure 6 shows an example of rg-tree.
(n-1)/3 the number of nodes participating in t node must collect enough exchange exchanging the received values helps f Fischer and Lynch proved that agreement problem, where n is the nu of Fischer and Lynch, (n-1)/3+1 ro agreement problem. Therefore, the req Agreement of procedure Consensus, wh nEj>3. Moreover, the required rounds procedure Interactive Consistency, wher

 
The received messages of Re request-gathering tree (rg-tree), which maintains such an rg-tree during the node i transmits its initial request to o sender of a request is assumed. Whe received value, denoted as req(i), at th value of its rg-tree to all other nodes. I request, denoted as req(i1), in vertex i received request is named req(i12) and request req(i12…n), stored in the vert through the node i, the node 1,…, the request is transmitted through a nod instance, request req (11), stored in ver therefore, name 1 appears twice in ver that the stored request is sent from no names. The node name list contains th Figure 6 shows an example of rg-tree. + 1 rounds are the minimum number of rounds to send sufficient messages to achieve agreement in an n-node fallible distributed system [21]. However, in the fallible MEC-layer, the MEC nodes maybe in malicious fault. In addition, each node in the fallible MEC-layer must exchange messages with other nodes. Therefore, a constraint on the minimum number of rounds can be applied to the study. In other words, in the MEC-layer, there are n Ej nodes in the MEC cluster E j ; MECAA needs MECAA is initiated by the UEs to ask for a specific application service. The nodes of MEC-layer need to execute procedure Consensus and the nodes of CC-layer need to execute procedure Interactive Consistency. In procedures Consensus and Interactive Consistency, the function Agreement will be called up. There are two steps of function Agreement, one is the Request Gathering Step, and the other is the Request Deciding Step. The parameters of Agreement include σ, vs, and nA, where σ is the required rounds, vs is the initial value, and nA is the number of nodes participating in the agreement. In order for all fault-free nodes to reach agreement, each node must collect enough exchanged messages from all other nodes if they are fault-free. As a result, exchanging the received values helps fault-free nodes to collect enough exchanged messages.
Fischer and Lynch proved that (n-1)/3+1 is the rounds of message exchanges sufficient to solve an agreement problem, where n is the number of nodes in the underlying network [17][18]. Based on the works of Fischer and Lynch, (n-1)/3+1 rounds of message exchanges are the lower bound for solving the agreement problem. Therefore, the required rounds σ is (nEj-1)/3+1 when MEC nodes execute the function Agreement of procedure Consensus, where nEj is the number of MEC nodes in MEC cluster Ej of MEC-layer and nEj>3. Moreover, the required rounds σ is (nC-1)/3+1 when cloud nodes execute the function Agreement of procedure Interactive Consistency, where nC is the number of cloud nodes in the CC-layer and nC>3.

 
The received messages of Request Gathering Step are stored in a tree structure called the request-gathering tree (rg-tree), which is similar to that proposed by Bar-Noy et al. [19]. Each fault-free node maintains such an rg-tree during the execution of MECAA. In the first round of the Request Gathering Step, node i transmits its initial request to other nodes. However, that each receiver node can always identify the sender of a request is assumed. When a fault-free node receives the request sent from node i, it stores the received value, denoted as req(i), at the root of its rg-tree. In the second round, each node transmits the root value of its rg-tree to all other nodes. If node 1 sends request req(i) to node 2, then node 2 stores the received request, denoted as req(i1), in vertex i1 of its rg-tree. Similarly, if node 2 sends request req(i1) to node 1, the received request is named req(i12) and stored in vertex i12 of node 1's rg-tree in the third round. Generally, request req(i12…n), stored in the vertex i12…n of a rg-tree, implies that the request just received was sent through the node i, the node 1,…, the node n; and the node n is the latest node to pass the request. When a request is transmitted through a node more than once, the name of the node will also be repeated. For instance, request req (11), stored in vertex 11, indicates that the request is sent to node 1, then to node 1 again; therefore, name 1 appears twice in vertex name 11. In summary, the root of rg-tree is always named i to denote that the stored request is sent from node i in the first round; the vertex of an rg-tree is labeled by a list of node names. The node name list contains the names of the nodes through which the stored request was transferred. Figure 6 shows an example of rg-tree.
MECAA is initiated by the UEs to ask for a specific application service. The nodes of MEC-la execute procedure Consensus and the nodes of CC-layer need to execute procedure Interactive Con procedures Consensus and Interactive Consistency, the function Agreement will be called up. The steps of function Agreement, one is the Request Gathering Step, and the other is the Request Decidin parameters of Agreement include σ, vs, and nA, where σ is the required rounds, vs is the initial valu the number of nodes participating in the agreement. In order for all fault-free nodes to reach agree node must collect enough exchanged messages from all other nodes if they are fault-free. A exchanging the received values helps fault-free nodes to collect enough exchanged messages.
Fischer and Lynch proved that (n-1)/3+1 is the rounds of message exchanges sufficient agreement problem, where n is the number of nodes in the underlying network [17][18]. Based on of Fischer and Lynch, (n-1)/3+1 rounds of message exchanges are the lower bound for s agreement problem. Therefore, the required rounds σ is (nEj-1)/3+1 when MEC nodes execute t Agreement of procedure Consensus, where nEj is the number of MEC nodes in MEC cluster Ej of MEC nEj>3. Moreover, the required rounds σ is (nC-1)/3+1 when cloud nodes execute the function A procedure Interactive Consistency, where nC is the number of cloud nodes in the CC-layer and nC>3.

 
The received messages of Request Gathering Step are stored in a tree structure request-gathering tree (rg-tree), which is similar to that proposed by Bar-Noy et al. [19]. Each faul maintains such an rg-tree during the execution of MECAA. In the first round of the Request Gat node i transmits its initial request to other nodes. However, that each receiver node can always i sender of a request is assumed. When a fault-free node receives the request sent from node i, i received value, denoted as req(i), at the root of its rg-tree. In the second round, each node transm value of its rg-tree to all other nodes. If node 1 sends request req(i) to node 2, then node 2 stores t request, denoted as req(i1), in vertex i1 of its rg-tree. Similarly, if node 2 sends request req(i1) to received request is named req(i12) and stored in vertex i12 of node 1's rg-tree in the third round. request req(i12…n), stored in the vertex i12…n of a rg-tree, implies that the request just receive through the node i, the node 1,…, the node n; and the node n is the latest node to pass the reque request is transmitted through a node more than once, the name of the node will also be rep instance, request req (11), stored in vertex 11, indicates that the request is sent to node 1, then to no therefore, name 1 appears twice in vertex name 11. In summary, the root of rg-tree is always named that the stored request is sent from node i in the first round; the vertex of an rg-tree is labeled by a names. The node name list contains the names of the nodes through which the stored request was t Figure 6 shows an example of rg-tree. + 1 rounds to exchange messages. In an E-clusters MEC-layer, the nodes in each MEC cluster execute MECAA simultaneously, where E is the total number of clusters in the MEC-layer of MIoT. Therefore, the required rounds for executing MECAA by each node in all MEC clusters depend on the number of nodes in the MEC cluster.
(2) CC-layer: As in the discussion of the number of message exchanges required in the MEC-layer.
In the CC-layer, the research of Dolev and Reischuk can still be applied [21]. In the CC-layer, there are n C nodes; MECAA needs MECAA is initiated by the UEs to ask for a specific application service. The n execute procedure Consensus and the nodes of CC-layer need to execute procedu procedures Consensus and Interactive Consistency, the function Agreement will b steps of function Agreement, one is the Request Gathering Step, and the other is the parameters of Agreement include σ, vs, and nA, where σ is the required rounds, vs i the number of nodes participating in the agreement. In order for all fault-free nod node must collect enough exchanged messages from all other nodes if they exchanging the received values helps fault-free nodes to collect enough exchanged Fischer and Lynch proved that (n-1)/3+1 is the rounds of message excha agreement problem, where n is the number of nodes in the underlying network [ of Fischer and Lynch, (n-1)/3+1 rounds of message exchanges are the low agreement problem. Therefore, the required rounds σ is (nEj-1)/3+1 when MEC Agreement of procedure Consensus, where nEj is the number of MEC nodes in MEC nEj>3. Moreover, the required rounds σ is (nC-1)/3+1 when cloud nodes execut procedure Interactive Consistency, where nC is the number of cloud nodes in the CC

 
The received messages of Request Gathering Step are stored in a request-gathering tree (rg-tree), which is similar to that proposed by Bar-Noy et a maintains such an rg-tree during the execution of MECAA. In the first round of node i transmits its initial request to other nodes. However, that each receiver no sender of a request is assumed. When a fault-free node receives the request sen received value, denoted as req(i), at the root of its rg-tree. In the second round, ea value of its rg-tree to all other nodes. If node 1 sends request req(i) to node 2, then request, denoted as req(i1), in vertex i1 of its rg-tree. Similarly, if node 2 sends re received request is named req(i12) and stored in vertex i12 of node 1's rg-tree in request req(i12…n), stored in the vertex i12…n of a rg-tree, implies that the req through the node i, the node 1,…, the node n; and the node n is the latest node t request is transmitted through a node more than once, the name of the node instance, request req (11), stored in vertex 11, indicates that the request is sent to n therefore, name 1 appears twice in vertex name 11. In summary, the root of rg-tree that the stored request is sent from node i in the first round; the vertex of an rg-tre names. The node name list contains the names of the nodes through which the stor Figure 6 shows an example of rg-tree.
(n C − 1)/3 Figure 5. The progression steps of MEC MECAA is initiated by the UEs to ask for a specific application s execute procedure Consensus and the nodes of CC-layer need to execu procedures Consensus and Interactive Consistency, the function Agree steps of function Agreement, one is the Request Gathering Step, and the parameters of Agreement include σ, vs, and nA, where σ is the required the number of nodes participating in the agreement. In order for all fa node must collect enough exchanged messages from all other nod exchanging the received values helps fault-free nodes to collect enoug Fischer and Lynch proved that (n-1)/3+1 is the rounds of me agreement problem, where n is the number of nodes in the underlyin of Fischer and Lynch, (n-1)/3+1 rounds of message exchanges agreement problem. Therefore, the required rounds σ is (nEj-1)/3+1 Agreement of procedure Consensus, where nEj is the number of MEC no nEj>3. Moreover, the required rounds σ is (nC-1)/3+1 when cloud n procedure Interactive Consistency, where nC is the number of cloud nod   The received messages of Request Gathering Step are sto request-gathering tree (rg-tree), which is similar to that proposed by B maintains such an rg-tree during the execution of MECAA. In the fi node i transmits its initial request to other nodes. However, that each sender of a request is assumed. When a fault-free node receives the received value, denoted as req(i), at the root of its rg-tree. In the secon value of its rg-tree to all other nodes. If node 1 sends request req(i) to request, denoted as req(i1), in vertex i1 of its rg-tree. Similarly, if nod received request is named req(i12) and stored in vertex i12 of node 1 request req(i12…n), stored in the vertex i12…n of a rg-tree, implies t through the node i, the node 1,…, the node n; and the node n is the l request is transmitted through a node more than once, the name o instance, request req (11), stored in vertex 11, indicates that the request therefore, name 1 appears twice in vertex name 11. In summary, the ro that the stored request is sent from node i in the first round; the vertex names. The node name list contains the names of the nodes through w Figure 6 shows an example of rg-tree. (1) MEC-layer: Fischer and Lynch indicate the lower bound for agreement problem for node faults as f ≤ provide an integrated service such as connecting vehicles, smart cities, and shopping centers. The progression steps of MECAA are shown in Figure 5. MECAA is initiated by the UEs to ask for a specific application service. The nodes of MEC-layer need to execute procedure Consensus and the nodes of CC-layer need to execute procedure Interactive Consistency. In procedures Consensus and Interactive Consistency, the function Agreement will be called up. There are two steps of function Agreement, one is the Request Gathering Step, and the other is the Request Deciding Step. The parameters of Agreement include σ, vs, and nA, where σ is the required rounds, vs is the initial value, and nA is the number of nodes participating in the agreement. In order for all fault-free nodes to reach agreement, each node must collect enough exchanged messages from all other nodes if they are fault-free. As a result, exchanging the received values helps fault-free nodes to collect enough exchanged messages.
Fischer and Lynch proved that (n-1)/3+1 is the rounds of message exchanges sufficient to solve an agreement problem, where n is the number of nodes in the underlying network [17][18]. Based on the works of Fischer and Lynch, (n-1)/3+1 rounds of message exchanges are the lower bound for solving the agreement problem. Therefore, the required rounds σ is (nEj-1)/3+1 when MEC nodes execute the function Agreement of procedure Consensus, where nEj is the number of MEC nodes in MEC cluster Ej of MEC-layer and nEj>3. Moreover, the required rounds σ is (nC-1)/3+1 when cloud nodes execute the function Agreement of procedure Interactive Consistency, where nC is the number of cloud nodes in the CC-layer and nC>3.

 
The received messages of Request Gathering Step are stored in a tree structure called the request-gathering tree (rg-tree), which is similar to that proposed by Bar-Noy et al. [19]. Each fault-free node maintains such an rg-tree during the execution of MECAA. In the first round of the Request Gathering Step, node i transmits its initial request to other nodes. However, that each receiver node can always identify the sender of a request is assumed. When a fault-free node receives the request sent from node i, it stores the received value, denoted as req(i), at the root of its rg-tree. In the second round, each node transmits the root value of its rg-tree to all other nodes. If node 1 sends request req(i) to node 2, then node 2 stores the received request, denoted as req(i1), in vertex i1 of its rg-tree. Similarly, if node 2 sends request req(i1) to node 1, the received request is named req(i12) and stored in vertex i12 of node 1's rg-tree in the third round. Generally, request req(i12…n), stored in the vertex i12…n of a rg-tree, implies that the request just received was sent through the node i, the node 1,…, the node n; and the node n is the latest node to pass the request. When a request is transmitted through a node more than once, the name of the node will also be repeated. For instance, request req (11), stored in vertex 11, indicates that the request is sent to node 1, then to node 1 again; therefore, name 1 appears twice in vertex name 11. In summary, the root of rg-tree is always named i to denote that the stored request is sent from node i in the first round; the vertex of an rg-tree is labeled by a list of node names. The node name list contains the names of the nodes through which the stored request was transferred. Figure 6 shows an example of rg-tree.
provide an integrated service such as connecting vehicles, smart cities, and shopping cen progression steps of MECAA are shown in Figure 5. MECAA is initiated by the UEs to ask for a specific application service. The nodes of MEC-lay execute procedure Consensus and the nodes of CC-layer need to execute procedure Interactive Cons procedures Consensus and Interactive Consistency, the function Agreement will be called up. Ther steps of function Agreement, one is the Request Gathering Step, and the other is the Request Deciding parameters of Agreement include σ, vs, and nA, where σ is the required rounds, vs is the initial value the number of nodes participating in the agreement. In order for all fault-free nodes to reach agreem node must collect enough exchanged messages from all other nodes if they are fault-free. As exchanging the received values helps fault-free nodes to collect enough exchanged messages.
Fischer and Lynch proved that (n-1)/3+1 is the rounds of message exchanges sufficient to agreement problem, where n is the number of nodes in the underlying network [17][18]. Based on of Fischer and Lynch, (n-1)/3+1 rounds of message exchanges are the lower bound for so agreement problem. Therefore, the required rounds σ is (nEj-1)/3+1 when MEC nodes execute the Agreement of procedure Consensus, where nEj is the number of MEC nodes in MEC cluster Ej of MEC nEj>3. Moreover, the required rounds σ is (nC-1)/3+1 when cloud nodes execute the function Ag procedure Interactive Consistency, where nC is the number of cloud nodes in the CC-layer and nC>3.

 
The received messages of Request Gathering Step are stored in a tree structure c request-gathering tree (rg-tree), which is similar to that proposed by Bar-Noy et al. [19]. Each faultmaintains such an rg-tree during the execution of MECAA. In the first round of the Request Gath node i transmits its initial request to other nodes. However, that each receiver node can always id sender of a request is assumed. When a fault-free node receives the request sent from node i, it received value, denoted as req(i), at the root of its rg-tree. In the second round, each node transmit value of its rg-tree to all other nodes. If node 1 sends request req(i) to node 2, then node 2 stores the request, denoted as req(i1), in vertex i1 of its rg-tree. Similarly, if node 2 sends request req(i1) to n received request is named req(i12) and stored in vertex i12 of node 1's rg-tree in the third round. G request req(i12…n), stored in the vertex i12…n of a rg-tree, implies that the request just received through the node i, the node 1,…, the node n; and the node n is the latest node to pass the reques request is transmitted through a node more than once, the name of the node will also be repe instance, request req (11), stored in vertex 11, indicates that the request is sent to node 1, then to nod therefore, name 1 appears twice in vertex name 11. In summary, the root of rg-tree is always named i that the stored request is sent from node i in the first round; the vertex of an rg-tree is labeled by a li names. The node name list contains the names of the nodes through which the stored request was tr Figure 6 shows an example of rg-tree.
, where f is the total number of allowable malicious faulty nodes and n is the total number of nodes in a distributed computing system [17]. Therefore, f ≤ Symmetry 2019, 11,167 provide an integrated service such progression steps of MECAA are shown Figur MECAA is initiated by the UEs to a execute procedure Consensus and the no procedures Consensus and Interactive C steps of function Agreement, one is the R parameters of Agreement include σ, vs, an the number of nodes participating in the node must collect enough exchanged exchanging the received values helps fau Fischer and Lynch proved that (n agreement problem, where n is the num of Fischer and Lynch, (n-1)/3+1 rou agreement problem. Therefore, the requ Agreement of procedure Consensus, wher nEj>3. Moreover, the required rounds σ procedure Interactive Consistency, where

 
The received messages of Requ request-gathering tree (rg-tree), which is maintains such an rg-tree during the ex node i transmits its initial request to oth sender of a request is assumed. When received value, denoted as req(i), at the value of its rg-tree to all other nodes. If n request, denoted as req(i1), in vertex i1 received request is named req(i12) and s request req(i12…n), stored in the vertex through the node i, the node 1,…, the n request is transmitted through a node instance, request req (11), stored in vertex therefore, name 1 appears twice in vertex that the stored request is sent from node names. The node name list contains the n Figure 6 shows an example of rg-tree. The received messages request-gathering tree (rg-tree maintains such an rg-tree dur node i transmits its initial req sender of a request is assum received value, denoted as re value of its rg-tree to all other request, denoted as req(i1), in received request is named req request req(i12…n), stored in through the node i, the node request is transmitted throug instance, request req (11), store therefore, name 1 appears twi that the stored request is sent names. The node name list con Figure 6 shows an example of in the study of Fischer and Lynch [17] can be applied to f mEj ≤ Symmetry 2019, 11,167 provide an integrated service such as connecting vehic progression steps of MECAA are shown in Figure 5. MECAA is initiated by the UEs to ask for a specific app execute procedure Consensus and the nodes of CC-layer nee procedures Consensus and Interactive Consistency, the funct steps of function Agreement, one is the Request Gathering Step parameters of Agreement include σ, vs, and nA, where σ is the the number of nodes participating in the agreement. In order node must collect enough exchanged messages from all exchanging the received values helps fault-free nodes to colle Fischer and Lynch proved that (n-1)/3+1 is the roun agreement problem, where n is the number of nodes in the u of Fischer and Lynch, (n-1)/3+1 rounds of message ex agreement problem. Therefore, the required rounds σ is (nE Agreement of procedure Consensus, where nEj is the number o nEj>3. Moreover, the required rounds σ is (nC-1)/3+1 when procedure Interactive Consistency, where nC is the number of c

 
The received messages of Request Gathering Step request-gathering tree (rg-tree), which is similar to that prop maintains such an rg-tree during the execution of MECAA. node i transmits its initial request to other nodes. However, sender of a request is assumed. When a fault-free node rec received value, denoted as req(i), at the root of its rg-tree. In value of its rg-tree to all other nodes. If node 1 sends request request, denoted as req(i1), in vertex i1 of its rg-tree. Similar received request is named req(i12) and stored in vertex i12 o request req(i12…n), stored in the vertex i12…n of a rg-tree, through the node i, the node 1,…, the node n; and the node request is transmitted through a node more than once, th instance, request req (11), stored in vertex 11, indicates that th therefore, name 1 appears twice in vertex name 11. In summa that the stored request is sent from node i in the first round; names. The node name list contains the names of the nodes th Figure 6 shows an example of rg-tree.  MECAA is initiated by the UEs to ask for a execute procedure Consensus and the nodes of C procedures Consensus and Interactive Consistenc steps of function Agreement, one is the Request G parameters of Agreement include σ, vs, and nA, w the number of nodes participating in the agreem node must collect enough exchanged message exchanging the received values helps fault-free n Fischer and Lynch proved that (n-1)/3+1 agreement problem, where n is the number of n of Fischer and Lynch, (n-1)/3+1 rounds of agreement problem. Therefore, the required rou Agreement of procedure Consensus, where nEj is th nEj>3. Moreover, the required rounds σ is (nC-1 procedure Interactive Consistency, where nC is the   The received messages of Request Gat request-gathering tree (rg-tree), which is similar maintains such an rg-tree during the execution node i transmits its initial request to other node sender of a request is assumed. When a fault-f received value, denoted as req(i), at the root of i value of its rg-tree to all other nodes. If node 1 s request, denoted as req(i1), in vertex i1 of its rg received request is named req(i12) and stored in request req(i12…n), stored in the vertex i12…n through the node i, the node 1,…, the node n; a request is transmitted through a node more th instance, request req (11), stored in vertex 11, ind therefore, name 1 appears twice in vertex name 1 that the stored request is sent from node i in the names. The node name list contains the names of Figure 6 shows an example of rg-tree.
in the MEC-layer, where f mEj is the total number of allowable malicious faulty MEC nodes in MEC cluster E j and n Ej is the number of nodes in MEC cluster E j . Then, T FE = ∑ E j=1 f mEj where E is the total number of MEC clusters in the MEC-layer of MIoT, and T FE is the total number of allowable faulty nodes in the MEC-layer.
(2) CC-layer: The research results of Fischer and Lynch [17] can also be applied to the CC-layer. Therefore, f mC is the total number of allowable faulty nodes in the CC-layer, and f mC ≤ provide an integrated service such as connecting vehicles, smart cities, and shopping centers. The progression steps of MECAA are shown in Figure 5. MECAA is initiated by the UEs to ask for a specific application service. The nodes of MEC-layer need to execute procedure Consensus and the nodes of CC-layer need to execute procedure Interactive Consistency. In procedures Consensus and Interactive Consistency, the function Agreement will be called up. There are two steps of function Agreement, one is the Request Gathering Step, and the other is the Request Deciding Step. The parameters of Agreement include σ, vs, and nA, where σ is the required rounds, vs is the initial value, and nA is the number of nodes participating in the agreement. In order for all fault-free nodes to reach agreement, each node must collect enough exchanged messages from all other nodes if they are fault-free. As a result, exchanging the received values helps fault-free nodes to collect enough exchanged messages.
Fischer and Lynch proved that (n-1)/3+1 is the rounds of message exchanges sufficient to solve an agreement problem, where n is the number of nodes in the underlying network [17][18]. Based on the works of Fischer and Lynch, (n-1)/3+1 rounds of message exchanges are the lower bound for solving the agreement problem. Therefore, the required rounds σ is (nEj-1)/3+1 when MEC nodes execute the function Agreement of procedure Consensus, where nEj is the number of MEC nodes in MEC cluster Ej of MEC-layer and nEj>3. Moreover, the required rounds σ is (nC-1)/3+1 when cloud nodes execute the function Agreement of procedure Interactive Consistency, where nC is the number of cloud nodes in the CC-layer and nC>3.

 
The received messages of Request Gathering Step are stored in a tree structure called the request-gathering tree (rg-tree), which is similar to that proposed by Bar-Noy et al. [19]. Each fault-free node maintains such an rg-tree during the execution of MECAA. In the first round of the Request Gathering Step, node i transmits its initial request to other nodes. However, that each receiver node can always identify the sender of a request is assumed. When a fault-free node receives the request sent from node i, it stores the received value, denoted as req(i), at the root of its rg-tree. In the second round, each node transmits the root value of its rg-tree to all other nodes. If node 1 sends request req(i) to node 2, then node 2 stores the received request, denoted as req(i1), in vertex i1 of its rg-tree. Similarly, if node 2 sends request req(i1) to node 1, the received request is named req(i12) and stored in vertex i12 of node 1's rg-tree in the third round. Generally, request req(i12…n), stored in the vertex i12…n of a rg-tree, implies that the request just received was sent through the node i, the node 1,…, the node n; and the node n is the latest node to pass the request. When a request is transmitted through a node more than once, the name of the node will also be repeated. For instance, request req (11), stored in vertex 11, indicates that the request is sent to node 1, then to node 1 again; therefore, name 1 appears twice in vertex name 11. In summary, the root of rg-tree is always named i to denote that the stored request is sent from node i in the first round; the vertex of an rg-tree is labeled by a list of node names. The node name list contains the names of the nodes through which the stored request was transferred. Figure 6 shows an example of rg-tree.
(n C − 1)/3 Symmetry 2019, 11,167 provide an integrated service such as connecting vehicles, smart cities, and shopping ce progression steps of MECAA are shown in Figure 5. MECAA is initiated by the UEs to ask for a specific application service. The nodes of MEC-lay execute procedure Consensus and the nodes of CC-layer need to execute procedure Interactive Con procedures Consensus and Interactive Consistency, the function Agreement will be called up. The steps of function Agreement, one is the Request Gathering Step, and the other is the Request Decidin parameters of Agreement include σ, vs, and nA, where σ is the required rounds, vs is the initial value the number of nodes participating in the agreement. In order for all fault-free nodes to reach agree node must collect enough exchanged messages from all other nodes if they are fault-free. A exchanging the received values helps fault-free nodes to collect enough exchanged messages.
Fischer and Lynch proved that (n-1)/3+1 is the rounds of message exchanges sufficient t agreement problem, where n is the number of nodes in the underlying network [17][18]. Based on of Fischer and Lynch, (n-1)/3+1 rounds of message exchanges are the lower bound for s agreement problem. Therefore, the required rounds σ is (nEj-1)/3+1 when MEC nodes execute th Agreement of procedure Consensus, where nEj is the number of MEC nodes in MEC cluster Ej of MEC nEj>3. Moreover, the required rounds σ is (nC-1)/3+1 when cloud nodes execute the function Ag procedure Interactive Consistency, where nC is the number of cloud nodes in the CC-layer and nC>3.

 
The received messages of Request Gathering Step are stored in a tree structure request-gathering tree (rg-tree), which is similar to that proposed by Bar-Noy et al. [19]. Each faul maintains such an rg-tree during the execution of MECAA. In the first round of the Request Gath node i transmits its initial request to other nodes. However, that each receiver node can always i sender of a request is assumed. When a fault-free node receives the request sent from node i, it received value, denoted as req(i), at the root of its rg-tree. In the second round, each node transm value of its rg-tree to all other nodes. If node 1 sends request req(i) to node 2, then node 2 stores th request, denoted as req(i1), in vertex i1 of its rg-tree. Similarly, if node 2 sends request req(i1) to n received request is named req(i12) and stored in vertex i12 of node 1's rg-tree in the third round. request req(i12…n), stored in the vertex i12…n of a rg-tree, implies that the request just received through the node i, the node 1,…, the node n; and the node n is the latest node to pass the reque request is transmitted through a node more than once, the name of the node will also be rep instance, request req (11), stored in vertex 11, indicates that the request is sent to node 1, then to no therefore, name 1 appears twice in vertex name 11. In summary, the root of rg-tree is always named that the stored request is sent from node i in the first round; the vertex of an rg-tree is labeled by a l names. The node name list contains the names of the nodes through which the stored request was t Figure 6 shows an example of rg-tree.
where n C is the number of cloud nodes.
In summary, the maximum number of allowable faulty components by MECAA is T = T FE + f mC = ∑ E j=1 f mEj + Symmetry 2019, 11, 167 7 of 1 provide an integrated service such as connecting vehicles, smart cities, and shopping centers. Th progression steps of MECAA are shown in Figure 5. MECAA is initiated by the UEs to ask for a specific application service. The nodes of MEC-layer need t execute procedure Consensus and the nodes of CC-layer need to execute procedure Interactive Consistency. I procedures Consensus and Interactive Consistency, the function Agreement will be called up. There are tw steps of function Agreement, one is the Request Gathering Step, and the other is the Request Deciding Step. Th parameters of Agreement include σ, vs, and nA, where σ is the required rounds, vs is the initial value, and nA i the number of nodes participating in the agreement. In order for all fault-free nodes to reach agreement, eac node must collect enough exchanged messages from all other nodes if they are fault-free. As a resul exchanging the received values helps fault-free nodes to collect enough exchanged messages.
Fischer and Lynch proved that (n-1)/3+1 is the rounds of message exchanges sufficient to solve a agreement problem, where n is the number of nodes in the underlying network [17][18]. Based on the work of Fischer and Lynch, (n-1)/3+1 rounds of message exchanges are the lower bound for solving th agreement problem. Therefore, the required rounds σ is (nEj-1)/3+1 when MEC nodes execute the functio Agreement of procedure Consensus, where nEj is the number of MEC nodes in MEC cluster Ej of MEC-layer an nEj>3. Moreover, the required rounds σ is (nC-1)/3+1 when cloud nodes execute the function Agreement o procedure Interactive Consistency, where nC is the number of cloud nodes in the CC-layer and nC>3.

 
The received messages of Request Gathering Step are stored in a tree structure called th request-gathering tree (rg-tree), which is similar to that proposed by Bar-Noy et al. [19]. Each fault-free nod maintains such an rg-tree during the execution of MECAA. In the first round of the Request Gathering Step node i transmits its initial request to other nodes. However, that each receiver node can always identify th sender of a request is assumed. When a fault-free node receives the request sent from node i, it stores th received value, denoted as req(i), at the root of its rg-tree. In the second round, each node transmits the roo value of its rg-tree to all other nodes. If node 1 sends request req(i) to node 2, then node 2 stores the receive request, denoted as req(i1), in vertex i1 of its rg-tree. Similarly, if node 2 sends request req(i1) to node 1, th received request is named req(i12) and stored in vertex i12 of node 1's rg-tree in the third round. Generally request req(i12…n), stored in the vertex i12…n of a rg-tree, implies that the request just received was sen through the node i, the node 1,…, the node n; and the node n is the latest node to pass the request. When request is transmitted through a node more than once, the name of the node will also be repeated. Fo instance, request req (11), stored in vertex 11, indicates that the request is sent to node 1, then to node 1 again therefore, name 1 appears twice in vertex name 11. In summary, the root of rg-tree is always named i to denot that the stored request is sent from node i in the first round; the vertex of an rg-tree is labeled by a list of nod names. The node name list contains the names of the nodes through which the stored request was transferred (n C -1)/3 Symmetry 2019, 11,167 provide an integrated service such as connecting vehicles, smart cities, and shopping ce progression steps of MECAA are shown in Figure 5. MECAA is initiated by the UEs to ask for a specific application service. The nodes of MEC-lay execute procedure Consensus and the nodes of CC-layer need to execute procedure Interactive Con procedures Consensus and Interactive Consistency, the function Agreement will be called up. The steps of function Agreement, one is the Request Gathering Step, and the other is the Request Decidin parameters of Agreement include σ, vs, and nA, where σ is the required rounds, vs is the initial value the number of nodes participating in the agreement. In order for all fault-free nodes to reach agree node must collect enough exchanged messages from all other nodes if they are fault-free. A exchanging the received values helps fault-free nodes to collect enough exchanged messages.
Fischer and Lynch proved that (n-1)/3+1 is the rounds of message exchanges sufficient t agreement problem, where n is the number of nodes in the underlying network [17][18]. Based on of Fischer and Lynch, (n-1)/3+1 rounds of message exchanges are the lower bound for s agreement problem. Therefore, the required rounds σ is (nEj-1)/3+1 when MEC nodes execute th Agreement of procedure Consensus, where nEj is the number of MEC nodes in MEC cluster Ej of MEC nEj>3. Moreover, the required rounds σ is (nC-1)/3+1 when cloud nodes execute the function Ag procedure Interactive Consistency, where nC is the number of cloud nodes in the CC-layer and nC>3.

 
The received messages of Request Gathering Step are stored in a tree structure request-gathering tree (rg-tree), which is similar to that proposed by Bar-Noy et al. [19]. Each faul maintains such an rg-tree during the execution of MECAA. In the first round of the Request Gath node i transmits its initial request to other nodes. However, that each receiver node can always i sender of a request is assumed. When a fault-free node receives the request sent from node i, it received value, denoted as req(i), at the root of its rg-tree. In the second round, each node transm value of its rg-tree to all other nodes. If node 1 sends request req(i) to node 2, then node 2 stores th request, denoted as req(i1), in vertex i1 of its rg-tree. Similarly, if node 2 sends request req(i1) to n received request is named req(i12) and stored in vertex i12 of node 1's rg-tree in the third round. request req(i12…n), stored in the vertex i12…n of a rg-tree, implies that the request just received through the node i, the node 1,…, the node n; and the node n is the latest node to pass the reque request is transmitted through a node more than once, the name of the node will also be rep instance, request req (11), stored in vertex 11, indicates that the request is sent to node 1, then to no therefore, name 1 appears twice in vertex name 11. In summary, the root of rg-tree is always named that the stored request is sent from node i in the first round; the vertex of an rg-tree is labeled by a l names. The node name list contains the names of the nodes through which the stored request was t Figure 6 shows an example of rg-tree.
. T is the maximum number of allowable faulty nodes in MIoT.
As a result, MECAA takes the minimum number of rounds and tolerates the maximum number of faulty components to make fault-free nodes reach a common agreement. The optimality of the polynomial time algorithm is proven.

Conclusions
The last decade has seen cloud computing emerging as a new paradigm of computing. The vast resources available in the cloud can be leveraged to deliver elastic computing power and storage to support resource-constrained end-user devices. However, for various reasons, the cloud computing paradigm cannot meet the low latency and jitter, environment awareness, and mobility support requirements that are important for several applications.
The long propagation delay is the main drawback of cloud computing. Therefore, proximity access through the MEC is widely considered to be a key technology for implementing various next-generation IoT visions. The IoT can achieve innovations that improve quality of life, but will generate an unprecedented amount of data that is difficult for traditional systems to handle. So, the MEC is designed to overcome these limitations [4]. The main goal of the MEC study is to seamlessly integrate the two disciplines of wireless communications and mobile computing to form a new design of offloading computation technology.
MEC extends the cloud computing paradigm to the edge of the network, thus enabling a new breed of applications and services [19]. While MEC nodes provide localization, therefore enabling low latency and context awareness, the cloud provides global centralization. In this study, a highly flexible and reliable IoT platform MIoT is proposed. By using MIoT, the QoS for IoT application services can be improved.
The agreement problem is fundamental to a distributed system, and has been extensively studied. Network topology is an important issue related to consistency. However, MIoT is a new concept for distributed systems. It has encouraged distributed system design and practice to support user-oriented services. In this study, the agreement problem was redefined by the MECAA algorithm in the MIoT. The proposed algorithm ensures that all faulty nodes in the MIoT can reach an agreement value to cope with the influences of the faulty nodes by using the minimum number of message exchanges, while tolerating the maximum number of faulty nodes at any time. Our algorithm is the first to treat the agreement problem under an IoT platform based on cloud computing and MEC. In the future, an experimental evaluation will be conducted to compare the efficiency of the algorithm under different faulty nodes.