Skip to main content

Concurrency

English

  1. What is the difference between a process and a thread?
  2. What is the difference between process switching and thread switching?
  3. What is the difference between parallelism and concurrency?
  4. What is a daemon thread?
  5. What are the different ways to create a thread?
  6. What are the states of a thread?
  7. What is the difference between sleep() and wait()?
  8. What is the difference between notify() and notifyAll()?
  9. What is the difference between the run() and start() methods of a thread?
  10. What are the ways to create a thread pool?
  11. What are the states of a thread pool?
  12. What is the difference between the submit() and execute() methods in a thread pool?
  13. How can you ensure thread safety in a Java program?
  14. What is the principle behind synchronized lock upgrading in multithreading?
  15. What is a deadlock?
  16. What is the difference between deadlock and starvation?
  17. How can deadlocks be prevented?
  18. What is ThreadLocal? What are its use cases?
  19. Explain the underlying implementation of synchronized.
  20. What is the difference between synchronized and volatile?
  21. What are the communication methods between threads?
  22. What are the communication methods between processes?
  23. What is thread safety? Is Vector a thread-safe class?
  24. What is a FutureTask?
  25. What is the difference between the heap and the stack in Java?
  26. What is a thread pool, and why is it used?
  27. What is the difference between livelock and deadlock in Java?

Chinese

  1. 進程和線程的區別是什麼?
  2. 進程切換和線程切換的區別是什麼?
  3. 並行和並發的區別是什麼?
  4. 守護線程是什麼?
  5. 創建線程有哪幾種方式?
  6. 線程有哪些狀態?
  7. sleep()wait() 有什麼區別?
  8. notify()notifyAll() 有什麼區別?
  9. 線程的 run()start() 有什麼區別?
  10. 創建線程池有哪幾種方式?
  11. 線程池都有哪些狀態?
  12. 線程池中 submit()execute() 方法有什麼區別?
  13. 在 Java 程序中怎麼保證多線程的運行安全?
  14. 多線程中 synchronized 鎖升級的原理是什麼?
  15. 什麼是死鎖?
  16. 死鎖和饑餓的區別是什麼?
  17. 如何防止死鎖?
  18. ThreadLocal 是什麼?有哪些使用場景?
  19. 說一下 synchronized 底層實現原理?
  20. synchronizedvolatile 的區別是什麼?
  21. 線程有哪些通信方式?
  22. 進程有哪些通信方式?
  23. 什麼是線程安全?Vector 是一個線程安全類嗎?
  24. 什麼是 FutureTask
  25. Java 中堆和棧有什麼不同?
  26. 什麼是線程池?為什麼要使用它?
  27. Java 中活鎖和死鎖有什麼區別?