A simulator provides a convenient imitation of some real device or state of affairs. Often the convenience is to permit mistakes during training for a safety-critical system.
A flight simulator is used to train pilots on the ground. It permits a pilot to crash his simulated "aircraft" without being hurt. Flight simulators are often used to train pilots to operate aircraft in extremely hazardous situations, such as landings with no engines, or complete electrical or hydraulic failures.
Many video games are also simulators, implemented inexpensively.
In computer programming, a simulator is often used to execute a program that has to run on some inconvenient type of computer. For example, simulators are usually used to debug a microprogram. Since the operation of the computer is simulated, all of the information about the computer's operation is directly available to the programmer, and the speed and execution of the simulation can be varied at will.
Simulators fall into two distinctly different types.
A discrete simulation manages only events, and time. Most computer, logic-test and fault-tree simulations are this type. In this type of simulation, the simulator maintains a queue of events sorted by the simulated time they should occur. The simulator reads the queue, and triggers new events as each event is processed. It is not important to execute the simulation in real time. It's often more important to be able to access the data produced by the simulation, to discover logic defects in the design, or the sequence of events.
An analog simulation uses partial differential equations, implemented numerically. Periodically, the simulation program recalculates all the equations, and uses the numbers to change the state and output of the simualtion. Most flight and race-car simulations are this type. This type may also be used to simulate electrical circuits. It's often very important to display the results in real time, to provide a realistic simulation for the trainee or gamer.