  In this paper, a dense Internet of Things (IoT) monitoring system is
considered in which a large number of IoT devices contend for channel access so
as to transmit timely status updates to the corresponding receivers using a
carrier sense multiple access (CSMA) scheme. Under two packet management
schemes with and without preemption in service, the closed-form expressions of
the average age of information (AoI) and the average peak AoI of each device is
characterized. It is shown that the scheme with preemption in service always
leads to a smaller average AoI and a smaller average peak AoI, compared to the
scheme without preemption in service. Then, a distributed noncooperative medium
access control game is formulated in which each device optimizes its waiting
rate so as to minimize its average AoI or average peak AoI under an average
energy cost constraint on channel sensing and packet transmitting. To overcome
the challenges of solving this game for an ultra-dense IoT, a mean-field game
(MFG) approach is proposed to study the asymptotic performance of each device
for the system in the large population regime. The accuracy of the MFG is
analyzed, and the existence, uniqueness, and convergence of the mean-field
equilibrium (MFE) are investigated. Simulation results show that the proposed
MFG is accurate even for a small number of devices; and the proposed CSMA-type
scheme under the MFG analysis outperforms three baseline schemes with fixed and
dynamic waiting rates. Moreover, it is observed that the average AoI and the
average peak AoI under the MFE do not necessarily decrease with the arrival
rate.
