Avian lungs are remarkably different from mammalian lungs in that air flows unidirectionally through rigid tubes in which gas exchange occurs. Experimental observations have been able to determine the pattern of gas flow in the respiratory system, but understanding how the flow pattern is generated and determining the factors contributing to the observed dynamics remains elusive. It has been hypothesized that the unidirectional flow is due to aerodynamic valving during inspiration and expiration, resulting from the anatomical structure and the fluid dynamics involved, however, theoretical studies to back up this hypothesis are lacking. We have constructed a novel mathematical model of the airflow in the avian respiratory system that can produce unidirectional flow which is robust to changes in model parameters, breathing frequency and breathing amplitude. The model consists of two piecewise linear ordinary differential equations with lumped parameters and discontinuous, flow-dependent resistances that mimic the experimental observations. Using dynamical systems techniques and numerical analysis, we show that unidirectional flow can be produced by either effective inspiratory or effective expiratory valving, but that both inspiratory and expiratory valving are required to produce the high efficiencies of flows observed in avian lungs. We further show that the efficacy of the inspiratory and expiratory valving depends on airsac compliances and airflow resistances that may not be located in the immediate area of the valving. Our model provides additional novel insights; for example, we show that physiologically realistic resistance values lead to efficiencies that are close to maximum, and that when the relative lumped compliances of the caudal and cranial airsacs vary, it affects the timing of the airflow across the gas exchange area. These and other insights obtained by our study significantly enhance our understanding of the operation of the avian respiratory system.