preface
Brothers and sisters, it’s a new week and I’m very happy to have over 400 readers today. Let’s see if we can break 1000 readers this year. Without further ado, let’s start today’s content.
Recently read several books and arts of concurrent Java programming, the concurrent Java programming of actual combat, feeling learned a lot of things, but at the same time in brain, it is difficult to put these knowledge together, I believe that many students are the same feeling, specific wisp of a wisp of thinking today, come up with a mind map, for everybody to learn to communicate thinking. Also recommend big guy’s series of blogs, links. After reading these blogs, I believe it will be very rewarding to read the books above.
Mind mapping
It is customary to put out a mind map of your own writing. In fact, it is recommended that you draw one of your own so that you can connect the dots.Let’s start with the usual interview question, what is a thread? How do threads communicate with each other? What happens when a queue in a thread pool slows down? Ah, why double check? And so we found that feeling knowledge points are clueless, in fact, are connected. Let’s look at the mind map above.
- Thread based
Well, that’s the basic understanding of threads. The Java API for Thread. For shared variables, we can use volatile; for message notifications, we can use wait() and notify() with Object; and of course, we can use JUC and send packets.
- JMM
To get a deeper understanding of Java multithreaded programming, I thought I’d start with a deeper understanding of the JMM, or Java memory model. We can string this together using the i++ example, or the singleton pattern in the design pattern.
- JUC
Since JDK1.5, Java has provided a number of utility classes for multithreaded development, including common thread pools, atomic classes, and more.
- The lock
To talk about locking, let’s start with the oldest Java keyword, synchronized. How is the underlying principle implemented? Is it implemented using JVM low-level instructions? How is that different from JUC and packet Lock? That goes back to JUC and the use of sending packets.
At the same time, there are all kinds of locks, the read-write lock, the fair lock, the pessimistic lock.
- Projects using
With all this stuff mentioned above, and the underlying JVM as well, how can we use it in real projects? How does SpringBoot work with thread pools? How to start multithreading? Here are some articles I wrote
Next, update the blog slowly with the mind map above. Welcome to discuss!
The resources
Books: “The Art of Java Concurrent Programming”, “Java Concurrent Programming In Action”
Blog: The Big Guy Multi-threaded series of articles on the use of inter-thread communication