The central function of the lung is to facilitate the exchange of gases between the external environment and the body's circulation. Nearly every aspect of this function is inextricably linked with mechanics. Respiratory muscles, chiefly the diaphragm, generate a transpulmonary pressure gradient that inflates the lung by prompting gas to flow through the branched structure of the airways to the lung's terminal gas-exchange units, called alveoli. On relaxation of the inspiratory effort, the lung deflates passively due to the elastic recoil of the respiratory system. The expansion of the lung during inhalation brings atmospheric oxygen to the alveoli, where it diffuses across the blood–gas barrier into a dense network of capillaries. In exchange, carbon dioxide leaves the capillaries and is exhaled as the lung deflates. The fundamental design problem of the lung is how to organize and optimize the structure to enable rapid gas exchange. 1 The solution is elegant, but delicate: divide the blood in the lung's capillaries among millions of alveoli, each with walls less than 1 μm thick. 2 Air and blood can then be brought into close apposition to facilitate rapid equilibration.