Controlling the engine is the most processor-intensive job in a car, and the engine control unit (ECU) is the most powerful computer on most cars. The ECU uses closed-loop control, managing the emissions and fuel economy of the engine.
Gathering data from dozens of different sensors, the ECU knows everything from the coolant temperature to the amount of oxygen in the exhaust. With this data, it performs millions of calculations each second, to decide on the best spark timing and determining how long the fuel injector is open. The ECU does all of this to ensure the lowest emissions and best mileage.