Skip to main content

Concurrency

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 is the difference between the run() and start() methods of a thread?

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 do you ensure thread safety in Java programs?

14. What is the principle of synchronized lock escalation 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 FutureTask?

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

26. What is a thread pool? Why should it be used?

27. What is the difference between livelock and deadlock in Java?