Finite automata, also known as state machines or FSM (finite-state machines), are a mathematical model of computing used in the design of computer programs and sequential logic circuits. In general, a finite automaton (singular) is a machine that transitions from one state to another. It reacts with a predefined sequence of behaviors when it encounters a certain event.
For example, a subway station turnstile is an example of a finite state machine. When a passenger deposits the required fare into the machine, the machine changes from one predefined state (locked) to another (unlocked), permitting the passenger to enter.