  We present a complete framework of stochastic thermodynamics for a
single-mode linear optical cavity driven on resonance. We first show that the
steady-state intra-cavity field follows the equilibrium Boltzmann distribution.
The effective temperature is given by the noise variance, and the equilibration
rate is the dissipation rate. Next we derive expressions for internal energy,
work, heat, and free energy of light in a cavity, and formulate the first and
second laws of thermodynamics for this system. We then analyze fluctuations in
work and heat, and show that they obey universal statistical relations known as
fluctuation theorems. Finite time corrections to the fluctuation theorems are
also discussed. Additionally, we show that work fluctuations obey the Crook's
Fluctuation theorem which is a paradigm for understanding emergent phenomena
and estimating free energy differences. The significance of our results is
two-fold. On one hand, our work positions optical cavities as a unique platform
for fundamental studies of stochastic thermodynamics. On the other hand, our
work paves the way for improving the energy efficiency and information
processing capabilities of laser-driven optical resonators using a
thermodynamics based prescription.
