Modern-day amniotes (reptiles, birds, mammals) have 1 of 2 basic lung types. Both derived from a single Carboniferous reptile with simple sac-like lungs.
The alveolar lungs of mammals have millions of highly vascularized, spherical sacs called alveoli in which air flows in and out. Breathing is accomplished by expansion and contraction of the rib cage and diaphragm. The many alveoli in this type of lung makes for efficient oxygen acquisition. Alveoli efficiency is offset by a 2-way breathing tube.
The most inefficient way to breathe is the mammalian way: inhalation and exhalation through the same tube into the lungs. The inefficiency comes from the disorder of the gas molecules as one exhalation finishes and one inhalation starts. In any sort of rapid breathing, there is a chaotic collision of exhaled air trying to get out before inhalation begins – and quite often the same gas molecules, including volumes of air with more CO2 and less O2, are sucked back in. ~ Peter Ward and Joe Kirschvink
In contrast to alveolar lungs, the septate lungs of reptiles and birds is a single large sac, partitioned by septa: bladelike sheets. Septa increase the surface area for respiratory exchange.
Septate lungs are not elastic. Snakes and lizards move ribs to draw air in. The side-to-side swaying of lizard locomotion inhibits lung cavity expansion, so lizards do not breathe while moving; hence lizard movements are in bursts.
In contrast to the relative uniformity of alveolar respiration, there are many variations of the septate lung design and ventilation. Crocodiles have a septate lung and a diaphragm, albeit a diaphragm different from that of mammals. Snakes, lizards, and birds have no diaphragm.
Birds have their own unique septate lung system. Avian lungs are small and somewhat rigid. They do not expand and contract on each breath. Nonetheless, the rib cage is very much involved in respiration.
Birds have additional air sacs attached to their lungs. When a bird inspires air, the intake flows into a series of these air-sac appendages. From there the air passes one way into the lung tissue. The air is exhaled out the lungs.
One-way air flow across the lungs affords a countercurrent setup: air passes one way, while blood vessel flow goes the other way. This countercurrent creates a more efficient system for oxygen extraction and carbon dioxide venting than is possible in dead-end alveolar lungs.
At sea level, bird respiration is 33% more efficient than that of mammals. At 1,500 meters, birds breath 200% better than a mammal ever could: hence geese can fly over the Himalayas at an altitude that would kill a human.
The unique avian respiratory system descended from saurischian dinosaurs. There is no indication that ornithischians had this air-sac system.