To turn off a diesel engine, the fuel supply to the engine must be cut off. This can be done manually by shutting off the fuel valve or by using an automatic shutdown mechanism. When the fuel supply is cut off, the engine will continue to run for a short time until the fuel in the cylinders is exhausted. Once all the fuel is consumed, the engine will stop running.
Some diesel engines are equipped with a glow plug system that helps to start the engine in cold weather. The glow plugs heat the air in the cylinders, making it easier for the diesel fuel to ignite. When the engine is turned off, the glow plugs are automatically turned off as well.
Diesel engines are also equipped with a safety feature called an overspeed governor. The overspeed governor is designed to prevent the engine from running too fast. If the engine speed exceeds a certain limit, the overspeed governor will automatically shut off the fuel supply to the engine.