出于多种原因,可变状态和锁容易出问题。
不可变数据是不能更改的,因此读取不可变数据无需用到锁,即使有多个线程读取时也是如此。
Immutable data cannot be changed and thus reading immutable data does not require locks, even when multiple threads are reading.
因此编写构建于可变状态和锁之上、且该状态和锁随系统增长仍然可靠的并发系统很难。
So it is difficult to write concurrent systems built on mutable state and locks that continue to be reliable as a system grows.
应用推荐