From 11:00 PM CST Friday, Feb 14th - 6:30 PM CST Saturday, Feb 15th, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From 11:00 PM CST Friday, Feb 14th - 6:30 PM CST Saturday, Feb 15th, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
02-13-2013 02:06 PM
Hi,
I need to simultaneously run 2 sequence files. I have selected the option "Run Sequence in a New Execution". The two sequences runs fine most of the time. But since the steps in those two sequence files access the same Step Types (i.e. code module), occasionally when they both try to access the same Step Type simultaneously, that particular step will fail.
Is there a way to have the step from sequence_file_A to halt a particular step execution until sequence _file_B finish executing its step, and vice-versa (i.e. sequence_B finish step execution and let's sequence_A know)
Thanks a lot!
ph2
02-13-2013 03:19 PM
If I understand correctly, you can do the following. On each of the two steps, go to Properties>>Synchronization and set the Use Lock... checkbox.
In the Lock Name.. field, put the same name.
Remember to put the name in quotes because the field is an expression.
02-14-2013 09:42 AM
Hi James,
Thanks for the reply.
In my Main sequence file, I have over 200 steps. In the sequence file which runs concurrently with the Main sequence file, it has 8 steps.
So I need to check the Use Lock for each of the 200 steps in Main Sequence file, as well as the sequence file that runs concurrently? Which means I need to do it 208 times?
Also, I'm not sure what and how this works below:
"In the Lock Name.. field, put the same name.
Remember to put the name in quotes because the field is an expression"
Thanks again.
ph
02-14-2013 11:10 AM
The step types that ship with teststand do not require any special locking to be used concurrently from multiple threads at once. I recommend you similarly make any step types you write also be threadsafe. To make them threadsafe you either have to not use any global, shared data, or you have to use critical sections while accessing such shared data.
I think it's best if you determine why you are getting errors and address that, rather than blindly adding locks to everything.
Hope this helps,
-Doug
02-15-2013 10:45 AM
Dug,
Thanks for the reply. I am quite sure it's the multiple threads causing the problem. The part of script using just a single thread has no problems, but as soon the launching another sequence with second thread running concurrently, the problem occurs.
Unfortunately, both threads need to use the same step types and accessing the same database. There's no way around that.
Regards,
ph
02-15-2013 03:23 PM - edited 02-15-2013 03:23 PM
What I meant was that rather than assume every step has a threading problem, try to determine which sections of the sequence can't really be run in parallel and put a lock around those, rather than locking on every step. You can lock around multiple steps using the Lock step type.
Also, this might have nothing to do with the step type directly, but rather with what the step type is doing or the code module it is calling is doing.
-Doug
03-14-2013 02:34 PM
Hi,
Thanks for all the help.
I've been experimenting with Locks by locking the same step type in both sequence files that run in parallel. I checked the box in synchronization tab but left the Lock Name(reference expression) field empty. In the properties window, it mentions ..leave blank to use a lock unique to the steps.
By doing this, my multithread scripts no longer crashes the Window XP. However, my test results are inaccurate now. I think the reason is the step type in one sequence file are not waiting for the step type in another sequence? If it sense it's been locked( by another sequence file) it will just skip to next step?
I want all the step types to execute but how can I make it to wait for the other step to unlock.
Thanks again.
ph
03-15-2013 06:39 PM
Is there any reason why you are using a lock instead of a semaphore and using rendezvous points? There is a good example for this in the synchronization folder for TestStand examples.
03-18-2013 10:01 AM
Lanidas,
I thought rendezvous is used for sychroization between the sequences(i.e dependent on Sequence to finish, etc). In my case, my main sequence can run independent from Sequence_B( no dependencies). All sequence_B does is just continuously resets an alarm, while the main sequence executes the regular tests.
But to reset the alarm, Sequence_B uses the same steps that will occur in the main sequence.
Thanks,
ph
03-19-2013 10:00 AM - edited 03-19-2013 10:02 AM
@ph2 wrote:
Hi,
Thanks for all the help.
I've been experimenting with Locks by locking the same step type in both sequence files that run in parallel. I checked the box in synchronization tab but left the Lock Name(reference expression) field empty. In the properties window, it mentions ..leave blank to use a lock unique to the steps.
By doing this, my multithread scripts no longer crashes the Window XP. However, my test results are inaccurate now. I think the reason is the step type in one sequence file are not waiting for the step type in another sequence? If it sense it's been locked( by another sequence file) it will just skip to next step?
I want all the step types to execute but how can I make it to wait for the other step to unlock.
Thanks again.
ph
Use a name for the lock and make it the same name everywhere if you want to make it so that only one thread at a time can execute any of the steps which use the lock. You can also hold the lock around multiple steps by using the Lock step type.
-Doug