Imagine some process in which a thermodynamic system goes from an initial state i to a final state f. During the process the system absorbs heat Q from the surroundings and performs work W on it. Can we reverse this process and bring both the system and surroundings to their initial states with no other effect anywhere ? Experience suggests that for most processes in nature this is not possible. The spontaneous processes of nature are irreversible. Several examples can be cited. The base of a vessel on an oven is hotter than its other parts. When the vessel is removed, heat is transferred from the base to the other parts, bringing the vessel to a uniform temperature (which in due course cools to the temperature of the surroundings). The process cannot be reversed; a part of the vessel will not get cooler spontaneously and warm up the base. It will violate the Second Law of Thermodynamics, if it did. The free expansion of a gas is irreversible. The combustion reaction of a mixture of petrol and air ignited by a spark cannot be reversed. Cooking gas leaking from a gas cylinder in the kitchen diffuses to the entire room. The diffusion process will not spontaneously reverse and bring the gas back to the cylinder. The stirring of a liquid in thermal contact with a reservoir will convert the work done into heat, increasing the internal energy of the reservoir. The process cannot be reversed exactly; otherwise it would amount to conversion of heat entirely into work, violating the Second Law of Thermodynamics. Irreversibility is a rule rather an exception in nature.
Irreversibility arises mainly from two causes: one, many processes (like a free expansion, or an explosive chemical reaction) take the system to non-equilibrium states; two, most processes involve friction, viscosity and other dissipative effects (e.g., a moving body coming to a stop and losing its mechanical energy as heat to the floor and the body; a rotating blade in a liquid coming to a stop due to viscosity and losing its mechanical energy with corresponding gain in the internal energy of the liquid). Since dissipative effects are present everywhere and can be minimised but not fully eliminated, most processes that we deal with are irreversible.
A thermodynamic process (state i → state f ) is reversible if the process can be turned back such that both the system and the surroundings return to their original states, with no other change anywhere else in the universe. From the preceding discussion, a reversible process is an idealised notion. A process is reversible only if it is quasi-static (system in equilibrium with the surroundings at every stage) and there are no dissipative effects. For example, a quasi-static isothermal expansion of an ideal gas in a cylinder fitted with a frictionless movable piston is a reversible process.
Why is reversibility such a basic concept in thermodynamics ? As we have seen, one of the concerns of thermodynamics is the efficiency with which heat can be converted into work. The Second Law of Thermodynamics rules out the possibility of a perfect heat engine with 100% efficiency. But what is the highest efficiency possible for a heat engine working between two reservoirs at temperatures T1 and T2 ? It turns out that a heat engine based on idealised reversible processes achieves the highest efficiency possible. All other engines involving irreversibility in any way (as would be the case for practical engines) have lower than this limiting efficiency.