## 3 QoS Aware MAC Protocols for WMSNs
### Mg-Mac  
MQ-MAC [42] is a slotted CSM/CA based MAC protocol for cognitive radio sensor networks. In MQ-MAC, nodes form clusters and the key procedures including channel sensing, channel assignment, and guaranteed time slot (GTS) allocations are all coordinated by the cluster heads.  
Like IEEE 802.15.4, the superframe of MQ-MAC also composes of an active period and a sleep period, and the active period is further divided into three phases. The cooperative sensing and channel selection phase, where cluster members assign weights to the polling channels \(S_{K}\) according to the detected channel status (idle, busy, collision) and results of channel sensing are reported to the cluster head. Next the cluster head uses a weighted moving average method to calculate the average weights \(WA_{c}\) for each channel and accordingly organize the channels into a decreasingly ordered set \(C_{b}\). Together with the channel sensing results, data transmission requests are also sent to the cluster head using CSMA/CA in a manner that nodes with traffic of more stringent QoS requirements are given smaller back-off counters for earlier medium access.  
After obtaining the channel sensing results and data transmission requests, the cluster head then performs slot allocation and channel assignment. In MQ-MAC, slot allocation is only for QoS required traffic and it follows three basic rules. First, for each transmission request with a packet arrival rate \(n_{p}\), \(n_{p}\) GTS slots are allocated. Second, transmission requests are classified by their traffic types, and within each traffic type the requests are ascending ordered in accordance with the lifetime of packets. Third, earlier GTS slots are given to requests with higher QoS demands. Before channel assignment, candidate channels \(C_{b}\) are separated into three groups such that:  
\[B=\{c\in C_{b}\mid WA_{c}\geq(\mu+\sigma)\} \tag{1}\]  
\[M=\{c\in C_{b}\mid(\mu-\sigma)\leq WA_{c}\leq(\mu+\sigma)\} \tag{2}\]  
\[D=C_{b}-B-M \tag{3}\]  
where \(\mu\) and \(\sigma\) are the mean and standard deviation of \(WA_{c}\), \(B\) is the best channel set, \(M\) is the moderate channel set and \(D\) is the group of channels that will be discarded due to poor quality. First, channels in \(B\) are each assigned with multiple GTS slots, then a single GTS slot is assigned to every channel in \(M\). This channel assignment process carries on iteratively until all slots are designated with a data channel. Moreover, for each slot the next best channel following the assigned data channel is also chosen as a backup. The same channel assignment method is also used for best effort traffic.  
Following the above slot allocation and channel assignment technique, QoS required traffic can be sent to the cluster head without collision in the data transmission phase. On the contrary, best effort traffic are transmitted using CSMA/CA and packets with shorter remaining lifetime are giving higher priority of medium access. After data transmission nodes enter a sleeping state until the next superframe begins.  
Pros and Cons. MQ-MAC provides QoS support by giving different types of traffic distinct priorities in terms of slot allocation and channel assignment. However the protocol is not well fit for the dynamic and bursty traffic in WMSNs due to the fixed superframe size and the fact that a node may be required to switch among different channels for a single transmission session. Moreover, using traditional CSMA/CA for the communication among cluster heads could jeopardize the whole QoSprovision scheme. Also the protocol overhead is high due to frequent exchange of control messages, channel sensing and channel switching costs.