- What kind of locks does java have? Have you used reentrantlock? The difference between reentrantlock and syncmchronized
- Why use a lock?
- Use a mutex to implement a read-write lock, with priority given to writers
- Corresponding wait and notify in reentrant lock
- Reentrant read-write lock, how is reentrancy achieved?
- The usage scenarios of ThreadLocal and the problems to be paid attention to when using it
- For an ordinary thread pool, coreSize = 5, maxSize = 10, the length of the blocking queue is 20, and the insertion thread is executed permanently, then how about the number of threads in the thread pool and the corresponding response to the continuous insertion of threads? ?
- Several ways to create threads
- Basic principles of lock implementation
- The difference between lock and try lock in reentrant lock
- How to make a distributed lock
- The difference between runnable and callable
- In the java thread pool, the two thread pools based on cache and based on fixed length, how do they deal with too many requests? The fixed-length queue is used. What if the queue is also full? Swap into disk? What about cache-based thread pool solutions?
- Thread pool (7 core parameters of ThreadPoolExecutor, 4 rejection strategies, 1 usage principle)
- Which thread pools have been used, their principles are briefly summarized, the meaning of each parameter of the constructor, such as coreSize, maxsize, etc., and what determines the maximum number of threads in the thread pool
- Thread pool parameter settings, why are they set up like this, and what is the effect? 7 major parameters
- Have you used spring thread pool or java thread pool?
- For an ordinary thread pool, coreSize = 5, maxSize = 10, the length of the blocking queue is 20, and the insertion thread is executed permanently, then how about the number of threads in the thread pool and the corresponding response to the continuous insertion of threads? ?
- The difference between wait() and sleep() methods. And the implementation principle of wait
- Thread blocking method
- The state of the thread
- What is thread safety and what is reordering
- How does the thread exit and end
- What engine can be used for reading more and writing less?
- Why are the stop() and suspend() methods deprecated?
- What are the similarities and differences between synchronous and asynchronous, and under what circumstances should they be used?
- What kind of lock does synchronized add to the method? Do you understand the synchronized keyword?
- What optimizations did synchronized do in JDK6, the difference between synchronized and lock
- When a thread enters a synchronized method of an object, can other threads enter other methods of this object?
- Briefly describe the similarities and differences between synchronized and java.util.concurrent.locks.Lock? The principle of synchronized, what is spin lock, biased lock, lightweight lock, what is reentrant lock, what is fair lock and unfair lock
- Explain several available states of threads in general.
- The difference between run() and start(). Why does thread execution call start instead of run directly
- Please tell me the method of thread synchronization you know.
- Thread scheduling and thread control.
- What is thread starvation and what is livelock?
- What is busy loop in multithreading?
- What is a volatile variable? What is the difference between a volatile variable and an atomic variable?
- What guarantees do volatile type variables provide? Can a non-atomic operation be made atomic?
- Reordering of volatile instructions, memory barriers
- The principle and function of volatile, can it replace locks, the usage of volatile keyword, the use of volatile
- Which atomic classes have been used, what are their parameters and principles
- If you were asked to implement a concurrency-safe linked list, what would you do
- AQS principle (source code of execution process, details of enqueue and dequeue, source code details)
- The difference between lazy man style and hungry man style
- Is it thread-safe to use double check for lazy singletons? Why add volatile
- What is CAS?
- Implementation of optimistic locking in Java (CAS+spin)
- What is the happens before principle
- What does thread join mean
- What kinds of locks does Java have? There are several types of thread pools. Among them, coreSize, maxSize, survival time, waiting queue, and rejection strategy must be clear about the implementation of blocking queues. At least two methods of blocking queues can be implemented by yourself. method (single lock, multiple lock, ReentrantLock, Condition)
- Is HashMap thread-safe, how is it implemented at the bottom layer (get, set, resize), what changes have been made before and after JDK1.8, and which HashMap (LinkedHashMap, TreeMap, ), how is ConcurrentHashMap thread-safety implemented (different implementations before and after JDK1.8)
- Netty, Jetty implementation principle.
- Forkjoin model
- Java Callbacks