On Wed, Feb 16, 2000 at 10:57:16AM +0800, dyd wrote:
> hi,
> 
> although mb() in fact is a function in linux, there are many uses in RTLinux.
> So I wish such question is not too tangent.
> 
> I want to know why it look like a empty function, what does it is used for?

Mb is about to get its first real RT use in PPC RTLinux. The theory with mb()
is that it provides a "memory barrier" so that 
/* assume shared_memory=0 and shared_memory2 = 0 */
                 shared_memory = 1;
                 mb();
                 shared_memory2 = 1;
will mean that another processor  will see shared_memory==1 _before_ it sees
shared_memory_2==1. Modern processors may queue writes locally so that the local
CPU sees changes but other CPUs do no. Even worse, writing A,B,C in that order
does not always mean that A,B,C will be written to memory in that order. Intel
has very strong memory ordering, but other processors do not, and probably Intel
will not in the merced and other advanced processors.
So mb means: flush all writes out to memory and wait until that is done. 

                  
> 
> regards
> du
> -- [rtl] ---
> To unsubscribe:
> echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
> echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
> ---
> For more information on Real-Time Linux see:
> http://www.rtlinux.org/~rtlinux/

-- 
---------------------------------------------------------
Victor Yodaiken 
FSMLabs:  www.fsmlabs.com  www.rtlinux.com
FSMLabs is a servicemark and a service of 
VJY Associates L.L.C, New Mexico.

-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
---
For more information on Real-Time Linux see:
http://www.rtlinux.org/~rtlinux/

Reply via email to