One. Overview
In the previous we introduced the thread synchronization and the way of communication, it is the thread concurrency is better to ensure the security of threads, visibility, order.
In general, it is the ability to minimize the uncontrollable nature of threads and to find a balance between correctness and performance.
Control means a decrease in performance, but we need control to ensure security.
In general, now is the time for us to find the balance point of the thread.
Two. Our expectations
For threads to say. We want to get a high-performance, results-efficient thread running.
But this is not possible. We always have to sacrifice some to do it. But that's not to say that there is nothing we can do about it, we could make a few improvements.
[1] Reducing the granularity of the lock, so there is a high-level lock in the Juc.
[2] No locking, using CAs to complete.
[3] The overall improvement of the concurrency scheme, the proposed thread helper class.
[4] Reduce the cost of thread creation, the emergence of a thread pool framework.
[5] Safe collection reduces synchronization costs
And so on, and so on, all of these things appear in the Juc. There are also callable,future asynchronous concepts such as the emergence of fork/join parallel concept.
With Juc, we can simplify the difficulty of writing concurrent programs, but we need to be aware that concurrency always needs to be treated with care.
020 Threads for Comprehensive consideration