The interior of a stable star is in a state of hydrostatic equilibrium: the forces on any small volume almost exactly counterbalance each other. The balanced forces are inward gravitational force and an outward force due to the pressure gradient within the star. The pressure gradient is established by the temperature gradient of the plasma; the outer part of the star is cooler than the core. The temperature at the core of a main sequence or giant star is at least on the order of 107 K. The resulting temperature and pressure at the hydrogen-burning core of a main sequence star are sufficient for nuclear fusion to occur and for sufficient energy to be produced to prevent further collapse of the star.[139][140] As atomic nuclei are fused in the core, they emit energy in the form of gamma rays. These photons interact with the surrounding plasma, adding to the thermal energy at the core. Stars on the main sequence convert hydrogen into helium, creating a slowly but steadily increasing proportion of helium in the core. Eventually the helium content becomes predominant and energy production ceases at the core. Instead, for stars of more than 0.4 solar masses, fusion occurs in a slowly expanding shell around the degenerate helium core.[141] In addition to hydrostatic equilibrium, the interior of a stable star will also maintain an energy balance of

hermal equilibrium. There is a radial temperature gradient throughout the interior that results in a flux of energy flowing toward the exterior. The outgoing flux of energy leaving any layer within the star will exactly match the incoming flux from below. The radiation zone is the region within the stellar interior where radiative transfer is sufficiently efficient to maintain the flux of energy. In this region the plasma will not be perturbed and any mass motions will die out. If this is not the case, however, then the plasma becomes unstable and convection will occur, forming a convection zone. This can occur, for example, in regions where very high energy fluxes occur, such as near the core or in areas with high opacity as in the outer envelope.[140] The occurrence of convection in the outer envelope of a main sequence star depends on the mass. Stars with several times the mass of the Sun have a convection zone deep within the interior and a radiative zone in the outer layers. Smaller stars such as the Sun are just the opposite, with the convective zone located in the outer layers.[142] Red dwarf stars with less than 0.4 solar masses are convective throughout, which prevents the accumulation of a helium core.[2] For most stars the convective zones will also vary over time as the star ages and the constitution of the interior is modified.