- 论坛徽章:
- 2
|
原帖由 isjfk 于 2006-8-11 16:21 发表
我也是差不多的意思。如果 b = i 是原子的,那 b = i 之后显然 b 和 i 是一样的,但是对于 b = i 的下一条语句来说,b 未必就等于 i,因为两条语句中间可能会发生中断。
既然对于下一条语句来说,b 是不是等 ...
An atomic operation in computer science refers to a set of operations that can be combined so that they appear to the rest of the system to be a single operation.
Conditions
To accomplish this, two conditions must be met:
1. Until the entire set of operations completes, no other process can know about the changes being made; and
2. If any of the operations fail then the entire set of operations fails, and the state of the system is restored to the state it was in before any of the operations began.
To the rest of the system, it appears that the set of operations either succeeds or fails all at once. No in-between state is accessible. This is an atomic operation.
from http://en.wikipedia.org/wiki/Atomic_operation
你管它下一条做什么??
>>>be a single operation
原子性对应的是一个操作,而不是两个操作。
>>>No in-between state is accessible
是否@23时的情况就是在中途窃取了 i 的值? |
|