LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array, indexis and concurrency

Hello NI Forum.

 

I need an help for a "could be" problem during the developping of an application. If i use an array, with fixed dimension, which share data between parallel tasks where each task always write in a certain, fixed, index could bring in concurrency problem? For example: task 1 always write in index 1 and task 2 always write in index 2, if the two task write in the same time at the respective index what could happen? Two or more task that use the same resource (array) at the same time but at different index (different memory location) could bring to concurrency problem?

 

Thank you in advance

.

0 Kudos
Message 1 of 9
(5,381 Views)

How do you write data into the array parallely? Are you using a Global variable?

-----

The best solution is the one you find it by yourself
0 Kudos
Message 2 of 9
(5,378 Views)

No, it's a local variable. But i think that i'll go for the safety road and use a semaphore....

0 Kudos
Message 3 of 9
(5,372 Views)

You should also look at Data Value Reference which is a newer addition to LabVIEW then a semaphore which locks out other loops from writing to the data reference while another is working with it.

 

You should also look at Functional Global Variables where the array is stored in a non-reentrant subVI and that prevents an array from being updated at multiple locations simultaneously.

0 Kudos
Message 4 of 9
(5,361 Views)

In this case, I would go with the Action Engine.  I have found they are faster than the DVR.

 

And now for a shameless plug since it applies here: A Look At Race Conditions


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 9
(5,355 Views)

I did'nt know the action engine. Sound really interesting, can you please give me some link to learn more about it?

 

Thank you,

 

Francesco.

0 Kudos
Message 6 of 9
(5,290 Views)

I can give you, its right here

-----

The best solution is the one you find it by yourself
Message 7 of 9
(5,287 Views)

Search is your friend Smiley Wink

 

Community Nugget 4/08/2007 Action Engines

----------------------------------------------------------------------------------------------------------------
Founding (and only) member of AUITA - the Anti UI Thread Association.
----------------------------------------------------------------------------------------------------------------
Message 8 of 9
(5,285 Views)

Thank you all guys!!

0 Kudos
Message 9 of 9
(5,278 Views)