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 2 of 6 Topic 4064 of 4146
Post > Topic >>

Re: volatile and 2 processor

by Chris Friesen <cbf123@[EMAIL PROTECTED] > Oct 1, 2008 at 12:47 PM

Bruno Causse wrote:
> hi all
> 
> the key word "volatile" have a sence on dual processor?
> 
> (not dual core, real dual processor ex : 2*xeon)

"volatile" has a number of specifically defined behaviours (useful when 
accessing hardware registers, or variables that may have been modified 
in a signal handler, or when playing with setjmp/longjmp).

It's often misused for concurrent programming--just check how many times 
Dave Butenhof has tried to explain to people why it's not suitable for 
lockless algorithms.

If you use regular locks to protect data access, then the "volatile" 
keyword is not necessary because the locks ensure visibility and 
ordering "behind the scenes".

If you use lockless access patterns with appropriate compiler and 
hardware read/write barriers, then the "volatile" keyword is not
necessary.

So basically, outside of the specific areas described above, "volatile" 
is both unnecessary and insufficient.

Chris
 




 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:45:37 CST 2008.