1, how to understand fair lock
A fair lock means that multiple threads acquire locks in the order in which they apply for locks. The thread directly enters the queue to queue, and the first thread in the queue can obtain the lock. The advantage of a fair lock is that the thread waiting for the lock does not starve. The disadvantage is that the overall throughput efficiency is relatively low compared to unfair lock
2. How to understand the interrupt mechanism
Java’s thread interrupt mechanism relies on the interrupt flag bit. When the interrupt method is called, the interrupt flag bit is set to true, and different processing is performed for different thread states.