Hi RTL-Folks,

Does somebody have some answers for the following question?

You have two RTL threads and a global integer variable which is initial 
set to zero.

Thread one will change the global integer variable without the use of 
any synchronisation mechanism to a new value. After that, thread one 
will wakeup thread two and suspend himself.

Now the question:

What value will thread two see in the global integer variable after the
wakeup - zero or the new value set by thread one?

- Where is the integer value physically stored?
- will processor caches and memory management have influence for the 
visibillity of the integer value in the second thread?

With other words can i assume that the change of an integer variable is
an atomic instruction, or is it necessary to use a mutex for write and
read operations off integers to be shure that global interger data is
recent in all threads?

What about the use of memory barriers in RTL-Threads?

In the moment i use a single processor Athlon XP 2GHz, but i like to 
keep code portable to other processors and multiprocessor environments

sorry for cunfusing you,

Thomas Sauter

_______________________________________________
Rtl mailing list
[EMAIL PROTECTED]
http://www2.fsmlabs.com/mailman/listinfo.cgi/rtl

Reply via email to