Tech moves fast! Stay ahead of the curve with Techopedia!
Join nearly 200,000 subscribers who receive actionable tech insights from Techopedia.
A state machine is a concept used in designing computer programs or digital logic. There are two types of state machines: finite and infinite state machines. The former is comprised of a finite number of states, transitions, and actions that can be modeled with flow graphs, where the path of logic can be detected when conditions are met. The latter is not practically used.
A state machine is any device storing the status of something at a given time. The status changes based on inputs, providing the resulting output for the implemented changes. A finite state machine has finite internal memory. Input symbols are read in a sequence producing an output feature in the form of a user interface.
State machines are represented using state diagrams. The output of a state machine is a function of the input and the current state. State machines play a significant role in areas such as electrical engineering, linguistics, computer science, philosophy, biology, mathematics, and logic. They are best used in the modeling of application behavior, software engineering, design of hardware digital systems, network protocols, compilers, and the study of computation and languages.
The operation of a state machine begins from a start state. On a successful transition it ends up in an accept state. The transition takes place based on the inputs provided. The current state depends on the past state of the system. The number of states formed depends on the available states of memory. A transition is enabled based on certain conditions and indicates a state change. An action describes an activity performed at the given moment. The different types of actions are transition action, input action, entry action, and exit action.
Deterministic automata have exactly one transition in every state for each possible input. In non-deterministic automata, a state input leads to one, many, or no transitions. A state machine with only one state is called a combinatorial state machine and uses only input actions.
The two different groups of state machines are acceptors and transducers. Acceptors produce a binary output, based on whether the input is accepted or rejected by the machine. While processing the input, if the current state is accepting, the input is accepted. Otherwise it is rejected. Languages accepted by state machines are called regular languages. Start states are represented by an arrow pointing on it from anywhere, while accepted states are represented using double circles. Transducers cater output based on a given input, using actions. Moore and Mealy machines are examples of transducers.
Unmodified modeling language state machines are also widely used as they have both the Moore and Mealy machine characteristics within them. They include additional concepts such as orthogonal regions and hierarchically-nested states.