A copy/paste from the same old thread:
In any engine there is valve overlap.
Why do you need to have overlapping valve openings? Because
air has inertia.
If you close the intake valve just when the piston reaches the bottom of its movement (what is called "BDC" or "Bottom Dead Center"), you are going to stop the inrush of air right when is entering the cylinder at its highest speed.
The air has inertia, like almost anything in this world. So, you left the valve open a little more time, with the final effect that, even while the cylinder is moving up, on the compression stroke, the air is still entering the cylinder because of that inertia, giving you a little extra mixture inside the cylinder.
Piston at the bottom of its movement: the air is entering at high speed, the piston barely has started to move upwards, so air continues to enter
If you close the intake at BDC, you'll shut the intake when the air is at top speed. So, you left the valve open for a little, because even if the piston starts to move upwards after the BDC, the air is not going to "feel" that movement instantly: the "compression wave" has to move from the piston head towards the opening for the air to stop entering.
Now, imagine the opposite: the piston is at the top of its movement, in the exhaust stroke, air is exiting.
The air exits faster when the cylinder reaches TDC (top dead center), that is, the topmost point of its movement, right?
Piston at the top dead center: air is still exiting at high speed, so it pulls some air from the intake (if you open the intake valve some milliseconds before TDC)
So, if you open the intake valve a little BEFORE TDC, the fumes, that are exiting from the cylinder through the exhaust valve at top speed, "pull" some air from the intake valve, helping some extra air to enter the cylinder. This is called "scavenging".
A valve camshaft is a compromise: at low rpm you do not want overlap, the air is not rushing in and out at high speeds.
This effect of the "inertia of the air" is more noticeable at high rpms, simply because the air is moving faster. This is why the overlap of the valves is greater in race engines, that develop ultra-high rpms.
If you wish, you can watch an animation here:
http://static.howstuffworks.com/flash/camshaft-cam.swf (you need a Flash plugin in your browser to watch it).