Uncontrolled combustion in the gasoline engine is known as knocking and in the diesel engine it is called as detonation. This is done in order to reduce confusion
Gasoline Engine - Hitting
The gasoline engine is a homogeneous mixture engine, here the fuel will ignite at one end and there will be the defined flame front progressing to consume all the fuel.
The above images show the normal combustion process in a gasoline engine. There will be a flame front (orange) that consumes all the fuel. the adjacent (gray) fuel layers become inflamed due to the increased pressure due to the expansion of the burnt gases (brown color) and due to the conduction of heat, whereby the flame progresses as a ripple in the water.
Hitting happens when any of the fuel mixture goes into combustion before the flame has been reached. This may be due to a higher cylinder wall temperature, lower quality fuel (low octane), incorrect design of the combustion chamber (more circumference, therefore the front of the flame will take longer to reach the mixture of fuel without burning)
This new flame front will begin to propagate and eventually collide with the original flame front, so that the charge between two flame front will experience a steep increase in pressure and will consume very fast (sonic or super sonic speeds), is when you hear ping ping noise.
The gasoline engine can also hit due to preignition due to the hot spots on the cylinder or the spark plug itself. The combustible air mixture may start to burn before any spark has been applied.