The respiratory system has three main functions: gas exchange between the atmosphere and blood, filtering and warming of inspired air, and sound production. It has three basic steps: pulmonary ventilation (breathing), external (pulmonary) respiration involving gas exchange in the lungs, and internal (tissue) respiration involving gas exchange in tissues. Inspiration is an active process using inspiratory muscles like the diaphragm and external intercostals to expand the thoracic cavity and lower lung pressure, allowing air to flow in. Expiration is usually a passive process involving elastic recoil of the lungs and chest wall. Other factors like alveolar surface tension, lung compliance, and airway resistance also influence ventilation.