Jump to content

How do you model this?


Recommended Posts

On 12/15/2009 at 5:35 PM, Daklu said:

I discovered a case of 'QSM parallism.' What I mean by this is that a state queues up more states with the expectation that they will be executed immediately, but the queue still had states on it that it needed to execute to complete a previous process. That essentially (unintentionally) splits the execution into two separate paths that are interleaved on the queue, which of course leads to unpredictable behavior. The odd thing is the software seems to be working okay. I suspect dark magic is at work but I loaned out my copy of "Software Exorcism for Dummies" and haven't got it back yet.

Separate out the external Queue from the internal one.  If the internal queue has elements in it, ignore the external queue.  Only read an element from the external queue when the internal is empty.

You can extend this to N layers by maintaining a stack of queues, where element zero is the external queue (should never be destroyed).  All internal states which enque further states do so on a newly-created internal queue and pushes all other queues down the stack.  This way you get deterministic execution of your states.  Guaranteed execution order without interruption and a way of investigating the execution flow (depth of stack and so on). Of course when an internal Queue is empty, it is destroyed and the top-most queue is retrieved from the stack.

I keep coming back to the definition of a "Pushdown Automaton" even though it really does not fit, but it helps me to visualise what's going on.  Imagine that the input tape and the stack are the same thing.  Each input tape is an element of the stack.  Pushing and popping input tapes allows you to essentially create subroutines.

Edited by shoneill
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.