You will know why interviewers like to ask such questions!

You will know why interviewers like to ask such questions! One day, Zhang San went to an interview and was asked a question by the interviewer: What is multithreading? Zhang San: multithreading means that multiple threads execute on the CPU, seize CPU resources and improve CPU execution efficiency Interviewer: what are you talking about? W ...

Posted by Xianoth on Tue, 28 Dec 2021 02:01:04 +0100

Interesting talk on IllegalMonitorStateException -- the usage of notify()/notifyAll() and wait()

Most of them are generated in the use of wait() and notify()? The reason for the error is: synchronized(A) and B.wait(),A and B should be the same object. If you search this and report an error, I think your foundation should not be very good. So keep looking. So this article talks about how to correctly use notify()/notifyAll() and wait(). ...

Posted by cmp241 on Mon, 27 Dec 2021 15:29:00 +0100

JUC high concurrency programming: CAS, 6 locks

CAS summary The full name of CAS is compare and swap, which is a CPU concurrency primitive, Compare whether the working memory value (expected value) and the shared value of the main physical memory are the same. If they are the same, perform the specified operation. Otherwise, continue the comparison until the values of the main memory and ...

Posted by dlcmpls on Sun, 26 Dec 2021 22:09:55 +0100

Java Concurrent Programming - CopyOnWriteArrayList

1 Overview The JUC concurrency package only provides one concurrency list, CopyOnWriteList, which is thread safe (there is an exclusive lock ReetrantLock inside) and adopts the write time replication strategy. The overall class diagram structure is shown in the following figure. The following describes this class in detail from the constr ...

Posted by Fira on Thu, 23 Dec 2021 21:17:15 +0100

java Concurrent Programming

Introduction to concurrent programming java is a development language that supports multithreading. Multithreading can process multiple different tasks simultaneously on a machine containing multiple CPU cores, optimize the utilization of resources and improve the efficiency of programs. In some occasions with high performance requirements, mu ...

Posted by alexdoug on Thu, 23 Dec 2021 20:13:52 +0100

java Concurrent Programming - thread pool parsing

The previous article described how to create a thread. This is relatively simple. There will be a problem. If more threads are created, the efficiency of the system will be greatly reduced, because it takes time to create and destroy threads frequently So how to reuse existing threads? That is to achieve this effect through thread pool! First ...

Posted by lopes_andre on Thu, 23 Dec 2021 16:52:42 +0100

Is notify() really a random wake-up?

Wake up mechanism of notify() preface As everyone who has learned java knows, when learning concurrent multithreading, we have a notify() method. At that time, when the blogger was learning, he said that notify() randomly wakes up a waiting thread and obtains a lock. I believe many small partners are the same as bloggers, but is this re ...

Posted by bpgillett on Tue, 21 Dec 2021 14:19:19 +0100

Golang high concurrency: producer consumer model

Golang high concurrency: producer consumer model In this blog post, we mainly introduce the producer consumer model through several examples. Case 1 Let's look at the producer process in the first example. //Producer collaboration go func() { for { product := strconv.Itoa(time.Now().Nanosecond()) chanShop <- "commodity" + produ ...

Posted by yellowzm on Sun, 19 Dec 2021 09:38:49 +0100

JAVA concurrency V (JAVA sharing model I)

The java concurrency explained in the previous articles mainly focuses on ensuring the atomicity of the code in the critical area when accessing shared variables. In this chapter, we further study the visibility of shared variables among multiple threads and the ordering of multiple instructions 1. JAVA Memory Model (JMM) JMM is the Java Memo ...

Posted by Mhz2020 on Tue, 14 Dec 2021 07:59:50 +0100

Java Concurrent Programming

Concurrency / high concurrency tomcat default 150 concurrent connection (socket) RT: corresponding time QPS: throughput Hardware cpu, memory, disk, network Software Maximize the use of hardware resources Number of threads, JVM memory size, network communication mechanism (BIO, NIO, AIO), disk IO How to increase the number of concu ...

Posted by scliburn on Sat, 11 Dec 2021 02:08:38 +0100