|
|
|
|
|
by dkersten
5645 days ago
|
|
I'm not quite sure what you mean, but synchronization without atomic operations is possible. An example of mutual exclusion, without any atomic operations, taken from the book "The art of multiprocessor programming"[1] is (paraphrased) as follows: Two threads, A and B, want to access some memory. Each thread has a flag. When thread A wants to access the shared memory: Set flag A
Wait for flag B to become unset
Access memory
Unset flag A
When thread B wants to access the shared memory: Set flag B
While flag A is set {
Unset flag B
Wait for flag A to become unset
Set flag B
}
Access memory
Unset flag B
Obviously this isn't a general purpose solution, but rather an easy to understand example demonstrating that atomic operations are not required.[1] http://www.amazon.com/Art-Multiprocessor-Programming-Maurice... |
|