Your thread title specifically refers to diesel engines and yet your description talks about gasoline and a 4-stroke gasoline cycle instead of the diesel cycle which uses the heat of compression to ignite the fuel-air mixture (and is frequently a two-cycle design, but not always).The four steps are like this:
1) The piston starts at the top, the intake valve opens, and the piston moves down to let the engine take in a cylinder-full of air and gasoline. This is the intake stroke. Only the tiniest drop of gasoline needs to be mixed into the air for this to work. (Part 1 of the figure)
2) Then the piston moves back up to compress this fuel/air mixture. Compression makes the explosion more powerful. (Part 2 of the figure)
3) When the piston reaches the top of its stroke, the spark plug emits a spark to ignite the gasoline. The gasoline charge in the cylinder explodes, driving the piston down. (Part 3 of the figure)
4) Once the piston hits the bottom of its stroke, the exhaust valve opens and the exhaust leaves the cylinder to go out the tailpipe. (Part 4 of the figure)
My questions:
1) What opens the intake valve? What moves the piston down?
2) What moves the piston back up?
3) Now I see that the piston moves down because of the explosion.
4) What moves the piston back up? And what opens the out valve?
Have you bothered to do a Google search to try to answer any of these questions?