The most comprehensive Java multithreaded questions and answers in history

Source: Internet
Author: User

  1. What's the use of multithreading?

  2. What is the difference between a thread and a process?

  3. What are the different ways Java implements threads?

  4. Start thread method What is the difference between start () and run ()?

  5. How do I terminate a thread? How gracefully to terminate a thread?

  6. What are the different states of a thread's life cycle? How do they flow between them?

  7. What is the difference between the wait () and sleep () methods in a thread?

  8. What are the various methods of multithreading synchronization?

  9. What is a deadlock? How do I avoid deadlocks?

  10. How to communicate between multiple threads?

  11. How does the thread get the return result?

  12. Violatile the role of the keyword?

  13. New T1, T2, T3 three threads, how do you ensure that they are executed sequentially?

  14. How do I control that only 3 threads run at a time?

  15. Why use a thread pool?

  16. Several commonly used thread pools and talk about how they work.

  17. What is the difference between the thread pool startup threads submit () and the Execute () method?

  18. The difference between Cyclicbarrier and Countdownlatch?

  19. What is a live lock, hunger, lock-free, deadlock?

  20. What is atomicity, visibility, and order?

  21. What is a daemon thread? What's the use?

  22. How do I break a thread? How to ensure the interruption of business is not affected?

  23. What happens when a thread runs with an exception?

  24. What is a re-entry lock?

  25. What kinds of usage do synchronized have?

  26. What does the Fork/join framework do?

  27. What is the exception caused by too many threads?

  28. Talk about thread-safe and unsafe collections.

  29. What is a CAS algorithm? What are the applications in multi-threading.

  30. How do I detect if a thread has a lock?

  31. What are the commands for troubleshooting multithreaded issues in the JDK?

  32. What does thread synchronization need to be aware of?

  33. What are the prerequisites for using the Wait () method for threads?

  34. What is the Fork/join framework used to pay attention to?

  35. How do you pass data between threads?

  36. What are some of the ways to ensure visibility?

  37. Say a few common lock interfaces implement locks.

  38. What is threadlocal? What is the application scenario?

  39. What's the use of Readwritelock?

  40. What is Futuretask?

  41. How to wake up a blocked thread?

  42. How do immutable objects help with multithreading?

  43. What does multi-threaded context switching mean?

  44. What thread scheduling algorithms are used in Java?

  45. What is the role of Thread.Sleep (0)?

  46. What is the Java memory model, which areas are thread-shared, and which are unshared

  47. What are optimistic and pessimistic locks?

  48. Why do I synchronize the size () method of the Hashtable?

  49. Synchronization methods and synchronization blocks, which is better?

  50. What is a spin lock?

  51. Which is good for runnable and thread?

  52. What is the difference between notify and Notifyall in Java?

  53. Why Wait/notify/notifyall These methods are not inside the thread class?

  54. Why are the wait and notify methods called in the synchronization block?

  55. Why should you check the wait conditions in the loop?

  56. What is the difference between heap and stack in Java?

  57. How do you get the thread stack in Java?

  58. How do I create a thread-safe singleton mode?

  59. What is a blocking method?

  60. What happens when the thread pool queue is full when the task is submitted?

The most comprehensive Java multithreaded questions and answers in history

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.