Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6180835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:54:57+00:00 2026-05-24T00:54:57+00:00

How do I take this diagram and translate it into a useable program. I’m

  • 0

FMS

How do I take this diagram and translate it into a useable program.

I’m not really sure how to read this diagram.

Walk me through it, maybe show an example of code and how it relates to the diagram.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T00:54:58+00:00Added an answer on May 24, 2026 at 12:54 am

    Circles with text inside are the states. Text describes what the state is.

    Dashed arrow points to starting state.

    Outgoing arrows determine where this state could change. Beside of the arrow is the text divided by the line into upper part and lower part. Lower part is actions that should take place when arrow transition is executed. Upper part is conditions. When they are true – this transition is executed (and so lower part).

    Lambda symbol means you should do nothing except changing current state when transition takes place.

    So lower parts have coarse corresponding to your functions. And upper parts are the points where you should wait for conditions – polling or async waiting for pending I/O packets, whatever.

    Here is some pseudo-code similar to C (I’ve written it just here so do not assume it works or even compiles):

    enum State { WaitFor0Call, WaitForAck0, WaitForCall1, WaitForAck1 }
    
    int main() {
       State state = WaitFor0Call;
       while (1) {
          switch (state) {
             case WaitFor0Call:
                if (rdt_rcv(rcvpkt)) continue;
                if (rdt_send(data)) {
                   state = WaitForAck0;
                   sndpkt = make_pkt(0, data, checksum);
                   udt_send(sndpkt);
                   start_timer();
                }
                break;
             case WaitForAck0:
                // ...similar code...
                break;
             case WaitForCall1:
                // ...similar code...
                break;
             case WaitForAck1:
                // ...similar code...
                break;
          }
       }
    }
    

    You should also take into account that receive and send functions could be blocking, so code if (rdt_rcv(rcvpkt)) whatever; is technically incorrect as you don’t check for rdt_send until it returns control. So FSM communicates only logical flow, not technical aspects of how it should be organized, thread management etc. And my code doesn’t show this aspects also because it could be decently complicated depending on your needs and because you didn’t give enough details to make informed advices on these sort of things 🙂

    My only guess is that you would have some sort of bi-directed stream (for input and output respectively) and conditions would be like if (there_is_ready_for_consuming_packet_in_the_input_queue) continue; and if (data_was_put_to_outgoing_stream_successfully) ...;

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.