Answer: Gasoline and diesel engines are both available in either 2-stroke or 4-stroke versions.
In a 4-stroke engine the sequence can be written:
Compression Stroke. The piston goes up and compresses a fuel/air mixture (in a gas engine) or just air (in a diesel). Power Stroke. The fuel is ignited (by a spark in a gas engine, by being injected into high temperature air in a diesel.) The energy released drives the piston down. This provides the momentum necessary to keep the crankshaft turning and make the other three strokes happen. Exhaust Stroke. The piston goes up and pushes the burned gases out the exhaust valve. Intake Stroke. The piston goes down and draws in new air, or fuel/air mixture, ready for the next compression stroke.
In a 2-stroke engine, the last three strokes are combined into one. Compression Stroke. The piston goes up and compresses a fuel/air mixture (in a gas engine) or just air (in a diesel.) Power Stroke. The fuel is ignited and drives the piston down. As the piston goes down it not only turns the crankshaft but also pressurizes the fuel/air mixture in the crankcase which is about to be admitted to the piston for the next cycle. Near the bottom of the stroke, an outlet opens and the exhaust gases are released. Even nearer the bottom of the stroke, an inlet opens and new fuel/air (which was just pressurized by the piston) rushes in ready for compression.
Because a 2-stroke engine gets a power stroke twice as often as a four-stroke engine, it puts out about twice as much power (and makes twice as much noise) as a four-stroke engine of the same size.
The downside is that, because the 2-stroke engine is sloppier about how it expels exhaust and takes in fuel, doing them almost at the same time, it is more polluting. Also, the 2-stroke engine lets fuel into the crankcase, where the piston can pressurize it prior to intake. In order to keep the crankcase lubricated, you have to add expensive lubricants to the fuel, and even so, 2-stroke engines don't last very long.
So 2-stroke engines are used in chainsaws and lawnmowers, where power/weight is important, but the engine isn't used for long periods so pollution and engine life are less of a concern.
Hope this answers your question.
Q&A Library Searching Tips