Fourth chapter Parallel Program Optimization
4.1 Parallel Programming patterns
4.2 JDK Multi-task execution framework
4.3 JDK concurrency data structure
4.4 Concurrency control method
4.5 Lock performance and optimization
4.6 Lock-free parallel computing
1. The non-blocking synchronization avoids the defect of lock-based synchronization, and the lock-free algorithm does not have the overhead of lock contention and the overhead of frequent scheduling between threads.
CAS algorithm: consists of 3 parameters CAs (v,e,n). V indicates the variable to be updated, E represents the expected value, and n represents the new value
Under the java.util.concurrent.atomic package of 2.JDK, there is a set of atomic operation classes implemented using the lock-free algorithm, such as Atomicinteger/atomicintegerarray/atomiclongarray,
Multithreading security operations for integers, integer arrays, long shaped arrays, and so on are packaged separately.
4.7 threads
1. A thread is a further division of a process, which can be understood as a further separation of threads. The
is a good implementation of the association in the Lua language. The
2.Java native language does not support covariance, and Kilim is a popular co-process framework. The
use of the coprocessor allows the system to support a higher degree of parallelism at a lower cost.