<p>I am having a hard time understanding the SC memory model properly.
The sentence "the result of any execution is the same as if the operations of all the processors were executed in some sequential order, and the operations of each individual processor appear in this sequence in the order specified by its program." is very ambiguous for me. </p>

<p>Does: 
"having the operations in each processor appear in the sequence specified by the program" mean that all memory operations are updated system wide exactly after being run? Or can they reside in the cache, not known to the processors by the new value for a while.</p>

<p>Does the sentence also infer that no matter what sequential order i decide to order my commands between the threads (not order differently the commands in each individual thread), I will always get the same read's for all of my writes?</p>

<p>Lets take for example this:</p>

<pre><code>X=Y=0
Thread 0         Thread 1           Thread 2
X=1              EAX=X              Y=1
                 EBX=Y              ECX = X

Output: 
Thread 1: EAX=1
Thread 1: EBX=0
Thread 2: ECX=0
</code></pre>

<p>It is easily seen that Y=1 MUST be before EBX=Y, because otherwise, EAX cannot be 1 if ECX is 0 or vice versa. But is this still SC? because even though Y=1 was issued before EBX=Y, it could of updated all the threads only after EBX polled Y.</p>

CC BY-SA 3.0
2012-12-22T17:17:24.213Z
You could look at Lamport's [How to make a multiprocessor computer that correctly executes multiprocess programs](http://research.microsoft.com/en-us/um/people/lamport/pubs/lamport-how-to-make.pdf) or at Luchangco's [dissertation](http://theory.csail.mit.edu/ftp-data/pub/people/victor_l/Thesis.pdf) which develops a general framework for memory models and around Page 81 specialises it to sequential consistency.
Martin Berger
CC BY-SA 3.0
2012-12-25T10:53:02.807Z
@Yarneo As for your example, it is _impossible_ to schedule the instructions to get the output as you given, still satisfying the Sequential consistency. For a unified theory of memory models, you can check [Unified Theory of Shared Memory Consistency](http://dl.acm.org/citation.cfm?id=1017460.1017464). With the _formal_ definition, you can verify whether an execution (including an output) satisfies a specific memory model systematically.
hengxin
<dc.parallel-comp><concurrency>
Sequential Consistency, cannot find a sufficient explanation
Yarneo
# Sequential Consistency, cannot find a sufficient explanation

(Asked by: username_0 on 2012-12-21)

I am having a hard time understanding the SC memory model properly.
The sentence "the result of any execution is the same as if the operations of all the processors were executed in some sequential order, and the operations of each individual processor appear in this sequence in the order specified by its program." is very ambiguous for me. 
Does: 
"having the operations in each processor appear in the sequence specified by the program" mean that all memory operations are updated system wide exactly after being run? Or can they reside in the cache, not known to the processors by the new value for a while.
Does the sentence also infer that no matter what sequential order i decide to order my commands between the threads (not order differently the commands in each individual thread), I will always get the same read's for all of my writes?
Lets take for example this:
X=Y=0
Thread 0         Thread 1           Thread 2
X=1              EAX=X              Y=1
                 EBX=Y              ECX = X

Output: 
Thread 1: EAX=1
Thread 1: EBX=0
Thread 2: ECX=0

It is easily seen that Y=1 MUST be before EBX=Y, because otherwise, EAX cannot be 1 if ECX is 0 or vice versa. But is this still SC? because even though Y=1 was issued before EBX=Y, it could of updated all the threads only after EBX polled Y.

**Tags:** dc.parallel-comp, concurrency

> **Comments:**
> **username_1**: You could look at Lamport's [How to make a multiprocessor computer that correctly executes multiprocess programs](http://research.microsoft.com/en-us/um/people/lamport/pubs/lamport-how-to-make.pdf) or at Luchangco's [dissertation](http://theory.csail.mit.edu/ftp-data/pub/people/victor_l/Thesis.pdf) which develops a general framework for memory models and around Page 81 specialises it to sequential consistency.  
> **username_2**: @username_0 As for your example, it is _impossible_ to schedule the instructions to get the output as you given, still satisfying the Sequential consistency. For a unified theory of memory models, you can check [Unified Theory of Shared Memory Consistency](http://dl.acm.org/citation.cfm?id=1017460.1017464). With the _formal_ definition, you can verify whether an execution (including an output) satisfies a specific memory model systematically.  

---

## 0 answers

