The gasoline-engine (Otto-engine) wasn't very efficient, that is why 1892 Rudolf Diesel had developed the engine with great efficiency named after him.
It is like the Otto-engine a 4-stroke engine. The main differences are:
1st stroke (Intake):
Only air is sucked in.
2nd stroke (Compression):
The air is powerfully compressed.
3rd stroke (Combustion):
Diesel is directly injected into the compressed air and ignites spontaneously.
4th stroke (Exhaust):
Like the Otto-engine.
Click here, to find out more detailed information about the Otto-engine.