Skip to content

Commit 48a7655

Browse files
authored
Update 07-thread.md
1 parent d719e41 commit 48a7655

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎book/en-us/07-thread.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -330,11 +330,11 @@ int main() {
330330
Multiple threads executing in parallel, discussed at some macro level, can be roughly considered a distributed system.
331331
In a distributed system, any communication or even local operation takes a certain amount of time, and even unreliable communication occurs.
332332
333-
If we force the operation of a variable `v` between multiple threads to be atomic, that is, any thread after the operation of `v`
334-
Other threads can **synchronize** to perceive changes in `v`, for the variable `v`, which appears as a sequential execution of the program, it does not have any efficiency gains due to the introduction of multithreading. Is there any way to accelerate this properly? The answer is to weaken the synchronization conditions between processes in atomic operations.
333+
If we force the operation of a variable `v` between multiple threads to be atomic, that is, in any thread after the operation of `v`,
334+
other threads can **synchronize** to perceive changes in `v`, thus for the variable `v`, the operations appear as a sequential execution of the program. In this case, it does not have any efficiency gains using multithreading. Is there any way to accelerate this properly? The answer is to weaken the synchronization conditions between processes in atomic operations.
335335
336336
In principle, each thread can correspond to a cluster node, and communication between threads is almost equivalent to communication between cluster nodes.
337-
Weakening the synchronization conditions between processes, usually we will consider four different consistency models:
337+
To weaken the synchronization conditions between processes, usually we will consider four different consistency models:
338338
339339
1. Linear consistency: Also known as strong consistency or atomic consistency. It requires that any read operation can read the most recent write of a certain data, and the order of operation of all threads is consistent with the order under the global clock.
340340
@@ -349,7 +349,7 @@ Weakening the synchronization conditions between processes, usually we will cons
349349
350350
In this case, thread `T1`, `T2` is twice atomic to `x`, and `x.store(1)` is strictly before `x.store(2)`. `x.store(2)` strictly occurs before `x.load()`. It is worth mentioning that linear consistency requirements for global clocks are difficult to achieve, which is why people continue to study other consistent algorithms under this weaker consistency.
351351
352-
2. Sequential consistency: It is also required that any read operation can read the last data written by the data, but it is not required to be consistent with the order of the global clock.
352+
2. Sequential consistency: It is also required that any read operation can read the last data written by the data, but it is not required to be consistent with the order of the global clock. The order within each thread is reserved(?).
353353
354354
```
355355
x.store(1) x.store(3) x.load()

0 commit comments

Comments
 (0)