Here's the breakdown:
* Petrol (Gasoline) Engines: A spark plug provides the spark to ignite a pre-mixed air-fuel mixture in the cylinder. The fuel and air are mixed *before* they enter the cylinder. The spark initiates combustion.
* Diesel Engines: Diesel engines compress the air in the cylinder to a very high temperature and pressure. Then, the fuel is injected into this hot, compressed air. The heat of the compression is enough to ignite the fuel spontaneously – no spark is needed. The fuel and air are mixed *after* they are in the cylinder.
In short, the different combustion methods necessitate different ignition systems. Spark plugs are essential for the spark ignition of petrol engines, but are unnecessary and would be ineffective in the compression ignition process of diesel engines.