3
votes
Vote UpVote

Understanding Threads: Atomic Operations and Memory Ordering

The Programming Works – A common question about threads is: “I need a read/write access to a variable from two or more threads. Should I protect an access to a variable by critical section?” A simple answer is: yes, if you want to be on the safe side always protect the variable by a critical section. A deeper answer requires an understanding of the two concepts: atomic operations and memory ordering. The “atomic” means that the result of the operation is always predictable. Suppose we have two threads: thread A writes to a variable one of the two possible values (0 or 1); thread B reads the variable. If both writes ...
Favorite? Off-Topic? Serg @ 2010-08-28 08:09

Statistics

Visits: 919
Votes: 3
Favorites: 0
Off-Topic: 0

Visits by Source

User Actions

Users who voted for this posting

ket555
Rob McDonell
vcldeveloper
Subscribe:
Contact us to advertise on DelphiFeeds.com

Community Links

Torry Firebird News

Sponsor

 
Please login or register to use this functionality.
(click on this box to dismiss)