Stroke 1. The downward moving piston sucks a mixture of air and petrol vapour into the cylinder.
Stroke 2. The piston moves up, compressing the gas mixture. This is where a low octane fuel might ignite and cause knocking.
Stroke 3. Just before the piston reaches the top of the cylinder a spark from the spark plug explodes the gas mixture. This pushes the piston down and drives the crank shaft round.
Stroke 4. The piston moves up and pushes the gases out through the exhaust valve. As the piston moves down, it pulls more fuel/air mixture in to begin the cycle again.