The Otto cycle gasoline Engine was patented in 1854, the Disiel Engine was patented in 1893.
Both engines take in air and compress it along with fuel. In Gasoline engines the air and fuel can be mixed in a carbuerator or in both the gasoline and disiel engines, fuel can be added via fuel injection.
Disel engines rely on the heat of compression to initiate a flame where as gasoline requires an outside energy to cause the air/fuel mixture to ignite. The outside system in a gasoline engine is the ignition system with spark plugs, coils to increase voltage and atiming system to creat the spark at the correct time.
Then, of course, there is the Petrol / Diesel engine. Spark plugs and distrubutor on one side and injectors and injector pump on the other. As found on the (very old) International TD14 crawler agricultural tractor.
It was designed to be started on Petrol and with the 'push' of one lever, the drive to the distributor was dis-connected and the injector pump was engaged. At the same time, the same lever closed a cavity on each cylinder head therby suitably increasing the compression ratio for the diesel side to function. It worked quite well (as I remember). It was American made for the UK War-Ag!
__________________
"A common mistake people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools!" Douglas Adams 1952-2001. E&OE!