We don't give a second thought to walking and breathing at the same time, but some ancient creatures (as well as some that are still around) could not do that.
Have you ever wondered whether dinosaurs could walk and breathe at the same time? Lizards can't do both at once; they have to pause when they're running in order to take breaths.
But if we want to know whether dinosaurs could breathe and run at the same time, we should actually be looking to birds instead of lizards since birds are closer relatives.
In fact, birds and alligators the dinosaurs' closest living relative both have mechanisms for breathing and walking at the same time. What's particularly striking is the fact that birds and alligators, unlike humans and other mammals, have a hinge-like joint in their pelvis that allows the pubic bone to move.
When an alligator or bird inhales the pubic bone rocks downward, expanding the abdominal cavity. In the particular case of the gator, its liver is attached to its lungs and acts as a breathing pump. The liver moves into that extra space in the abdominal cavity.
Thus the lungs have room to expand, and when the gator exhales, the pubic bone moves back into place, reducing the size of the abdominal cavity and pushing the liver back against the lungs.