{'fraction_non_alphanumeric': 0.02921552436003303, 'fraction_numerical': 0.005912469033856317, 'mean_word_length': 4.6415727196496785, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
PAD-MAC: Primary User Activity-Aware Distributed MAC for Multi-Channel Cognitive Radio Networks

Cognitive radio (CR) has emerged as a promising technology to solve problems related to spectrum scarcity and provides a ubiquitous wireless access environment. CR-enabled secondary users (SUs) exploit spectrum white spaces opportunistically and immediately vacate the acquired licensed channels as primary users (PUs) arrive. Accessing the licensed channels without the prior knowledge of PU traffic patterns causes severe throughput degradation due to excessive channel switching and PU-to-SU collisions. Therefore, it is significantly important to design a PU activity-aware medium access control (MAC) protocol for cognitive radio networks (CRNs). In this paper, we first propose a licensed channel usage pattern identification scheme, based on a two-state Markov model, and then estimate the future idle slots using previous observations of the channels. Furthermore, based on these past observations, we compute the rank of each available licensed channel that gives SU transmission success assessment during the estimated idle slot. Secondly, we propose a PU activity-aware distributed MAC (PAD-MAC) protocol for heterogeneous multi-channel CRNs that selects the best channel for each SU to enhance its throughput. PAD-MAC controls SU activities by allowing them to exploit the licensed channels only for the duration of estimated idle slots and enables predictive and fast channel switching. To evaluate the performance of the proposed PAD-MAC, we compare it with the distributed QoS-aware MAC (QC-MAC) and listen-before-talk MAC schemes. Extensive numerical results show the significant improvements of the PAD-MAC in terms of the SU throughput, SU channel switching rate and PU-to-SU collision rate.


Introduction
In the recent years, wireless communications and their applications have gained exponential growth, which has raised the demand for radio spectrum resources. Due to static spectrum allocation policies, the radio spectrum is running out; moreover, statistics show that its licensees are unable to fully utilize the radio spectrum and that between 15% and 80% of the assigned spectrum currently is being wasted in the most parts of the world [1]. A study conducted in the major cities of the United States in 2002 showed that the radio spectrum below 1 GHz remains mostly unused for long periods of time [2]. Therefore, the Federal Communication Commission (FCC) in the U.S. has begun to consider more flexible uses of the radio spectrum. The aim of the Next Generation program of the Defense Advanced Research Project Agency (DARPA) is to redistribute the allocated radio spectrum dynamically. Cognitive radio (CR) was introduced as the key technology for enabling dynamic spectrum access (DSA) [3] with the aim of providing a ubiquitous wireless access environment with seamless wireless connection [4,5]. CR-enabled secondary users (SUs) sense their surroundings in order to detect unused portions of the available radio frequencies and to adapt some of their operating parameters [6][7][8][9] accordingly.
Primary users (PUs) transmit a variety of applications with different traffic characteristics [10][11][12]. Hence, PU channel usage patterns over each licensed channel can vary and depend on the type of PU application; such behavior is illustrated in Figure 1. CR should be more than just a radio that takes immediate advantage of spectrum opportunities; it should also have the ability to learn from past experiences. Learning makes CR operations more efficient as compared to the case where the CR has only the information available when it was designed. Ideally, information collected during the lifetime of the CR should be used. However, the majority of research into cognitive radio networks (CRNs) has focused on methods that only use instantaneous information about the environment as a basis for dynamic operation. The available licensed channels for selection can be assumed to be equally good [13][14][15] or can be characterized based on their bandwidth [16][17][18] or interference level [19,20] to preferentially select the channels with the widest bandwidths or lowest interference levels. SUs sense their environments and react opportunistically to the estimated changes in the spectrum availability. Such a channel selection approach can result in the selection of a bad channel, because the SU randomly selects channels that could be heavily used by PUs (if that channel happened to be available during the channel sensing time). This may cause frequent service disruptions for SUs, since they have to refrain from transmission, resulting in severe interference to PUs and excessive channel switching, which results in low network throughput [21]. In addition, every instance of channel switching causes a non-negligible delay in the transmissions of SUs.
When multiple SUs come together to form single-hop networks, due to hardware variations in radio transceivers and spatial variations in PU licensed channel usage, different SUs in the networks can perceive different subsets of channels available to them for communication [22]. This heterogeneity in the available channel sets (i.e., spectrum heterogeneity) across the network makes the network heterogeneous. Therefore, we refer to such CR-enabled networks as heterogeneous CRNs. In this paper, we investigate a PU activity-aware distributed medium access control (PAD-MAC) protocol for multi-channel heterogeneous CRNs with the objective of fully utilizing the advanced capabilities provided by CR to optimize network performance and avoid harmful interference with PUs. To achieve this goal, each SU monitors a list of licensed channels and estimates the idle slots over each monitored channel. PAD-MAC allocates the available channels to each individual SU based on cross-layer sensing, such as PHY-layer sensing used to monitor the PU traffic usage patterns and channel availability at any particular time. MAC-layer sensing is used to further avoid PU-to-SU or SU-to-SU interference. Moreover, PAD-MAC restricts each SU to exploiting the licensed channel only for the duration of the estimated idle time. The key contributions and results of this paper are as follows: • We propose a PHY-layer-based channel usage pattern identification scheme using a two-state Markov model. We estimate the minimum transmission opportunity length (Min TOL) and maximum transmission opportunity length (Max TOL) using continuous PHY-layer channel monitoring. Furthermore, based on PHY-layer monitored parameters, we compute the rank of each individual idle channel, which quantify the SU transmission success or failure over the corresponding channel. • By exploiting the knowledge of the estimated idle period, we introduce a predictive and fast channel switching scheme that maximizes SU spectrum occupancy and minimizes the disruption rate for PUs. • We develop an imperative association among the Min TOL, Max TOL and standard deviation of the Min TOL that helps to predict the PU traffic patterns, future idle and busy slots for a particular licensed channel. • We propose a channel-locking mechanism that reserves a channel for the transmission of SU and eliminates SU-to-SU interference. • We design a PU activity-aware distributed MAC protocol for multi-channel heterogeneous CRNs with the prime objectives to maximize network capacity and to minimize the PU-to-SU collision rate and SU channel switching rate. PAD-MAC achieves these goals by selecting the optimal channel, utilizing it only for the duration of its estimated Min TOL and employing the fast and predictive channel switching scheme. Moreover, PAD-MAC also resolves SU-to-SU interference. We validate the performance of this protocol with the distributed QoS-aware MAC (QC-MAC) and listen-before-talk MAC to prove its significance.
The rest of the paper is organized as follows. In Section 2, we discuss some background knowledge and state-of-the-art research concerning channel selection and SU data transmission strategies. Section 3 outlines the system models. Section 4 presents the detailed overview and design objectives of the proposed PAD-MAC protocol for SU channel selection and data transmission. Section 5 describes the numerical results and experimental setups. In Section 6, we discuss the simulation results. Finally, the paper is concluded with some suggested future work in Section 7.

Related Work
In this section, we discuss some background information and state-of-the-art research in the area of MAC protocols for channel selection and data transmission for SUs. The design of MAC protocols for multi-channel CRNs differs from that of classic MAC protocols for wireless and wired networks. MAC protocols for CRNs should be closely coupled between physical and MAC layers, i.e., spectrum opportunities that are detected on the physical layer and MAC layer perform spectrum sensing and allocation.
A decentralized cognitive MAC (DC-MAC) protocol for CRNs is proposed in [23], in which the authors introduced a new channel access policy that requires partial knowledge of the states of the channels for every SU. The DC-MAC uses the theory of the partially observable Markov decision process (POMDP), where the traffic characteristics of PUs are modeled using the Markov chain. This accesses channels on the basis of the expected reward-based suboptimal greedy approach. However, the implementation of DC-MAC is limited by the assumption that the transition probabilities in the Markov channel model are given, which is not yet feasible in practice. For efficient spectrum management in CRNs, a hardware-constrained MAC (HC-MAC) protocol [24] was proposed by Jia et al. to deal with channel access without requiring global synchronization among all SUs. A sender and receiver are required to become synchronized before data transmission and synchronization is performed using S-RTS /S-CTS messages. HC-MAC divides each time frame into three phases: the contention, sensing and transmission phases. A distributed multi-channel MAC for multi-hop CR (MMAC-CR) was proposed in [25]. MMAC-CR performs two stages of sensing: (1) fine sensing; and (2) cooperative detection. Channels are modeled using two states: Markov-chain ON-OFF states. If the sensed channel is determined to be idle, the SU sends a beacon packet in the corresponding mini slot via physical implementation of the AND rule. Channels are selected to minimize the expected interference, and the time frames are divided into two windows: (1) the ad hoc traffic indication message window; and (2) the DATA window. However, MMAC-CR requires tight synchronization within the network that strongly depends on the quality of the control channel. Moreover, use of the AND rule would be too aggressive with respect to the PUs.
Clustering-based MAC protocols for CRNs were proposed in [26,27]. In [26], Hamdaoui et al. introduced an opportunistic spectrum MAC (OS-MAC), based on coordination-based direct access in which SUs who want to communicate with each other are grouped together to form a cluster. Cluster heads are delegated SU nodes, which are responsible for acquiring the traffic load information of a channel and for propagating this information within their respective clusters. OS-MAC uses a probabilistic channel selection scheme to reduce the inter-cluster interference, and each time frame is divided into the select phase, update phase and delegate phase. However, OS-MAC does not address channel sensing and mobility functionalities; therefore, interference caused by PUs, which is a key role of CR, has not been implemented in OS-MAC. An opportunistic clustering-based spectrum access protocol for mesh CRNs was proposed in [27]. The objective of this proposal was to equally distribute the loads of SUs over the available licensed channels and to minimize the total amount of interference that is generated. The authors solved this problem using an integer linear programming (ILP)-based optimization. Each mesh router (MR), which also acts as a cluster head, shares the network state information, i.e., the number of SUs, the positions of their APs, occupied primary channels and estimated interference generated by SU mesh nodes. Resource optimization for wireless mesh networks using MAC-layer channel reassignment method is introduced in [28]. Authors solve this problem using ILP and proposed a polynomial time heuristic algorithm. Some other famous MAC protocols for CRNs are presented in [12,[29][30][31][32]. Zhao et al. proposed a heterogeneous distributed MAC (HD-MAC) [12] that selects the channels, based on the traffic load, connectivity and interference. In HD-MAC, SUs are organized into local groups where the MAC structure is divided into the beacon period, coordination window and data transmission period. A distributed QoS-aware MAC (QC-MAC) protocol for multi-channel CRNs was proposed in [29]. This exploits the PU traffic patterns to determine the channels set for MAC-layer sensing and data transmissions. It specifically deals with QoS-aware transmissions with the objective of minimizing the PU-to-SU collision rate. An IEEE 802.11-based MAC protocol for mesh CRNs was proposed in [30]. Here, every SU is equipped with two CR transceivers; one is dedicated to control information, and the second is utilized for the data transmissions of SUs. Each SU node senses the available channels and selects the long-term residency (LR) channels for exchanging control information. The prime objective of this protocol is to limit the use of the control channel and reduce the possibility of saturation. However, finding network-wide LR channels is not a practical approach for opportunistic access networks. A group-based cooperative MAC (GC-MAC) protocol for enhancing the sensing accuracy in CRNs was proposed in [31]. An SU-selective technique was adopted for reducing the sensing overhead. The proposed protocol was well analyzed under saturation and non-saturation with time-invariant and time-varying channel conditions. Similarly, to jointly improve the spectrum sensing efficiency through cooperative sensing and system lifetime, an optimal scheduling scheme for sensor-aided CRN was studied in [32]. Sensors are divided into multiple non-disjointed subsets based on their individual channel conditions, and each subset is activated successively while all of the remaining sensors are kept in a low-energy sleep mode.
A distributed, direct access-based MAC protocol for CRNs (CMAC) was proposed in [33]. Here, each SU is equipped with a single half-duplex transceiver to detect the PUs in its vicinity and shares its sensing information with other neighboring SUs. CMAC divides the time frame into two parts: (1) the beacon period; and (2) data transfer period. Each SU periodically visits a common channel to obtain PU and SU discovery information for resynchronization. In [34], Liu et al. proposed a scalable hybrid MAC protocol for heterogeneous machine-to-machine networks. Their proposed protocol achieves hierarchical performance by using different contending priorities and incorporates both the persistent CSMSand TDMA schemes. Moreover, an incremental contention priority scheme was used to guarantee fair access among multiple heterogeneous devices. Cooperative sensing can improve the reliability of spectrum sensing. However, if the SUs are selfish, they may not take part in spectrum sensing. Therefore, an efficient MAC protocol may force selfish SUs to take part in cooperative sensing in order to improve the network performance. In this way, a fair, social welfare-correlated equilibrium technique was introduced in [35] to ensure the fairness of all SUs and to maximize the system utility.
Therefore, it would be beneficial to design a MAC protocol for CRNs that is fully aware of the activity of PUs and their traffic usage patterns over each licensed channel. This should provide some efficient way to enhance the SUs' throughput, minimize the PU-to-SU collision rate and minimize the SU channel switching rate. It should also provide an efficient/fast channel switching scheme to control the activity of SUs over licensed channels and to avoid harmful interference with SUs.

System Model
To make the rest of this paper easy to follow, we list some frequently-used symbol notations and symbols terminologies in Table 1.
A group of SUs is assumed to form a single-hop CRN where each SU directly communicates with other SUs in its transmission range. In the MAC protocol design, an important concern is sender and receiver synchronization due to the spectrum heterogeneity and the contention for multiple SUs for the available spectrum. However, licensed channels may not always be available to SUs; therefore, we use the common control channel (CCC) for exchanging control information and contentions among SUs. There is a tradeoff between PHY-layer spectrum sensing/monitoring and cost. However, PHY-layer sensing is significantly important due to the heterogeneous PUs, whose traffic usage patterns depend on the applications type of the PUs [11,29]. Therefore, each SU is equipped with two radios, which is similar to approach employed by Jiang et al. [36]. One radio is dedicated to continuous PHY-layer monitoring, while the second is reserved for data transmissions.
The CRN consists of a total of N licensed channels that can be used for the transmission of SUs. Each estimated idle slot for any licensed channel is divided into three segments: (1) contention; (2) MAC-layer sensing and channel reservation; and (3) SU data transmission; this concept is illustrated in Figure 2. Avoiding SU-to-SU interference is another prime concern in MAC protocol design for CRNs. However, the IEEE.802.22 standard for CRNs [37] suggests that it should be dealt with in the context of internetwork coordination of spectrum sensing and allocation. In our proposed PAD-MAC, we deal with SU-to-SU interference during MAC-layer sensing and channel reservation via a channel-locking mechanism; this will be discussed in detail in Section 3.5.  Figure 2. Secondary user (SU) frame architecture.

Estimation of Min TOL and Max TOL Using PHY-Layer Channel Monitoring
In heterogeneous CRNs, every channel follows a unique usage pattern, which can vary over time and is generally dependent on the types of PU applications [11,29]. Transmission opportunities length (TOL) is the key part of enabling opportunistic-access CRNs. Therefore, PU activity-aware estimation of TOLs plays an important role in enhancing the throughput of CRNs and controlling the activity of SUs within the licensed bands [38]. With the help of estimated TOLs, SUs can efficiently exploit the licensed channels without causing harmful interference with the PUs and can make intelligent and fast handoff decisions. In this section, we present the procedure of proposed PHY-layer channel monitoring scheme, and then, based on the continuous PU activity monitoring, we present a procedure (i.e., Algorithm 1) to estimate the Min TOL and Max TOL. The PHY-layer channel monitoring scheme collects the licensed channel usage patterns and observes the PU behavior for a sufficient period of time (i.e., sampling time). Further, based on the reasonable past observations, we can predict that if a particular channel is idle, it may remain idle at least for the duration of its estimated Min TOL. use the energy-based PU activity detection method with a detection time of 1 ms [42][43][44] Figure 3. PU activity monitoring architecture.
The MR monitors all of the licensed channels i (i = 1, 2, ...., N ) in a round robin fashion [45] and spends a short duration ∆T (e.g., ∆T = 1) ms over each channel to detect its state. It continues to monitor for the maximum duration of sampling time T Sam (i.e., 1-5 s) to collect the PU traffic samples from all channels. During the channel monitoring, if a channel iis found to be in the ON state (i.e., the detected energy level is greater or equal to 1.16 db for the duration of T Sam ) at time t 1 , the MR marks that channel as busy and moves to the next channel. Then, on its next monitoring turn at time t 2 , if that channel i is still found to be in the ON state, the MR found no change. Therefore, the time t 2 − t 1 is denoted as the utilization time. However, if channel i at time t 2 is found to be in the OFF state (i.e., the detected energy level is below 1.16 db for the duration of T Sam ), then time (t 2 − ) − t 1 is denoted as the utilization time (where is the detection error). Similarly, if a channel i is found to be in the OFF state at time t 1 and then at time t 2 it is again found to be in the same state, then the time t 2 − t 1 is denoted as the free time. However, if channel i is found to be in the ON state at time t 2 , then the time (t 2 − ) − t 1 is denoted as the free time. In this scenario, a PU arrival is detected; the counter for the "No. of arrivals" is increased by one. The free and utilization time computation is demonstrated in Figure 4b. Every following encountered utilization or free time lengths will be added in their respective previous values until a different state is found. Finally, Min TOL and Max TOL are estimated through Algorithm 1, every time when the channel switches its state from OFF to ON.

Utilization Time
Free Time   Figure 4. Observing free and utilization times through PU activity monitoring.

PU Activity-Based Channel Indexing
In this section, we present the channel indexing scheme that facilitates the SUs in selecting the best and most stable channel from the pool of available channels. It only computes the rank or index of the idle channel as follows: The rank of each channel is based on three monitored parameters: (1) the total free time (TFT); (2) the total utilization time (TUT); and (3) the total No. of arrivals. The rank gives the confidence value of using any licensed channel i for the duration of its estimated Min TOL or, consequently, it refers to the interference value with PU within the estimated Min TOL. Thus, the PAD-MAC protocol selects the optimal channel for enhancing the throughput of the SU based on: (1) the estimated Min TOL; and (2) the rank. The optimal channel selection scheme for transmission of SUs is discussed in Section 3.5. The complete architecture of the activity monitoring of PUs and channel indexing is presented in Figure 5. The pool of available channels P ch is computed by organizing the idle channels' ranks into descending order. Algorithm 2 demonstrates the method of computing the rank of each available licensed channel.
Input: Set of U tilization T ime, Set of F ree T ime, Set of N o of Arrivals, no of available channels N a , T M T , Set of P U T , Set of P F T and Set of P N P A Output: Set of Rank begin Algorithm 2: The sampling time T Sam is a global variable, and its value is set according to the total time required for collecting the PHY-layer channel usage patterns. In our case, we set this value to five seconds for the first time; after this, ranks of the available channel can be computed after every second or 500 ms by assigning new monitoring time values to the total monitoring time (TMT) variable.
Moreover, the proposed ranking scheme can be adopted to support the real-time applications over CRNs by selecting a reasonable value of T Sam . In the case when the TMT is not equal to the sampling time, we compute the ranks of each channel using the past observations of time equal to the sampling time-TMT. The history observations are: (1)

Channel Locking
In CRNs, there are two types of users: (1) PUs, who own the licensed band; and (2) SUs, who opportunistically utilize the PU licensed band. Similarly, CR network performance is affected by two types of interference: (1) PU-to-SU interference; and (2) SU-to-SU interference. PU interference avoidance is the primary objective of CR; therefore, SUs are allowed to use the licensed channels only when their licensees are not using them. However, SU-to-SU interference also severely affects the effective capacity of infrastructure-less CRNs where no central entity exits to manage all of the activities. A few techniques have been proposed to resolve SU-to-SU interference in infrastructure-less CRNs [24,46,47]. However, the PAD-MAC protocol jointly deals with both kinds of interferences as follows: • PU-to-SU interference avoidance by allowing SUs to exploit the licensed channels only for the duration of their estimated Min TOLs and immediately vacating the channel if the presence of a PU is detected (even if this occurs before the expiration of the estimated Min TOL). • SU-to-SU interference avoidance by applying the channel-locking scheme during MAC-layer channel sensing and reservation.
MAC-layer sensing is introduced as an additional layer of security for PU-to-SU and SU-to-SU interference avoidance. The channel-locking mechanism aims to eliminate SU-to-SU interference and prevent multiple SUs from accessing a single channel at the same time within the transmission/interference range of each other. In the channel-locking scheme, all SUs who want to transmit data must first participate in contention to acquire access over any particular channel i. Each SU node must maintain a variable cw (the contention window size), which is initialized with the minimal value initially. Multiple SU nodes can contend for a single channel or for multiple channels depending on which channel is better for them. An SU node first announces contention for its channel of interest and broadcasts a contention message, which includes the channel ID, to all of its one-hop neighbor SU nodes.
All SUs who are also interested in acquiring that particular channel choose a random time value from their cws and wait for their corresponding backoff timers to become zero. The counter is deducted by one after each contention slot. The SU node whose backoff timer expires first wins the contention and moves to the next step for MAC-layer channel sensing and reservation. The remaining SU nodes freeze their timers. If any failing SU node is interested in acquiring the next available channel from its list of free channels, it announces the contention over its next channel of interest. In this case, it resumes its frozen timer. In case of a collision, colliding nodes double their contention window sizes. The winning SU proceeds to the MAC-layer channel sensing and reservation phase.
In the MAC-layer channel sensing and reservation phase, the transmitter SU node informs its pair SU node that it wants to communicate on channel i by sending the want-to-lock message, which contains channel ID information. If the receiver SU contains this channel i in its list of free available channels, it broadcasts the agree-to-lock message. All neighboring SU nodes hearing the want-to-lock or agree-to-lock messages stop their activities over the control channel. After exchanging these control messages, the sender and receiver sense channel i for a very short duration T s to further ensure that there is no PU or SU activity on channel i. After sensing T s , if the sender finds no activity, it sends the lock message containing its estimated S M inT OL i ; similarly if MAC-layer sensing on the receiver SU node side also is successful (i.e., no activity detected). The receiver SU node first matches its estimated R M inT OL i with the sender estimated S M inT OL i and selects the min of these two values as follow: In the response of the lock message, the receiver SU node sends back the locked message along with newly computed M in T OL i . All of the neighboring SU nodes hearing lock and locked messages extract the value of M in T OL i from the received message, set their network allocation vector (NAV) and also mark channel i as unavailable or busy for the duration of N AV i or until they receive release message. N AV i is allocated as below: In case of PU detection on channel i, or expiration of M in T OL i , or completion of SU transmission, the sender and receiver pair broadcast the release message to inform all of their one-hop neighboring SU nodes so that they unmark/release the marked channel i and utilize its remaining idle duration if available; if SU transmission is completed before the expiry of M in T OL i . On the other hand, if the SU transmission has not been fully completed within the M in T OL i , then the SUs have to follow the contention and channel reservation procedure for the remaining transmissions from scratch.

Predictive and Fast Channel Switching Scheme
Another significant advantage that we attain from our PHY-layer PU activity monitoring and idle slot estimation is enabling the predictive and fast (PF) channel switching/handoff scheme. The prime objective of the PF channel switching scheme is to schedule the transmissions of SUs in such a way as to maximize the SU spectrum occupancy, while minimizing the disruption rate to PUs. For this, each SU first selects a channel from the list of available channels with the highest rank value and remaining idle time RE M in T OL . The value of RE i M in T OL of channel i is computed as follows: This means that the consumed idle time (i.e., the time when the channel was already idle while the CR was operating in another channel) T i wast is subtracted from the estimated idle time Min TOL of any channel i. After this, the value of M in T OL i is updated by assigning the value of RE i M in T OL . Hence, the SU computes its channel of interest as follows: In PF channel switching, each communicating SU pair initiates its next channel selection before the expiration of the already in use/reserved channel time in order to avoid any interruption/delay in its ongoing communication. We assume that, on average, channel selection takes time T sel ; therefore, in order to avoid channel selection errors (i.e., channel unavailability), each communicating SU pair computes its new channel selection time T sim as follows:  As the ongoing transmission time reaches point T sim over the current acquired channel, the communicating SU pair initiates the next/new channel selection to smoothly proceed with its transmission without long delays and/or interruptions. When T sim is reached, the SU performs both channel selection and data transmission simultaneously and switches to the newly explored channel when M inT OL i expires. This procedure is presented in Figure 6a,b. Alternatively, in the case of a collision, as shown in Figure 6b, the SU halts its transmission and selects a new channel to resume its communication.

PU Activity-Aware Distributed MAC for Multi-Channel CRNs
In this section, we discuss the design of the PU activity-aware distributed MAC for a multi-channel CR network. Some necessary design assumptions are listed below: • We consider a total of N licensed channels for data transmissions. The term "channel" refers to a physical channel with a certain amount of bandwidth. We do not consider logical channels (i.e., different coding schemes in code division multiple access (CDMA)). For simplicity, we assume that each spectrum channel has the same bandwidth B. • A common control channel (CCC) is considered to be available for SUs every time. In practice, this can be the unlicensed band [24], which will be used for synchronization and exchanging control information (including contention information). • PUs have a total of N different licensed channels. A single PU can only use one channel at a time.
The states of N channels at any time t and at any location are given by The channel states are based on the traffic type of PUs, which is modeled using an exponential distribution. • Each SU node is equipped with two cognitive transceivers. One is for data transmission over the licensed channels, and the second is dedicated to PHY-layer PU activity and traffic analysis. • When any SU acquires a licensed channel for its transmission, its MR exempts that channel from PHY-layer monitoring for the duration of the reserved time M in T OL. This is done by marking the corresponding entry as busy in the monitoring parameters shown in Figure 5. • The channel ranking algorithm only provides the ranks of available channels at any time t.
Channels that are busy/unavailable at that time are not considered in channel ranking. Furthermore, if SU transmissions collide with a PU within its estimated idle slot, the rank of the corresponding channel is assigned a value of zero as a penalty.

Protocol Overview
In this section, we first provide a design overview of the proposed PAD-MAC protocol. The estimated idle slot Min TOLs over each licensed channel are referred to as time frames and contain three types of SU operations: (1) contention; (2) MAC-layer sensing and channel reservation; and (3) SU data transmission. These SU operations are depicted in Figure 2. The following packet types are introduced to facilitate these operations: 1. Cont: Before reserving the channel of interest, an SU announces the start of contention for some particular channel i by broadcasting the Contmessage if and only if that particular channel is not already marked busy in its local channel base. 2. Want-to-lock: The transmitter SU informs its receiver node and all of its one-hop neighbor SU nodes that a particular channel i is going to be reserved. After hearing this message, all of the one-hop neighbor SU nodes stop their activities on the control channel.
3. Agree-to-lock: In response to the want-to-lock message, the receiver SU node broadcasts the agree-to-lock message to inform its transmitter and all of its one-hop neighbor SU nodes if and only if the channel of interest i is not already marked as busy in its local channel base and is available in its list of free channels. After hearing this message, all one-hop neighbor SU nodes also stop their activities on the receiver side over the control channel.  shows that SU A and SU B are the two nodes that come under the transmission ranges of T r and Rec, respectively. Therefore, SU A and SU B defer their activities as they receive any control message from either the transmitter or receiver. The complete procedure of control message exchange between T r and Rec for channel reservation and data transmission is depicted in Figure 7b. However, all of the aforementioned control messages are exchanged via a CCC. If any SU wants to transmit data, it first reserves the channel after selecting a random backoff time for contention. If it wins the contention, it proceeds to the MAC-layer channel sensing and reservation phase. After successful channel reservation, the transmitter and receiver proceed to data transmission, while their one-hop neighbor SU nodes defer their operations over the reserved channel and wait for the release notification (if they are intending to use the channel in question). If a collision/failure occurs in any of the above control messages, the colliding SUs double their cws and proceed to their next channel of interest.

Protocol Design
Licensed channel usage pattern extraction: The traffic usage patterns/features of PUs over all licensed channels are collected through continuous PHY-layer monitoring via a dedicated monitoring radio. The monitoring radio collects the channel features (i.e., utilization time, free time, No. of arrivals, min idle length and max idle length) for the duration of the sampling time. These monitoring parameters are shown in Figure 5. During PHY-layer monitoring, we also estimate the Min TOLs and update their values with respect to any changes that are detected on their respective channels during PHY-layer monitoring. These collected channels' information is used to compute the rank of each individual channel. Rank confers the confidence level or PU collision avoidance value during the estimated M in T OLs. Moreover, on the basis of PU channel usage pattern analysis, we can predict the behavior of PU over any particular channel and can predict future idle and busy slots over that channel.
Contention: The PAD-MAC protocol does not require global synchronization. Any new SU node entering the network first listens to the control channel to determine the current activities of its surroundings. A new SU node cannot miss any control packet from its one-hop neighbor SU nodes. If it received any control packet for synchronization, it will stop its activities over the control channel and then defer its activities over the reserved channel after receiving the lock or locked message. Similarly, all of the other SUs also stop their activities over the control and reserved channels and wait for the duration of N AV i or until they receive the release message from the transmitter or receiver. However, they may proceed to acquire any other channel once the previous synchronization is completed.
If any synchronization occurs in the vicinity of any SU, that node is not allowed to transmit any control packets over the CCC; this avoids unnecessary collisions with previous synchronization. After successful synchronization, the awaiting SU nodes may initiate contention for another channel of their own interest. SU nodes are not allowed to occupy any available licensed channel without announcing and participating in the contention. In the contention period, a media access scheme similar to IEEE 802.11 DCFis adopted (with some necessary modifications). SU nodes can try to reserve available channels, one by one, by exchanging a series of control packets (i.e., Cont, want-to-lock, agree-to-lock, lock and locked). In the case of collisions in any of the control packets, the colliding SU nodes double their contention window size and wait until the backoff timer becomes zero before contending again.
The SU who wins the contention proceeds to the MAC-layer sensing and channel reservation step, while the SU nodes that failed may participate in the contention for other available channels from the same point of their backoff timers after the completion of the previous contention. An SU can only occupy a particular licensed channel maximum for the duration of its estimated M in T OL. If it wants to continue its transmission, it may have to follow the whole procedure of channel reservation again for its remaining transmissions. However, an SU node can compute the effective time for data transmission over its channel of interest i at time t as follows: where T cw is the time consumed in contention, T s is the MAC-layer sensing time to ensure that a channel is idle and T syn is the time required for synchronization with the pair of SU nodes. MAC-layer sensing and channel reservation: The transmitter SU node who won the contention will perform the MAC-layer channel sensing and reserve its channel of interest Ch k . The channel sensing phase contains T s sensing slots, each of which includes the actual channel sensing (i.e., the detection of channel activity). After successful sensing, the transmitter and receiver nodes proceed. They reserve the channel and negotiate with each other by exchanging lock and locked control packets to become synchronized. the transmitter and receiver nodes can only reserve the channel for communication for the maximum duration of Min TOL that has been estimated over that channel. After the expiration of this reserved time period, they must vacate the channel by broadcasting the release control packet. If the communicating nodes have completed their communication before the expiration of the reserved time period and released the channel, other interested pending SUs can occupy and use the remaining idle length RIL i if it is sufficiently large for transmitting data packets (i.e., if Equation (9) holds). They can compute the remaining idle length from their N AV i values and the time when they received the release message as follows: where T Release is the time when the SU received the release notification, T sel is the time required to occupy a licensed channel and T pkt is the time to transmit a data packet. If the presence of a PU is detected over the communicating channel, the communicating SU nodes must immediately stop their communication, vacate the occupied channel and switch to some other channel for their remaining transmissions. In such a scenario, when switching to a new channel, SUs must follow the complete procedure of acquiring a new channel. SU transmission: After successful channel reservation and synchronization, the transmitter-receiver pair starts sending and receiving data packets over its channel of interest Ch k for the maximum duration of M in T OL i . If the presence of PU is detected over that channel during the packet transmission, the SU immediately stops its communication, vacates that channel and moves to some other suitable channel that is available in its list of free channels.
In the case of normal transmission, an SU pair can only reserve a specific channel for the maximum duration of M in T OL i . It can send and receive multiple data packets in one reservation slot, but if their complete communication is not possible in one reserved slot, the communicating nodes must occupy another channel of interest before the expiration of the current reserved slot. In such scenarios, our proposed predictive and fast channel switching scheme will be applied. The transmitter/receiver SU pair of nodes broadcast the release control packet in the following three situations: 1. M in T OL i expires. 2. PU presence is detected on the occupied channel. 3. Communication is completed before the expiration of the reserved time period.
Upon receiving the release notification, all SU nodes that hear the message unmark the channel from their local base and reset their N AV i values to zero. Algorithm 3 summarizes the complete procedure of the PAD-MAC protocol from the PHY-layer channel monitoring to channel reservation and data transmission. A detailed description of all of the steps and workings of Algorithm 3 is given below.

Algorithm 3: PAD-MAC procedure for channel selection and data transmission.
Input: Global set of channels N begin for i ← 1 to N do /* Compute M in T OL i t and M ax T OL i t using Algorithm 1 */ /* Compute rank of all idle channels using Algorithm 2 */ /* Compute P ch the pool of available channels*/ /* Compute Ch k using Equation (5)  if PU detected on channel Ch k then /* Stop transmission */ /* Release channel by broadcasting a release message */ /* Assign Rank Ch k ← 0 */ /* Recompute P ch , and follow channel selection procedure from scratch */ Algorithm 3: In the first phase, all of the N licensed channels are monitored via the PHY-layer channel monitoring scheme to estimate the idle slots, and then, based on the monitored parameters, the rank of each idle channel is computed. P ch is the pool/list of the available channels, which is computed by rearranging the available channels in descending order with respect to their corresponding ranks. After this, an SU computes its channel of interest and announces and participates in contention in an attempt to occupy its channel of interest. If the SU could not successfully occupy its computed channel of interest, it may proceed to compute the next channel of interest from the remaining available channels in the P ch and continue this process until it occupies some channel or there is no channel left in the P ch . If an SU is unable to successfully occupy any idle channel, then it must wait for a random amount of time before computing the next P ch . After successful channel selection, the SU computes its effective transmission time and proceeds to transmit its data packets. If its transmission cannot be completed in one reserved slot, it will start exploring another channel of interest at time T sim , while simultaneously continuing its transmission on the previously selected channel. It switches to the next channel upon the expiration of the reserved slot. On the expiry of the reserved slot or the PU is present (or is detected), the SU releases the previously occupied channel by broadcasting the release message. In the case of a collision with a PU, the rank of the occupied channel is assigned to zero as a penalty.

Numerical Results
In this section, we compare the performance of the proposed PAD-MAC protocol with the QC-MAC protocol [29] and listen-before-talk MAC protocol [48]. We measure the performance of the MAC protocols under the three fundamental and important parameters of CRNs: (1) SU throughput; (2) PU-to-SU collision rate; and (3) SU channel switching rate. The results were determined using extensive simulations written in C.
1. Throughput: An important performance metric for CRN MAC protocols is throughput. It is a measure of the amount of successful data packets exchanged between communicating SU nodes pairs in the SU effective transmission time over interval [0, T ]. Throughput is calculated as below: where N p is the number of data packets transmitted per unit time. N p is based on the bandwidth of the channel; therefore, for simplicity and for fair comparisons, we assume that the capacity of all channels is the same and set as 2 Mbps. The SU effective transmission time over interval [0, T ] is the time in which the SU successfully transmits its data packets without colliding with the PUs. We assume that, on average, a collision takes half of the SU data transmission time in the case of exponential traffic and that the switching time is larger than the transmission time. Thus, the SU effective transmission time is calculated as follows: where T sw and T s are channel switching and sensing delays, respectively. η, δ and n are the number of switchings, the number of collisions and the number of sensings, respectively.
2. PU-to-SU collision rate: Collisions happen when both PUs and SUs simultaneously transmit on the same channel. The collision rate φ SU between PUs and SUs can be used as a PU protection metric, since the main objective of CR is to avoid harmful interference with PUs and to use the leftover spaces in the licensed bands. The collision rate φ SU is defined as below: 3. SU channel switching rate: Each incidence of channel switching causes some delay in the SU transmission, thereby causing wastage of the SU effective transmission time. Frequent channel switching decreases the capacity and makes the network management more difficult [49]. Thus, a good metric for the spectrum control in CRNs is the channel switching rate θ SU . This is a measure of the number of channel switchings in interval [0, T ]. Minimizing the channel switching rate θ SU also decreases the probability of collisions with PUs. θ SU is computed as follows:

Experimental Setup for Channel Monitoring and Ranking
In this section, we discuss the environmental setup for the simulation of our proposed PHY-layer channel monitoring scheme. We use an energy-based PU signal detection scheme with a 1-ms detection time and 1.16 db as the detection threshold [42]. If the detected energy value is below this threshold, we assume that the channel is idle; if the detected energy is equal to or above the detection threshold, then we assume that the channel is busy. To demonstrate our PHY-layer channel monitoring scheme for PU traffic usage pattern analysis and rank calculation, we used five licensed channels. PU traffic is exponentially modeled using alternating ON-OFF states [41]. The lengths of the ON-OFF states are also exponentially distributed with idle rate λ T OF F and busy rate λ T ON , respectively, which are independently chosen for each individual channel. The sampling time for the collection of the PU channel usage pattern is set as 5 s; an SU will have to wait for the sampling time T Sam to collect the samples; however, the following time, an SU can compute the ranks of available channels after every second. This can be done by using the history of the previous 4 s.

Experimental Setup for SU Channel Selection and Data Transmission
In this section, we discuss the simulation setting for the channel selection and data transmission of SUs in the proposed PAD-MAC protocol. Simulation parameters and their corresponding vales are presented in Table 2. SU nodes are randomly placed in a 1000 × 1000 m area of two dimensions. An SU can directly communicate with its respective destination SU node within a transmission range of 150 m. For channel selection and data transmission, we used a total of 10 heterogeneous licensed channels (i = 1, 2, ..  Table 3. For simplicity and fair analysis, the capacity of each channel is assumed to be equal and set to 2 Mbps. We tested the performance under different channel conditions (listed above) by varying the total number of channels to be used: (1) three channels (i = 1, 2, 3); (2) five channels (i = 1, 2, 3, 4, 5); (3) seven channels (i = 1, 2, 3, ...., 7); and (4) ten channels (i = 1, 2, 3, 4, ...., 10). T s is the average time spent in channel selection and reservation for SU packet transmission. Therefore, for a fast/seamless channel handoff, the communicating SUs start exploring their next channels at time T sim in order to obtain smooth communication. Hence, from the point T sim onward, SU nodes perform data transmission and channel selection simultaneously. If any SU quits its reserved channel due to collision with a PU, then the SU must wait for 1 s for PHY-layer channel monitoring; 5 ms is used for channel ranking, next channel selection, synchronization and switching. We modeled error-free channels and assumed that packet loss only occurs due to PU-to-SU collisions. We ran simulations for 250 s to measure the performance values. To observe the average behavior, simulations were repeated under the same condition 10 times. The PAD-MAC protocol is evaluated against the QC-MAC and listen-before-talk MAC schemes under a multi-channel CR network environment. The performance is evaluated using file transfer data traffic with a constant packet length of 1500 bytes. QC-MAC computes the success probabilities of each packet transmission over a list of available channels and selects a channel with a higher probability of success. Probability values are computed using the mean idle, mean busy time of traffic parameters T ON ; T OF F , sensing time and packet transmission time as follows: where 1 α i and 1 β i are the mean idle and busy periods of channel i, respectively. t AS j is an arbitrary sensing period selected by user j. t f is the transmission time of the current frame, and F k (x) is the cumulative distribution function.  Thus, a total of 2 ms is reserved for channel selection (i.e., computing success probabilities, sensing and synchronization), and 1 ms of additional time will be added in the case of switching to a new channel. A random time is picked from the waiting window of size [0, 8] ms when no idle channel is available for selection. In the case of a collision with a PU, no additional time penalty is awarded in the QC-MAC, because this scheme senses the channel every time before sending each individual data packet. The collision probabilities (corresponding to QC-MAC success probability P i j ) over any channel i are given in Table 4. The same collision probabilities are used for PAD-MAC based on its rank index; however, the collision probabilities for the listen-before-talk MAC are randomly selected for every channel. Similarly, the listen-before-talk MAC scheme senses the licensed channel each time before sending the data packet. It only differs with the QC-MAC in that it does not compute the transmission success probabilities over all available channels. It only senses the channels in a descending order and picks up the first encountered available/idle channel. One millisecond is used to sense a single channel to determine whether it is idle or busy; if the sensed channel is busy, it moves to the next channel and continues searching until either an idle channel is found or all channels have been analyzed. If all of the channels are found to be busy or if a collision with a PU occurs, it waits for a random time period selected from the time window of size [0,8] ms, similar to the QC approach. Two milliseconds is used for channel selection, synchronization and switching to the new channel. Table 4. PU interference probability index table.
x = P k i P r (P U Interf erence) Figure 8, presents the dynamic behavior of PU activity-aware channel ranks. This figure shows that as the activities of the PUs changes over time, there is a pertinent change in their corresponding ranks. Thus, selecting a channel based on its rank value provides the best and most stable channel for SU transmissions, which significantly enhances the throughput of CRNs. Figure 9 shows the number of PU arrivals detected during the monitoring of the PHY-layer PU activity over the licensed channels. The number of detected arrivals is grouped together over the period of the sampling time. Figure 10a,b presents the total busy and idle times, respectively, which are observed for each individual monitored licensed channel during PHY-layer monitoring over a total simulation time of 50 s. Each channel that is determined to be busy or idle is grouped together over a sampling time of 5 s. These two figures reveal the fact that different licensed channels have different usage and leftover times, and they vary over time with PU activity in their respective channels. Therefore, this fact can play a significant role in enhancing the throughput of opportunistic access CRNs.   Figure 11a,b presents the estimated time lengths of Min TOLs and Max TOLs estimated for each monitored licensed channel over a total simulation time of 50 s. We estimate these two values every time we detect a change in their respective channels. M in T OL i refers to the expected idle time period that is available in channel i; this is the actual time that an SU can utilize for its own data transmission. These two figures demonstrate that Min TOLs and Max TOLs can also vary over time the activity of the PU (i.e., idle and busy times) changes over their respective licensed channels. Our calculated rank for each channel basically refers to the confidence value of using that licensed channel for the minimum duration of its estimated Min TOL time. Thus, a higher rank value means that the estimated idol slot will be less affected by its PU and has a higher chance of successful communication in that idle slot. Selecting a stable channel not only minimizes the number of channel handoffs, but also enhances the SU throughput. Figure 12a shows the distance between measured Min TOL and Max TOL on Channel 3 over a set of observed point p = {1, ......, M }. The distance Dist i between the two measured entities is computed as follows:

Channel Monitoring and Ranking
if Dist i for any given channel i is approximately equal to zero over a period of time then the channel having the same idle lengths (i.e., same length of M in T OL and same length of M ax T OL). Therefore, such a channel is considered to be more stable than the channel having different idle lengths. The standard deviation σ i M in T OL of Min TOLs of any given channel i over a set of monitored points p = {1, ......, M } is computed as follows: where µ is the mean value of measured Min TOLs, which is computed as below: If the Dist i computed in Equation (15) and σ i M in T OL computed in Equation (16) are approximately equals to zero for any given channel i, we can conclude that the behavior of the PU over that channel is periodic.  Figure 12b demonstrates the behavior of σ 3 M in T OL , and we can observe that its value remains approximately zero in the interval between 5 and 35 s. Therefore, we can conclude that the PU behavior over Channel 3 remains almost periodic within that interval. If such a channel were found, then we can make exact predictions about the future idle and busy slots to better exploit the channel for SU transmissions and to avoid PU-to-SU interference. For this case, the prediction about the start of the ON time or the point where the SU and PU transmissions can collide with each other can be calculated as follows: where m = {1, 3, 5, ...} is the set of odd numbers and T ON is the channel busy time. We assume that T ON appears before every idle time Min TOL. Similarly, the start of a future idle time is computed as below: where n = {2, 4, 6, ...} is the set of even numbers. Figure 13 presents the channel switching rate for the three, five, seven, and 10 channel scenarios. It shows that the PAD-MAC scheme outperforms the QC-MAC and listen-before-talk MAC schemes. The channel switching rate of QC-MAC is very high; for every packet transmission, it computes the success probabilities for all available channels and selects the channel with the highest probability of success. However, under the dynamic channel condition, the probabilities vary almost every time they are computed.

SU Channel Selection and Data Transmission
The channel switching rate of the listen-before-talk scheme is comparatively lower than the QC-MAC, because it senses the licensed channels in any order (i.e., descending or ascending), picks the first found idle channel and transmits its packet. For the next packet transmission, it again senses the same channel; if that channel is still found to be idle, it sends the next packet over the same channel again, continuing to hold the occupied channel until it becomes busy or a collision occurs over that channel. The channel switching rate of the PAD-MAC scheme is much lower than either of the other two schemes, because it occupies the complete idle slot (i.e., the estimated Min TOL) and transmits as many packets as it can within that idle slot. Figure 14 shows the collision rate measured for the three, five, seven and 10 licensed channel scenarios. This figure also provides evidence of the better performance of the PAD-MAC during collisions. The collision rate of the listen-before-talk MAC protocol is much higher than the other two MAC schemes, because unlike QC-MAC and PAD-MAC, it selects the channel without taking any precautionary measurements. The reason for fewer collisions in the proposed PAD-MAC scheme is that we estimate the idle slot through PHY-layer monitoring and select the channel based on its rank. As the number of licensed channels increases, the collision rate of QC-MAC decreases; this is because it has a wider range for channel selection and picks a good channel with a higher probability for success. PAD-MAC has better performance while experiencing collisions compared to the QC-MAC, because in QC-MAC, collisions occur per packet transmission; in PAD-MAC, the collisions occur per idle slot.     Figure 16 presents the aggregated throughputs for three, five, seven and 10 licensed channel scenarios. It is clear from the figure that the aggregated throughput of our proposed PAD-MAC is higher than the listen-before-talk and QC-MAC protocols. (d) ten channel.

Conclusions and Future Work
In this paper, we have proposed a MAC protocol (PAD-MAC) that utilizes multiple licensed channels to improve CRN throughput and overall spectrum utilization. We take several considerations to make the CR more practical, including monitoring the channel activities of primary users and estimating idle slots based on previous channel observations. Similarly, based on the past observations of the channels, we computed the rank of each individual available channel, which assesses the transmission success of SUs within an estimated idle slot over any particular licensed channel. Thus, each SU selects the channel based on the estimated idle slot length and rank value to optimize its throughput. Our proposed PAD-MAC protocol also coordinates the contention, MAC-layer channel sensing, synchronization and negotiation for spectrum usage among multiple SUs. It controls the activity of SUs over the licensed channels to avoid harmful interference with PUs by allowing the SUs to exploit the licensed channels only for the duration of the estimated idle time. Moreover, communicating SU nodes use the predictive and fast channel switching scheme to maximize their effective transmission time and capacity. Simulation results show the significant improvement in the throughput of SUs for various system configurations. As future work, we would like to extend our study by focusing on the PU activities specific to their practical applications (i.e., real traffic patterns) and considering the fairness among multiple SUs.