The branch of physiology that deals with the processes of gas exchange and the mechanics of breathing.