> 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?

could be anywhere within the memory mapped to the kernel memory segment,
why do you bother about the physical address ?

> - will processor caches and memory management have influence for the 
> visibillity of the integer value in the second thread?

not on UP boxes 

> 
> 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
>
for SMP you have to take care of synchronisation or you will run into problems
I would assume that with the setup you described - that is a thread sets a
integer and then wakes up a different thread - you would have an implicid
synchronization, but any other setup will require explicid protection if you
want to be SMP safe.

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

Reply via email to