Diesel engines and gasoline engines are almost similar. Both of them are combustion engines that convert the chemical energy that is present in the fuel into the mechanical energy. This mechanical energy then moves the pistons inside cylinders and the up and down movement of the pistons creates the rotary movement that helps the wheels of a vehicle to move forward.
The difference however lies in the way this combustion takes place. Whereas in a gasoline engine, fuel is mixed with air compressed by pistons, and is then ignited by the sparks. In case of diesel engine the air is compressed and then the fuel is injected. Compression allows the air to heat up which helps ignite the fuel.
In diesel engines, the combustion process takes place through four strokes. There is intake stroke, compression stroke, combustion stroke and exhaust stroke.
Unlike gasoline engines, the diesel engine has no spark plug for air intake and compression. It is the heat produced by the compressed air that lights the fuel in a diesel engine.