Jump to content
News about the LabVIEW Wiki! Read more... ×
Daklu

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

Share this post


Link to post
Share on other sites
20 hours ago, shoneill said:

Separate out the external Queue from the internal one.

You're a bit late for this conversation, though the topic is still very relevant today.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

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