The big difference between petrol and diesel engines is where the fuel and air mix
In the majority of petrol engines liquid petrol is injected into the inlet airstream before it enters the cylinders. A mixture of fuel vapour (droplets of liquid) and air enters the cylinders, where it is compressed and ignited by a spark. A diesel engine ingests only air. This is compressed well beyond the point where a fuel/air mixture would spontaneously burn. At precise points near the peak of each compression event, measured doses of fuel are injected, which ignite spontaneously. The diesel process is more efficient.
The piston doesn’t really push spent gasses out past the exhaust valve
Engines aren’t pumps, but they do experience what engineers call ‘pumping losses’. When the fuel/air mixture burns, it expands rapidly, and this expansion is the harbinger of motive power. It shoves the piston down. Before the piston gets right to the bottom of its stroke the exhaust valve opens. The mixture, still expanding rapidly, is expelled through the aperture of the open exhaust valve. In a very real sense, its expansion pushes it out the chamber. Which leads us to…
The piston doesn’t really