Overview of Java multithreading and concurrency

Multithreading and concurrent Java in Java- is one of the earliest languages ​​that allows developers to use multithreading. Java has multi-threading capabilities from the beginning. Therefore, Java developers often encounter the above problems. This is why I wrote this thread on Java Concurrency. I would like to remind myself and other Java developers who might benefit from it.

This tutorial focuses on multithreading in Java, but some problems that occur in multithreading are similar to those that occur in multitasking and distributed systems. Therefore, references to multitasking and distributed systems may also appear in this thread. Therefore, the word "concurrent" instead of "multithreaded".

Concurrency model

The first Java concurrency model assumes that multiple threads executing in the same application will also share objects. This type of concurrency model is often referred to as a "shared state concurrency model." Many concurrent language constructs and utilities are designed to support this concurrency model.

However, since the first Java concurrency book was written, and even since the release of the Java 5 concurrency utility, many things have happened in the area of ​​concurrent architecture and design.

The shared state concurrency model causes many concurrency problems, which are difficult to solve gracefully. Therefore, alternative concurrency models known as "no sharing" or "separated state" have become popular. In a separate state concurrency model, threads do not share any objects or data. This avoids many concurrent access problems of the shared state concurrency model.

New asynchronous "independent state" platforms and toolkits have emerged, such as Netty, Vert.x and Play / Akka and Qbit. New non-blocking concurrency algorithms have been released, and new non-blocking tools (such as LMax Disrupter) have been added to our toolbox. The Fork and Join framework in Java 7 and the collection stream API in Java 8 introduce new functional programming parallelism.

from: https://dev.to//sonali_g_/java-multithreading-concurrency-overview-59eb

Published 0 original articles · liked 0 · visits 402

Guess you like

Origin blog.csdn.net/cunxiedian8614/article/details/105690156