T
Tom Gardner
Guest
Eric Wallin wrote:
http://pages.cs.wisc.edu/~remzi/Classes/537/Fall2011/Book/threads-intro.pdf
section 25.3 et al for one exposition of the kinds of problem that arise.
That exposition is in x86 terms but it applies equally to all other 11 major
processor families I've examined over the past 35 years.
If there is a reason your processor cannot experience these issues, let us know.
Subsequent chapters on the solutions can be found
http://pages.cs.wisc.edu/~remzi/Classes/537/Fall2011/
Have a look atOn Monday, June 24, 2013 3:24:44 AM UTC-4, Tom Gardner wrote:
Consider trying to pass a message consisting of one
integer from one thread to another such that the
receiving thread is guaranteed to be able to picks
it up exactly once.
Thread A works on the integer value and when it is done it writes it to location Z. It then reads a value at location X, increments it, and writes it back to location X.
Thread B has been repeatedly reading location X and notices it has been incremented. It reads the integer value at Z, performs some function on it, and writes it back to location Z. It then reads a value at Y, increments it, and writes it back to location Y to let thread A know it took, worked on, and replaced the integer at Z.
The above seems airtight to me if reads and writes to memory are not cached or otherwise delayed, and I don't see how interrupts are germane, but perhaps I haven't taken everything into account.
http://pages.cs.wisc.edu/~remzi/Classes/537/Fall2011/Book/threads-intro.pdf
section 25.3 et al for one exposition of the kinds of problem that arise.
That exposition is in x86 terms but it applies equally to all other 11 major
processor families I've examined over the past 35 years.
If there is a reason your processor cannot experience these issues, let us know.
Subsequent chapters on the solutions can be found
http://pages.cs.wisc.edu/~remzi/Classes/537/Fall2011/