The lungs are the main organs of the respiratory system in many terrestrial animals, including all tetrapod vertebrates and a small number of amphibious fish, pulmonate gastropods, and some arachnids. Their function is to conduct gas exchange by extracting oxygen from the air into the bloodstream via diffusion directly across the humidified airway epithelia, and to release carbon dioxide from the bloodstream out into the atmosphere, a process also known as respiration. This article is primarily concerned with the lungs of tetrapods, which are paired and located on either side of the heart, occupying most of the volume of the thoracic cavity, and are homologous to the swim bladders in ray-finned fish.