The CPU (the computers brain) reads each instruction line by line, storing and updating variables in memory and waiting for any needed input. It then sends commands to output devices like the screen, any errors/bugs stop the program running or make it behave unexpectedly.