Disclaima: This article is about interviews for back-end Java development positions

The theme

To interview season again, from the curriculum group, see many students share their interview questions, I also take time to search on the Internet some of the many companies use the interview question, the school and social move the interview questions are concentrated on a few basic direction, mainly: Java base, concurrent, JVM, algorithms, database, some frameworks, distributed cluster, etc. Here, I would like to express my personal opinion on the preparation and learning of concurrent questions in the interview.

The status quo

As for the learning and understanding of concurrency, through communication with many students and feedback from everyone in the course group, I can summarize the following aspects:

  1. Completely unaware of the existence of concurrency
  2. Know concurrency to learn, but don’t know what to learn
  3. Knowing the importance of concurrency, I bought related books to learn, but still muddled after reading them
  4. Know concurrency is important, oneself looked up data to learn a few, a lot of learned, but always can discover won’t, don’t know what concurrency should learn after all
  5. Have completed the advanced, concurrent problems are well known, such students are very few

First of all, why do Java interviews test concurrency, and concurrency related questions are so high. If you are familiar with concurrency, you probably know that concurrency is always involved in Java projects. Some students say that they have never touched concurrency, but they are just not aware of it. When you define an interface that can be called, it becomes a matter of concurrency, because any one interface can be called multiple times at the same time. By the time you’ve become comfortable with the basic Java keywords synchronized, volatile, static, and final in your projects, you’ve already developed some familiarity with concurrency. Part of what they say about the interview building rocket and the onboarding turning screw is that you don’t realize that the interview test is part of your daily development.

I am out of my depth to list the keywords, classes, and knowledge points involved in concurrency: CPU caching, Java memory model JMM, Atomic, AtomicInteger, AtomicLong, LongAdder, AtomicReference, AtomicBoolean, CAS Principle, Unsafe, Synchronized, Vola Tile, Final, static, ThreadLocal, AQS, J.U.C, CountDownLatch, Semaphore, CyclicBarrier, ReentrantLock, ReentrantReadWriteLock, Stam PLock, Condition, FutureTask, Fork/Join, BlockingQueue, ThreadPoolExecutor, ExecutorService, Thread, Runnable, Future, Callable, Ha ShMap, HashTable, ConcurrentHashMap, CopyOnWriteArrayList, CopyOnWriteArraySet, RateLimiter, SimpleDateFormat, StringBuffer, StringBui Lder, ArrayList, Vector, HashSet, ConcurrentSkipListSet, Collections. SynchronizedXXX, Guava, Cache, Redis… I tried to write out the concurrent classes and nouns in my head, and I found it impossible to write! No! Finished! Yes, there is too much knowledge about concurrency to give a complete overview.

Therefore, if you blindly learn one knowledge point by one, you will find that you can never finish learning, and it is difficult to form a complete knowledge system in your mind. The most direct result is that you have to go over the concurrent related information every time you go to an interview, for fear of being asked about the information you haven’t yet contacted. What you need to do is to have a complete system of concurrent knowledge in mind, and then refine the details of each module of that system.

concurrent

Learning about concurrency can start with the core of the java.util.concurrent package (J.U.C), which many other classes and packages extend or complement.


The J.U.C core consists of five large blocks: the Atomic package, the LOCKS package, the Collections package, the Tools package (AQS), and the Executor package (thread pools). Many of the concurrency classes you encounter can be found here. However, to master concurrency, you can’t just open up the J.U.C. package and go through each class. There are only five chunks, representing the five directions of the core. To systematically learn concurrency, you also need to learn concurrency from a concurrency perspective, covering J.U.C. ‘s knowledge in the process. Here I’ll go straight to the concurrent learning steps diagram (including coverage of current interview common test points, such as source analysis of HashMap and ConcurrentHashMap) :


Prior to this, you need to learn the basics of Java concurrency in detail, such as CPU caching and the Java Memory Model (JMM), where many keywords such as volatile and synchronized are specified.

High concurrency

The concurrency mentioned in the title of this notebook actually consists of two parts: concurrency and high concurrency. So far, we’ve been talking about the first of two parts: concurrency. So what’s the difference between concurrency and high concurrency? Many students are confused about these two concepts, so LET me make a quick distinction.

When we talk about multi-threaded concurrency, we are talking more about multiple threads operating on the same resource, so we are talking more about thread safety and proper allocation and use of resources. High concurrency mainly refers to the situation that “a large number of operation requests are encountered in a short time” during the operation of the system, which mainly occurs when the system receives a large number of requests (for example, the situation of snatching tickets on 12306; Tmall Double 11 event). When we talk about high concurrency, we are talking about how to improve the performance of existing applications, but more about solutions, ideas, approaches, and so on for high concurrency scenarios. If the high concurrency is not handled properly, not only the user experience is reduced (the request response time is too long), but also the system may break down, or even OOM exception and the system stops working. Here, I will directly present some solutions and methods that are usually considered in high-concurrency scenarios:


At the end

I have given my understanding of how to effectively prepare concurrent questions in interviews. Hopefully this will help you build up a general knowledge of concurrency in your mind, and then prepare for the interview according to this knowledge. I wish you can pass the interview with high marks and get a high salary!

Of course, light concept light is useless, we also need to learn the relevant knowledge points and classes according to these Outlines. I have prepared these practical knowledge points learning process, I believe that smart you already know how to do ~

Author: _Jimin_


Links:
www.imooc.com/article/239…


Source: MOOC


This article is originally published in the MOOC website, reproduced please indicate the source, thanks for cooperation


Combat recommendation:

No matter the interview or the actual development, almost will involve the concurrent knowledge and high concurrency related scenarios processing, if you want to systematically learn concurrent programming, and understand the actual high concurrency scenarios and solutions, then this course is for you.

Java concurrent programming and high concurrency solutions – MOOC network practice


Recommended reading:

Don’t miss the javascript mini-library

Java thread pool

A good bit of Java. Class decompiler is recommended

Java interview resources —- Baidu “Java interview questions “first 200 pages summary

Advice for a novice programmer