The real difference between a gas and diesel engine, is the lack of Vacuum. Like mentioned before the diesel has a non-restricted intake, it consumes 100% of the available air all the time. Where a GAS engine does not, it has to maintain a strict air/fuel ratio of 14. 2:1 to live. The addition of a carburetors "Butterfly valves" or the more modern fuel injected engines" throttle body valve", closes to create the vacuum. It's this opening and closing of the intake air way that causes the back pressure which causes the "engine braking" or deceleration under coast conditions. The diesel has nothing to restrict it's intake air way, and hence has no back pressure to cause the engine braking. This small difference between the two engine types is also one of the reason diesels get better fuel mileage. There the gas engine is always in a battle to maintain the correct air/fuel ratio, the diesel is not. So while idling along in city traffic, or in the drive, it's air/fuel ratio can go to 200:1 or better. We adjust the fuel to get more power, need to get over that hill step on the peddle and pour the fuel on. The air never changes, it is always consuming as much as it can. In the gas engine, they use an array of metering devices to control that delicate balance of air/fuel. Throttle bodies limit the air intake and Mass air sensors measure the air intake, those along with many other input devices, allow the on-board computer to make the right adjustment in regards to the fuel mapping. The oxygen sensor then reads the exhaust gases and tells the computer if it's current fuel mapping is right, if not it will make the needed changes till the readings are back within specifications. This is called a closed-loop system, it makes changes and then evaluates those changes, always checking itself for the most efficient running condition.