As mentioned before O2 and CO2 exchange in opposite directions across the lung-blood barrier at the same time. The flow rate is partially dependent on the pressure drop (gradient) across that barrier, with flow going from the higher to lower pressure. O2 moves from the alveoli (lungs) at a partial pressure (pp) of 160 mmHg to the capillaries (blood) sitting at 46 mmHg. The pressure drop is 114 mmHg. CO2 goes the other way from the blood at 46 mmHg to 40 mmHG in the lungs. The pressure drop is only 6 mmHg.
One way of describing pp is if you took a gas, say air which is composed of 21% O2 and 79% N2 (neglecting trace gasses), and filled a container at the surface the total pressure is 1 atm (atmosphere) or 14.7 psia. If, in that same container, you removed all the O2 the N2 would exert a pressure of 0.79 atm. 0.79 atm is the pp of N2 at the surface. Likewise, extracting all the N2 would leave a total pressure of 0.21 atm -- O2's pp.
Where this is significant is when calculating the effects of each component of the gas on the diver at depth. A tank of air at 33 fsw (feet of sea water) will provide the diver with 2 atm of air in his lungs in order to equilize at the ambient pressure of the water. The pp's of each gas is then double what it is at the surface so O2 = 2 x 0.21 or 0.42 and N2 = 2 x 0.79 or 1.58 atm (0.42 + 1.58 = 2.0).
Unfortunately, both O2 and N2 give divers problems at depth. O2 is toxic above about 1.6 atm pp. N2 becomes highly narcotic below about 150 feet (the effect is highly dependent on individual makeup). I use a maximum of 1.4 atm of ppO2 when diving on EAN (Enhance Air Nitrox) which is a gas with more than 21% O2 in it. How deep can I go on air keeping the ppO2 to less than 1.4 atm's? If each 33 feet of O2 is 0.21 atm then it would be 1.4 / 0.21 = 6.6 or ~ 7. Subtracting out 1 atm which is what we have at the surface means I can go to a maximum depth of 6 x 33 ft or 198 feet. Below that I'm at high risk for oxtox which manifests itself as a grand mall seizure -- not a very good thing. It usually means drowning. Even more restrictive is the effects of N2 at this depth which would mean severe impairment. If I decide to reduce the ppN2 to a level at 132 feet I must keep the ppN2 to under 132/33 + 1 or 5 x 0.79 = 3.95 atm. However, I'm diving to 198 feet or 6 atm. I'm 2 atm pp over on N2. To keep the ppN2 to 3.95 atm at 198 feet I need only 3.95 / 7 or 0.56 atm originally at the surface. The total mix of my gas becomes 21% O2 + 56% N2 or 77%. To get to 100% we add 23% helium to the mix. Helium does not have the narcotic effects of nitrogen. This combination of O2, N2, and He is called trimix.