0

Considering the following state machine diagram, it is CORRECT to state that:

enter image description here

Select one or more:

a. the Restart event will always be executed in the Halted state.

b. After a Halt and Restart event and assuming no previous history is available the re-enter state will be State1

c. Assuming the current state is State2 and Halt occurs and that there is no preferred entry state, the next state transition (after re-entry) will result in the current state to be State3.

d. "Endop" is the final state.

e. Only the Complete event can lead to the Completed state.

The correct options are B and C. I don't understand why. I know how state machine diagrams work but why is A not correct, there is a Restart arrow coming out of Halted so surely restart event will always be executed in halted state. For B, after a Halt and Restart it goes to the H, which is not State1. For C, I don't even understand what its asking. Could someone explain why these options are correct?

2 Answers 2

3

A: "Restart" can happen at any time (state machine diagrams don't show when a specific event occurs, but instead when it's handled. I.e. "Restart" can happen anytime, but is only handled in the "Halted" state - in any other state it can occur, but is ignored. (I find it a bit misleading that the verb "execute" is used for an event, however.)

C: "H" is the "History connector": It stores the last state we were in before leaving "operating" and restores that state on re-entry. Thus, the next state after re-entry will be "State 3" ("State 2" will be restored and the machine will immediately transition to "State 3").

B: "Assuming no previous history is available" means we've never been in "Operating" before (otherwise, we had one after a "Halt" and "Restart"). With no history, we'll obviously end up in State 1 after re-entry.

3
  • Regarding C, wouldn't we expect a visible transition/arrow from H to State2? Why is only the "no history" arrow explicitly shown?
    – Erik Eidt
    Apr 3, 2022 at 0:02
  • 1
    @ErikEidt, H is not an actual state. It is a marker indicating that the composite state it is drawn in maintains a history and a transition to H should be interpreted as a transition to the sub-state that was active at the time we left the composite state. The explicit arrow is only to have a defined behavior if there is no last active sub-state. Apr 4, 2022 at 7:27
  • @ErikEidt Exactly - In code, you simply retain the inner state of the FSM and go from there on re-entry without re-initializing the FSM.
    – tofro
    Apr 4, 2022 at 9:45
0
  • not A: the Complete event can be executed in the Halted state.
  • not D: "Completed" is the last final state, the proposed final state is merely that of the component.
  • B is correct as you said: assuming no previous history.
  • C is correct, (H) = history will preset with State 2 and come to State 3.

So the piece of knowledge one needs is that (H) is the history connector. But B indeed gives a hint.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.