State Machine

A state machine, also referred to as a finite-state machine (FSM), is a mathematical model of computation. It’s an abstract concept whereby the machine can consist of a finite number of states at any given time. In simpler terms, the machine can have different states, but can only fulfill one at a time. The FSM can change states in response to some inputs. The changing of states is known as a transition. Based on the current state and a given input, the machine performs transitions and produces outputs. State machines are helpful for understanding sequential logic roles. 

A popular example of an FSM is a simple, 3-color traffic light. At any given time, the traffic light has a defined state: The green light is on with the other two lights off, the yellow light is on with the other two lights off, or the red light is on with the other two lights off. The traffic light will change state when it receives an input, normally a fixed timer, to produce an output: turning a light on and the other light off. The state can only change in response to an input. The light cannot change for any other reason (unless programmed to). 

State machine types 

State machines are classified into two types: Mealy machines and Moore machines.  

Mealy state machine 

The Mealy machine was invented by George Mealy in 1955. Mealy machines produce outputs only on transitions and not in states. This can result in state diagrams with fewer states because more can be placed on transitions. A few characteristics are: 

  • If input changes, output changes
  • Less number of states are required than Moore machines
  • More hardware requirements than Moore machines 
  • Reaction time to inputs is slower
  • Difficult to design

Moore state machine 

Named after inventor Edward Moore, the Moore machine was introduced in 1956. Moore machines consist of states and transitions. States can produce outputs, and the output is determined by the current state, not the input. A few characteristics are: 

  • If input changes, output does not change
  • More number of states are required than Mealy machines
  • Less hardware requirements than Mealy machines
  • Reaction time to inputs is faster
  • Easy to design
Webopedia Staff
Webopedia Staff
Since 1995, more than 100 tech experts and researchers have kept Webopedia’s definitions, articles, and study guides up to date. For more information on current editorial staff, please visit our About page.
Get the Free Newsletter
Subscribe to Daily Tech Insider for top news, trends & analysis
This email address is invalid.
Get the Free Newsletter
Subscribe to Daily Tech Insider for top news, trends & analysis
This email address is invalid.

Related Articles

Embedded Analytics

Embedded analytics brings self-service business intelligence to everyday application users.

HRIS

Human resources information system (HRIS) solutions help businesses manage multiple facets of their workforce operations. They provide a central platform for human resources professionals...

Complete List of Cybersecurity Acronyms

Cybersecurity news and best practices are full of acronyms and abbreviations. Without understanding what each one means, it's difficult to comprehend the significance of...

Human Resources Management System

A Human Resources Management System (HRMS) is a software application that supports many functions of a company's Human Resources department, including benefits administration, payroll,...

ScalaHosting

ScalaHosting is a leading managed hosting provider that offers secure, scalable, and affordable...

HRIS

Human resources information system (HRIS) solutions help businesses manage multiple facets of their...

Best Managed Service Providers...

In today's business world, managed services are more critical than ever. They can...