并发中状态的处理

We can’t avoid dealing with state, but we have three options:
• Shared mutability
• Isolated mutability
• Pure immutability
Though we’re used to shared mutability, we should avoid it as much as
possible. Eliminating shared mutable state is the easiest way to avoid synchronization
woes. It takes us far more effort to pick these design approaches
than to pick up a library or an API. It also requires us to step back and
think through how we’d design applications.
We don’t want to compromise performance in order to preserve state. So,
to design with immutability, we’ll need to use modern data structures that
preserve state and at the same time provide great performance.
posted @ 2012-02-21 11:21  Colin_Ye  阅读(220)  评论(0编辑  收藏  举报