{"id":7635,"date":"2022-02-21T04:05:08","date_gmt":"2022-02-21T04:05:08","guid":{"rendered":"http:\/\/fastbitlab.com\/?p=7635"},"modified":"2023-10-12T16:48:40","modified_gmt":"2023-10-12T11:18:40","slug":"hierarchical-state-machineshsms-hsms","status":"publish","type":"post","link":"https:\/\/fastbitlab.com\/blog\/hierarchical-state-machineshsms-hsms\/","title":{"rendered":"FSM Lecture 45- Hierarchical State Machines(HSMs)"},"content":{"rendered":"<div class=\"boldgrid-section\" style=\"background-image: linear-gradient(to left, #eeeeee, #eeeeee);\" data-bg-color-1=\"#EEEEEE\" data-bg-color-2=\"#EEEEEE\" data-bg-direction=\"to left\">\n<div class=\"container\">\n<div class=\"row\" style=\"padding-top: 35px; padding-bottom: 0px; background-image: linear-gradient(to left, #eeeeee, #eeeeee);\" data-bg-color-1=\"#EEEEEE\" data-bg-color-2=\"#EEEEEE\" data-bg-direction=\"to left\">\n<div class=\"col-md-1 col-sm-12 col-xs-12 col-lg-1\">\n<p>&nbsp;<\/p>\n<\/div>\n<div class=\"col-md-10 col-sm-12 col-xs-12 col-lg-10\">\n<h1 class=\"\" style=\"text-align: center; font-size: 30px; border-width: 0px; line-height: 45px;\"><span style=\"color: #003366;\"><strong>Hierarchical State Machines(HSMs)<\/strong><\/span><\/h1>\n<div class=\"row bg-editor-hr-wrap\" style=\"border-width: 0px; margin-top: -25px;\">\n<div class=\"col-lg-12 col-md-12 col-xs-12 col-sm-12\">\n<div>\n<p>&nbsp;<\/p>\n<div class=\"bg-hr bg-hr-10 color2-color\" style=\"border-style: solid; border-width: 0px 0px 3px;\"><\/div>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p class=\"\" style=\"border-width: 0px; font-size: 17px; line-height: 30px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">This article teaches about HSMs, which stands for Hierarchical state machines.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">In the previous article, we used the Flat state machine(FSM) approach for our project. A flat state machine means there were no composite states. You don\u2019t see any state embedded within another state. The state machine diagram had a couple of states interconnected by a couple of arrows here. So those are nothing but the external transition, and the state machine diagram looks messy, as shown in Figure 1.&nbsp;<\/span><\/p>\n<figure id=\"attachment_7638\" aria-describedby=\"caption-attachment-7638\" style=\"width: 1160px\" class=\"wp-caption aligncenter\"><img fetchpriority=\"high\" decoding=\"async\" class=\"size-full wp-image-7638\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/02\/Figure-1-24.png\" alt=\"Figure 1. State machine diagram\" width=\"1160\" height=\"613\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-1-24.png 1160w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-1-24-300x159.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-1-24-768x406.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-1-24-1024x541.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-1-24-600x317.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-1-24-120x63.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-1-24-500x264.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-1-24-200x106.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-1-24-400x211.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-1-24-800x423.png 800w\" sizes=\"(max-width: 1160px) 100vw, 1160px\" \/><figcaption id=\"caption-attachment-7638\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 1. State machine diagram<\/span><\/figcaption><\/figure>\n<p data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">For this exercise, there were just five states. So, it was quite manageable. But when you want to introduce more features to your application, you could be introducing more states. And when you introduce more states, obviously there will be many transitions among the states, more Guard conditions, so drawing your state machine gets complicated.&nbsp;<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">When the complexity of the state machine diagram increases, it becomes too tedious to maintain, visualize, and troubleshoot. That&#8217;s why it would be better to explore what are hierarchical state machines used to tackle this problem.&nbsp;<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">HSMs will greatly reduce the complexity introduced by the Flat state machine approach.<\/span><span style=\"font-weight: 400;\">&nbsp;<\/span><\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 26px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; line-height: 36px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"text-decoration: underline; color: #003366;\"><span style=\"font-weight: 400;\">Disadvantages of using a Flat state machine<\/span><\/span><\/p>\n<ul class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">As the number of states increases, the number of transitions tends to increase, which increases the complexity<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">Hard to draw, visualize, trace and troubleshoot<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">Chances of committing more mistakes by missing transitions<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">Code repetitions (not efficient code reusability)<\/span><\/li>\n<\/ul>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 27px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; line-height: 40px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><strong><span style=\"text-decoration: underline; color: #000080;\">Hierarchical State Machines(HSMs)<\/span><\/strong><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">The word \u2018Hierarchy\u2019 we observe in our day to day life.<\/span><\/p>\n<figure id=\"attachment_7639\" aria-describedby=\"caption-attachment-7639\" style=\"width: 1109px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"size-full wp-image-7639\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/02\/Figure-2-Corporate-Hierarchy.png\" alt=\"Figure 2. Corporate Hierarchy\" width=\"1109\" height=\"513\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-2-Corporate-Hierarchy.png 1109w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-2-Corporate-Hierarchy-300x139.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-2-Corporate-Hierarchy-768x355.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-2-Corporate-Hierarchy-1024x474.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-2-Corporate-Hierarchy-600x278.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-2-Corporate-Hierarchy-120x56.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-2-Corporate-Hierarchy-500x231.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-2-Corporate-Hierarchy-200x93.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-2-Corporate-Hierarchy-400x185.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-2-Corporate-Hierarchy-800x370.png 800w\" sizes=\"(max-width: 1109px) 100vw, 1109px\" \/><figcaption id=\"caption-attachment-7639\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 2. Corporate Hierarchy<\/span><\/figcaption><\/figure>\n<p data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">For example, consider the hierarchy of what you find in the corporate world. There is a strict hierarchy in the company, under which all the employees work, and the company operates with a strict hierarchy. There will be a CEO of the company; under the CEO, there could be a couple of VPs and managers, and under each manager, there will be a team of Engineers, etc. This is a hierarchy.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">For the states also, you can draw such a hierarchy, as shown in Figure 3.<\/span><\/p>\n<figure id=\"attachment_7640\" aria-describedby=\"caption-attachment-7640\" style=\"width: 1151px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"size-full wp-image-7640\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/02\/Figure-3-Hierarchical-structure-of-states.png\" alt=\"Figure 3. Hierarchical structure of states\" width=\"1151\" height=\"632\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-3-Hierarchical-structure-of-states.png 1151w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-3-Hierarchical-structure-of-states-300x165.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-3-Hierarchical-structure-of-states-768x422.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-3-Hierarchical-structure-of-states-1024x562.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-3-Hierarchical-structure-of-states-600x329.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-3-Hierarchical-structure-of-states-120x66.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-3-Hierarchical-structure-of-states-500x275.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-3-Hierarchical-structure-of-states-200x110.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-3-Hierarchical-structure-of-states-400x220.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-3-Hierarchical-structure-of-states-800x439.png 800w\" sizes=\"(max-width: 1151px) 100vw, 1151px\" \/><figcaption id=\"caption-attachment-7640\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 3. Hierarchical structure of states<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<figure id=\"attachment_7641\" aria-describedby=\"caption-attachment-7641\" style=\"width: 1175px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-7641 size-full\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/02\/Figure-4-18.png\" alt=\"Hierarchical State Machines(HSMs)\" width=\"1175\" height=\"616\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-4-18.png 1175w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-4-18-300x157.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-4-18-768x403.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-4-18-1024x537.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-4-18-600x315.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-4-18-120x63.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-4-18-500x262.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-4-18-200x105.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-4-18-400x210.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-4-18-800x419.png 800w\" sizes=\"(max-width: 1175px) 100vw, 1175px\" \/><figcaption id=\"caption-attachment-7641\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 4. FSM structure of states<\/span><\/figcaption><\/figure>\n<p data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">For example, consider a picture shown in Figure 4.&nbsp; S1_0, S1_1, S1_2 are states or substates or child states of S1 (super state), which can be introduced like this shown in Figure 3. There is a state S1, and under which there could be a couple of substates, like that.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Here, S1_0, S1_1, S1_2 can be called a direct substate of S1, or S1 can be called a direct super state of S1_0, S1_1, S1_2 substates. S1 also can be called a simple composite state. And S1, S2, and S3 are direct substates of the superstate S0, and like that. Here, S1_0 is not a direct substate of S0; you can call it an indirect substate of S0.&nbsp; <\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<figure id=\"attachment_7642\" aria-describedby=\"caption-attachment-7642\" style=\"width: 1210px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-7642 size-full\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/02\/Figure-5-17.png\" alt=\"Hierarchical State Machines(HSMs)\" width=\"1210\" height=\"529\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-5-17.png 1210w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-5-17-300x131.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-5-17-768x336.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-5-17-1024x448.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-5-17-600x262.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-5-17-120x52.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-5-17-500x219.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-5-17-200x87.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-5-17-400x175.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-5-17-800x350.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-5-17-1200x525.png 1200w\" sizes=\"(max-width: 1210px) 100vw, 1210px\" \/><figcaption id=\"caption-attachment-7642\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 5. Example<\/span><\/figcaption><\/figure>\n<p data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Hierarchy&#8217;s can be of any level. Consider this example, shown in figure 5 . There are three states; S1, S2, and S3. And all these have common behavior. And the common behavior is whenever the trigger T1 happens, and the application state moves from one state to another.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">For example, look at picture (a). Currently, the application state is S2, when the trigger T1 happens, the application state moves from S2 to S0, that\u2019s an external transition. And this behavior is common among S1, S2, S3 states. That\u2019s why it could hint that we can transform this state machine diagram(a) into this one(b) using a hierarchical approach.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">In picture (b), SS1 is a composite state or a superstate consisting of 3 substates; S1, S2, and S3. And it inherits the common behavior of these three states to itself. <\/span><span style=\"font-weight: 400;\">&nbsp;<\/span><span style=\"font-weight: 400;\">&nbsp;<\/span><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">When the application is in the S1 state when trigger T1 happens, the meaning of this diagram is(b), S1 doesn\u2019t handle T1. That\u2019s why the trigger propagates to its superstate, that is, SS1. And SS1 handles it, and there is a transition to S0. That\u2019s the meaning of this state machine diagram. The same thing is applied to S2, S3 states as well.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">When the application state is in S2, and when T1 happens, S2 doesn\u2019t handle T1. Hence, it propagates to its superstate and SS1 handles it, and the state moves to S0.&nbsp;<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<figure id=\"attachment_7643\" aria-describedby=\"caption-attachment-7643\" style=\"width: 670px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-7643 size-full\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/02\/Figure-6-13.png\" alt=\"Hierarchical State Machines(HSMs)\" width=\"670\" height=\"440\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-6-13.png 670w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-6-13-300x197.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-6-13-600x394.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-6-13-120x79.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-6-13-500x328.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-6-13-200x131.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-6-13-400x263.png 400w\" sizes=\"(max-width: 670px) 100vw, 670px\" \/><figcaption id=\"caption-attachment-7643\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 6. Execution sequence as per the UML specification of FSM<\/span><\/figcaption><\/figure>\n<p data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">And here, what&#8217;s the sequence of execution when T1 happens? The application is in state S1, and&nbsp; T1 happens; what&#8217;s an execution sequence as per the UML specification? First, the exit action of S1 will be executed, then the transition action T1 will be executed, and lastly, the entry action of an S0 will be executed. That&#8217;s a sequence.&nbsp;<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<figure id=\"attachment_7644\" aria-describedby=\"caption-attachment-7644\" style=\"width: 649px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-7644 size-full\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/02\/Figure-7-10.png\" alt=\"Hierarchical State Machines(HSMs)\" width=\"649\" height=\"440\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-7-10.png 649w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-7-10-300x203.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-7-10-600x407.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-7-10-120x81.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-7-10-500x339.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-7-10-200x136.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-7-10-400x271.png 400w\" sizes=\"(max-width: 649px) 100vw, 649px\" \/><figcaption id=\"caption-attachment-7644\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 7. Execution sequence as per the UML specification of HSM<\/span><\/figcaption><\/figure>\n<p data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">The same thing should be applied to here as well, as shown in Figure 7. When the state is S3, and when T1 happens, the T1 propagates to the superstate(SS1), superstate handles that trigger T1, and there will be an external transition.&nbsp;<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">When that transition happens,<\/span><\/p>\n<ol class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">Exit action of S3 will be executed.&nbsp;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">And then, exit action of SS1 superstate will be executed if it is defined, because in this case, when T1 triggers, the superstate S11 is also exited. As per the UML specification, when the superstate is exited, the exit actions must be executed from the innermost leaving state towards the outermost state.&nbsp;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">And after that, the transition action will be executed&nbsp;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">Then, the entry action of the new state S0 will be executed.&nbsp;<\/span><\/li>\n<\/ol>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">The advantage is, in HSM, the complexity is reduced. And also, you can control code repetitions.&nbsp;<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">For example, in the Flat State Machine (see figure 5), the transition action T1 has to be mentioned in three places. But in HSM, you have to mention the transition action T1 in one place. So, one place means there is only one point of control; at only one place, you have to modify something if you wish to do so. That\u2019s why HSM helps you to reduce code repetitions. We will learn more about HSMs with code examples in the upcoming articles.&nbsp;<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 18px; line-height: 30px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #993366;\"><strong>Get the Full Course on Embedded System Design using UML State Machines<\/strong> <span style=\"color: #0000ff;\"><a style=\"color: #0000ff;\" href=\"https:\/\/www.udemy.com\/course\/embedded-system-design-using-uml-state-machines\/\" target=\"_blank\" rel=\"noopener\">Here<\/a><\/span>.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-size: 20px; line-height: 25px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000080;\"><b>FastBit Embedded Brain Academy Courses<\/b><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-size: 17px;\"><span style=\"color: #000000;\">C<span style=\"font-weight: 400;\"><span style=\"color: #000000;\">lick here:<\/span>&nbsp;<\/span><\/span><span style=\"color: #3366ff;\"><a style=\"color: #3366ff; text-decoration: underline;\" href=\"http:\/\/fastbitlab.com\/course1\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">https:\/\/fastbitlab.com\/course1<\/span><\/a><\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; Hierarchical State Machines(HSMs) &nbsp; &nbsp; This article teaches about HSMs, which stands for Hierarchical state machines. In the previous article, we used the Flat state machine(FSM) approach for our project. A flat state machine means there were no composite states. You don\u2019t see any state embedded within another state. The state machine diagram had [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":7639,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"0","ocean_second_sidebar":"0","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"0","ocean_custom_header_template":"0","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"0","ocean_menu_typo_font_family":"0","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"0","ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"off","ocean_gallery_id":[],"footnotes":""},"categories":[8],"tags":[17],"class_list":["post-7635","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-finite-state-machine","entry","has-media"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Hierarchical State Machines(HSMs) | Finite State Machine (FSM)<\/title>\n<meta name=\"description\" content=\"Explore the world of Hierarchical State Machines (HSMs), a powerful solution to manage complex state transitions in embedded systems. HSMs\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/fastbitlab.com\/blog\/hierarchical-state-machineshsms-hsms\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Hierarchical State Machines(HSMs) | Finite State Machine (FSM)\" \/>\n<meta property=\"og:description\" content=\"Explore the world of Hierarchical State Machines (HSMs), a powerful solution to manage complex state transitions in embedded systems. HSMs\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fastbitlab.com\/blog\/hierarchical-state-machineshsms-hsms\/\" \/>\n<meta property=\"og:site_name\" content=\"FastBit EBA\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/fastbiteba\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-02-21T04:05:08+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-10-12T11:18:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-2-Corporate-Hierarchy.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1109\" \/>\n\t<meta property=\"og:image:height\" content=\"513\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"FastBitLab\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@fastbiteba\" \/>\n<meta name=\"twitter:site\" content=\"@fastbiteba\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"FastBitLab\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/hierarchical-state-machineshsms-hsms\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/hierarchical-state-machineshsms-hsms\\\/\"},\"author\":{\"name\":\"FastBitLab\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/person\\\/e32b38e733a0d76ffa7e6bc998652e5d\"},\"headline\":\"FSM Lecture 45- Hierarchical State Machines(HSMs)\",\"datePublished\":\"2022-02-21T04:05:08+00:00\",\"dateModified\":\"2023-10-12T11:18:40+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/hierarchical-state-machineshsms-hsms\\\/\"},\"wordCount\":1134,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/hierarchical-state-machineshsms-hsms\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/Figure-2-Corporate-Hierarchy.png\",\"keywords\":[\"Finite state Machine(FSM)\"],\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/hierarchical-state-machineshsms-hsms\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/hierarchical-state-machineshsms-hsms\\\/\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/hierarchical-state-machineshsms-hsms\\\/\",\"name\":\"Hierarchical State Machines(HSMs) | Finite State Machine (FSM)\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/hierarchical-state-machineshsms-hsms\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/hierarchical-state-machineshsms-hsms\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/Figure-2-Corporate-Hierarchy.png\",\"datePublished\":\"2022-02-21T04:05:08+00:00\",\"dateModified\":\"2023-10-12T11:18:40+00:00\",\"description\":\"Explore the world of Hierarchical State Machines (HSMs), a powerful solution to manage complex state transitions in embedded systems. HSMs\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/hierarchical-state-machineshsms-hsms\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/hierarchical-state-machineshsms-hsms\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/hierarchical-state-machineshsms-hsms\\\/#primaryimage\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/Figure-2-Corporate-Hierarchy.png\",\"contentUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/Figure-2-Corporate-Hierarchy.png\",\"width\":1109,\"height\":513,\"caption\":\"Figure 2. Corporate Hierarchy\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/hierarchical-state-machineshsms-hsms\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"FSM Lecture 45- Hierarchical State Machines(HSMs)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\",\"name\":\"FastBit EBA\",\"description\":\"Your Online Academy of Embedded Systems\",\"publisher\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\",\"name\":\"FastBit EBA\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/logo-EzNrEnyr.png\",\"contentUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/logo-EzNrEnyr.png\",\"width\":640,\"height\":640,\"caption\":\"FastBit EBA\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/fastbiteba\\\/\",\"https:\\\/\\\/x.com\\\/fastbiteba\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/fastbit-embedded-brain-academy-b3167b124\\\/\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCa1REBV9hyrzGp2mjJCagBg\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/person\\\/e32b38e733a0d76ffa7e6bc998652e5d\",\"name\":\"FastBitLab\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"caption\":\"FastBitLab\"},\"description\":\"The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries.\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Hierarchical State Machines(HSMs) | Finite State Machine (FSM)","description":"Explore the world of Hierarchical State Machines (HSMs), a powerful solution to manage complex state transitions in embedded systems. HSMs","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/fastbitlab.com\/blog\/hierarchical-state-machineshsms-hsms\/","og_locale":"en_US","og_type":"article","og_title":"Hierarchical State Machines(HSMs) | Finite State Machine (FSM)","og_description":"Explore the world of Hierarchical State Machines (HSMs), a powerful solution to manage complex state transitions in embedded systems. HSMs","og_url":"https:\/\/fastbitlab.com\/blog\/hierarchical-state-machineshsms-hsms\/","og_site_name":"FastBit EBA","article_publisher":"https:\/\/www.facebook.com\/fastbiteba\/","article_published_time":"2022-02-21T04:05:08+00:00","article_modified_time":"2023-10-12T11:18:40+00:00","og_image":[{"width":1109,"height":513,"url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-2-Corporate-Hierarchy.png","type":"image\/png"}],"author":"FastBitLab","twitter_card":"summary_large_image","twitter_creator":"@fastbiteba","twitter_site":"@fastbiteba","twitter_misc":{"Written by":"FastBitLab","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fastbitlab.com\/blog\/hierarchical-state-machineshsms-hsms\/#article","isPartOf":{"@id":"https:\/\/fastbitlab.com\/blog\/hierarchical-state-machineshsms-hsms\/"},"author":{"name":"FastBitLab","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/person\/e32b38e733a0d76ffa7e6bc998652e5d"},"headline":"FSM Lecture 45- Hierarchical State Machines(HSMs)","datePublished":"2022-02-21T04:05:08+00:00","dateModified":"2023-10-12T11:18:40+00:00","mainEntityOfPage":{"@id":"https:\/\/fastbitlab.com\/blog\/hierarchical-state-machineshsms-hsms\/"},"wordCount":1134,"commentCount":0,"publisher":{"@id":"https:\/\/fastbitlab.com\/blog\/#organization"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/hierarchical-state-machineshsms-hsms\/#primaryimage"},"thumbnailUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-2-Corporate-Hierarchy.png","keywords":["Finite state Machine(FSM)"],"articleSection":["Blog"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fastbitlab.com\/blog\/hierarchical-state-machineshsms-hsms\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/fastbitlab.com\/blog\/hierarchical-state-machineshsms-hsms\/","url":"https:\/\/fastbitlab.com\/blog\/hierarchical-state-machineshsms-hsms\/","name":"Hierarchical State Machines(HSMs) | Finite State Machine (FSM)","isPartOf":{"@id":"https:\/\/fastbitlab.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/fastbitlab.com\/blog\/hierarchical-state-machineshsms-hsms\/#primaryimage"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/hierarchical-state-machineshsms-hsms\/#primaryimage"},"thumbnailUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-2-Corporate-Hierarchy.png","datePublished":"2022-02-21T04:05:08+00:00","dateModified":"2023-10-12T11:18:40+00:00","description":"Explore the world of Hierarchical State Machines (HSMs), a powerful solution to manage complex state transitions in embedded systems. HSMs","breadcrumb":{"@id":"https:\/\/fastbitlab.com\/blog\/hierarchical-state-machineshsms-hsms\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fastbitlab.com\/blog\/hierarchical-state-machineshsms-hsms\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fastbitlab.com\/blog\/hierarchical-state-machineshsms-hsms\/#primaryimage","url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-2-Corporate-Hierarchy.png","contentUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/02\/Figure-2-Corporate-Hierarchy.png","width":1109,"height":513,"caption":"Figure 2. Corporate Hierarchy"},{"@type":"BreadcrumbList","@id":"https:\/\/fastbitlab.com\/blog\/hierarchical-state-machineshsms-hsms\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/fastbitlab.com\/blog\/"},{"@type":"ListItem","position":2,"name":"FSM Lecture 45- Hierarchical State Machines(HSMs)"}]},{"@type":"WebSite","@id":"https:\/\/fastbitlab.com\/blog\/#website","url":"https:\/\/fastbitlab.com\/blog\/","name":"FastBit EBA","description":"Your Online Academy of Embedded Systems","publisher":{"@id":"https:\/\/fastbitlab.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/fastbitlab.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/fastbitlab.com\/blog\/#organization","name":"FastBit EBA","url":"https:\/\/fastbitlab.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2026\/04\/logo-EzNrEnyr.png","contentUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2026\/04\/logo-EzNrEnyr.png","width":640,"height":640,"caption":"FastBit EBA"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/fastbiteba\/","https:\/\/x.com\/fastbiteba","https:\/\/www.linkedin.com\/in\/fastbit-embedded-brain-academy-b3167b124\/","https:\/\/www.youtube.com\/channel\/UCa1REBV9hyrzGp2mjJCagBg"]},{"@type":"Person","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/person\/e32b38e733a0d76ffa7e6bc998652e5d","name":"FastBitLab","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","caption":"FastBitLab"},"description":"The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries."}]}},"_links":{"self":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/7635","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/comments?post=7635"}],"version-history":[{"count":5,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/7635\/revisions"}],"predecessor-version":[{"id":16123,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/7635\/revisions\/16123"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/media\/7639"}],"wp:attachment":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/media?parent=7635"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/categories?post=7635"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/tags?post=7635"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}