Wireless Networking Lab 102: MAC Contention Window


The goal of this exercise is to investigate the impact of contention window size on the performance of the IEEE 802.11 MAC protocol. IEEE 802.11 specification requires all nodes to choose a random back off interval between zero and CW (contention window), and wait for the chosen number of slot times before trying to access the channel. Initially, CW is set to CWMin (minimum contention window size). However, when there is a collision, the contention window size is doubled, until a maximum value: CWMax. This technique of randomization and scaling the contention window size is used to reduce collisions. In our study however, we will consider a variant of 802.11 where the contention window size is fixed, i.e., CWMin=CWmax=CW. We will not scale the contention window, but still use randomization.

We will need a topology under which to study the effect of contention window sizes. For this, let us choose a single hop network where all nodes are in range of each other. Specifically we consider a 150m X 150m area. All nodes are involved in two Constant Bit Rate (CBR) conversations: one as source, and one as destination.

NS2 Instructions

Turn In

Electronically turn in compressed plots from the previous section. Expected plots are the aggregate CBR throughput and Packet Delivery Ratio (PDR) vs CW size for different rlen values. Please be considerate and make sure the plot files are not too large. For the analysis section questions, please type your answers in a document (plain text is fine), and email it along with the plot files.


This assignment lets you correlate the CW size and network size/density. The trend may or may not be very clear due to factors like interference with increase in density etc. Try to answer following questions with respect to the graph obtained above-
1. What trends do you observe? Do you observe any optimal CW size for each network population?
2. If yes, does the optimal window size exhibit any particular relationship with the network population?
3. Can you predict what would happen if you try to run this script for rlen = 6? Explain.
4. Could you explain what the grep command does to extract information from the trace file?


1. What is contention window?
2. Overview of IEEE 802.11
3. Know ns2