LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What is RTUseMutexOptimization in ni-rt.ini ?

Solved!
Go to solution

Hi there,

 

does anybody know what RTUseMutexOptimization in the ni-rt. ini describes?

I have two different pxi-realtime-systems (LabVIEW 2009 SP1), one with RTUseMutexOptimization=TRUE, the other doesn't have this entry in the ni-rt.ini.

 

 

Thanks in advance,

 

gibbi

0 Kudos
Message 1 of 4
(2,906 Views)

Hi Gibbi,

 

RTUseMutexOptimization refers to the "mutual exclusion algorithm" which stands for:

 

short: A mutex ("mutual exclusion") is a mechanism to ensure integrity when the same data or resource is accessed (in particular, changed) concurrently from several threads. Usually when the term mutex is used, it refers to a synchronisation primitive functionally identical to a binary semaphore.

 

Long: (copyright by Wikipedia)  http://en.wikipedia.org/wiki/Mutual_exclusion

Mutual exclusion (often abbreviated to mutex) algorithms are used in concurrent programming to avoid the simultaneous use of a common resource, such as a global variable, by pieces of computer code called critical sections. A critical section is a piece of code in which a process or thread accesses a common resource. The critical section by itself is not a mechanism or algorithm for mutual exclusion. A program, process, or thread can have the critical section in it without any mechanism or algorithm which implements mutual exclusion.

Examples of such resources are fine-grained flags, counters or queues, used to communicate between code that runs concurrently, such as an application and its interrupt handlers. The synchronization of access to those resources is an acute problem because a thread can be stopped or started at any time.

To illustrate: suppose a section of code is altering a piece of data over several program steps, when another thread, perhaps triggered by some unpredictable event, starts executing. If this second thread reads from the same piece of data, the data, which is in the process of being overwritten, is in an inconsistent and unpredictable state. If the second thread tries overwriting that data, the ensuing state will probably be unrecoverable. These shared data being accessed by critical sections of code must, therefore, be protected, so that other processes which read from or write to the chunk of data are excluded from running.

 

I hope this helps you to understand the entry in the ni-rt.ini-file


Regards

Chris

0 Kudos
Message 2 of 4
(2,898 Views)

Hi Chris,

 

thank you very much for your answer.

I understand your descriptions, because I am familar with mutual exclusions (but it's good to read it again Smiley Wink ).

Interesting for me is, why has one controller this option and the other not? What happens if I disable the optimization? Will my code be slower, can it cause deadlocks and so on?

And what is the default value of this flag, if it is not in the ini-file?

 

Regards

 

Gibbi

0 Kudos
Message 3 of 4
(2,886 Views)
Solution
Accepted by Gibbi

Hi,

 

This ini token is internal only. Please don't change or delete it.

 

 

Thanks,

Christian

0 Kudos
Message 4 of 4
(2,882 Views)