Real-Time Systems Development

Chapter 6: Finite State Machines Implementation Options

6.1 Chapter overview

In the previous chapter, the use of Finite State Diagrams (FSD) for designing computer systems was presented. Here, a variety of alternative transformation techniques for obtaining runnable code from an FSD will be described. An example application for the recommended Finite State Table (FST) implementation technique is presented in greater detail.

6.2 Implementing an FSD

The FSM design method is readily understood and quite easily transformed into software for implementation. The five principal approaches for carrying out this transformation are listed below. These will now be presented in code form using the simulation of an electric toaster as an exemplar case study.

Implementation techniques for FSDs
  • Sequential code

  • Multiple SWITCH-CASE

  • GOTOand labels

  • FST: Finite State Table method

  • Object-oriented design pattern with dynamic states

A crucial distinction depends on the way that input data and events are monitored and recorded. The first two techniques often employ simple blocking reads, holding the thread of execution while waiting for the expected input or status change. Such an approach may not always be compatible with the demands of system enhancement and maintenance.


Finite state diagram for the toaster

During implementation, one of the biggest dangers to be avoided is becoming blocked within a transition action due to unsuccessful I/O or an overlong algorithm. This would lead to the system stalling, deadlocked until the action completes. During such intervals some polled input data could be missed, and certainly a user would detect a general drop in system responsiveness. A highly unwelcome circumstance...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Finite-difference time-domain (FDTD) Software
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.