Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Programming Threads > Re: volatile an...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 6 Topic 4064 of 4146
Post > Topic >>

Re: volatile and 2 processor

by "Chris M. Thomasson" <no@[EMAIL PROTECTED] > Oct 2, 2008 at 12:47 AM

"Bruno Causse" <PasDeSpam@[EMAIL PROTECTED]
> wrote in message 
news:1io5eh9.bb6e4j1dw9gzaN%PasDeSpam@[EMAIL PROTECTED]
> hi all
>
> the key word "volatile" have a sence on dual processor?
>
> (not dual core, real dual processor ex : 2*xeon)

In what sense are you referring to? Sometimes you need volatile for 
"certain" things in multi-threaded applications; for instance, the
following 
loop:


static atomicword g_running = 1;

while (g_running) {
}


might never terminate if `g_running' was not declared as volatile...



Now, whether or not volatile has anything to do with memory visibility is 
totally implementation defined. Example: A Microsoft compiler for Itanic 
gives volatile "special" meaning. Namely, all stores to a volatile
variable 
have preceding (#LoadStore | #StoreStore) membar, and all loads from them 
have subsequent (#LoadStore | #LoadLoad) membar. This gives a
store-release, 
load-acquire relation****p between loads and stores. But, I don't think
that 
MSVC for PowerPC gives any special meaning to volatile; I am not sure. I 
would need to RTFM.


Volatile on say, SUN's C compiler, has nothing to do with volatile on, 
AFAICT, any arch it sup****ts. You need to read your compilers
do***entation 
VERY, VERY carefully regarding how it treats volatile in a multi-threaded 
environment!

:^o
 




 6 Posts in Topic:
volatile and 2 processor
PasDeSpam@[EMAIL PROTECTE  2008-10-01 20:07:35 
Re: volatile and 2 processor
Chris Friesen <cbf123@  2008-10-01 12:47:20 
Re: volatile and 2 processor
David Schwartz <davids  2008-10-01 22:40:13 
Re: volatile and 2 processor
"Chris M. Thomasson&  2008-10-02 00:47:55 
Re: volatile and 2 processor
Chris Friesen <cbf123@  2008-10-02 09:56:53 
Re: volatile and 2 processor
"Chris M. Thomasson&  2008-10-02 09:12:06 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Nov 22 9:40:00 CST 2008.