I would like to know which operations or functions do the car when I turn de key to On position (the key positions before start the engine) in gas engine and in diesel engine. For example, in a diesel engine I know the engine got warm.
This varies a lot by model, era etc., but a general overview:
The first thing that happens is the ancilliary electrical systems are powered:
but also the Engine control unit, or ECU, which is what controls the engine (spark timing, fuel flow, airflow etc) so that it is ready to start the engine
Many of these are then switched off when the starter motor is engaged, just to reduce the load on the battery, as the starter motor is the largest current draw in your entire car, but once the engine is running and the key is released it moves back to the on position.
In a petrol engine there is no need to preheat the cylinders like you have in a diesel.