Multithreading in Java¶
Table of Contents¶
- 1 Multithreading in Java
- 2 Threads in Java
- 2.1 Java Thread Example
- 2.2 Java Thread Sleep
- 2.3 Java Thread Join
- 2.4 Java Thread States
- 2.5 Java Thread wait, notify and notifyAll
- 2.6 Java Thread Safety and Java Synchronization
- 2.7 Java Exception in thread main
- 2.8 Thread Safety in Singleton Class
- 2.9 Daemon Thread in Java
- 2.10 Java Thread Local
- 2.11 Java Thread Dump
- 2.12 How to Analyze Deadlock and avoid it in Java
- 2.13 Java Timer Thread
- 2.14 Java Producer Consumer Problem
- 2.15 Java Thread Pool
- 2.16 Java Callable Future
- 2.17 Java FutureTask Example
Thread Life Cycle in Java¶
Java Thread Dump or Analyze Deadlock¶
- Java Mission Control -> Thread Dump
Java Multithreading Interview Questions¶
- What is the difference between Process and Thread?
- What are the benefits of multi-threaded programming?
- What is difference between user Thread and daemon Thread?
- How can we create a Thread in Java?
- What are different states in lifecycle of Thread?
- Can we call run() method of a Thread class?
- How can we pause the execution of a Thread for specific time?
- What do you understand about Thread Priority?
- What is Thread Scheduler and Time Slicing?
- What is context-switching in multi-threading?
- How can we make sure main() is the last thread to finish in Java Program?
- How does thread communicate with each other?
- Why thread communication methods wait(), notify() and notifyAll() are in Object class?
- Why wait(), notify() and notifyAll() methods have to be called from synchronized method or block?
- Why Thread sleep() and yield() methods are static?
- How can we achieve thread safety in Java?
- What is volatile keyword in Java
- Which is more preferred – Synchronized method or Synchronized block?
- How to create daemon thread in Java?
- What is ThreadLocal?
- What is Thread Group? Why it’s advised not to use it?
- What is Java Thread Dump, How can we get Java Thread dump of a Program?
- What is Deadlock? How to analyze and avoid deadlock situation?
- What is Java Timer Class? How to schedule a task to run after specific interval?
- What is Thread Pool? How can we create Thread Pool in Java?
- What will happen if we don’t override Thread class run() method?
Java Concurrency Interview Questions¶
- What is atomic operation? What are atomic classes in Java Concurrency API?
- What is Lock interface in Java Concurrency API? What are it’s benefits over synchronization?
- What is Executors Framework?
- What is BlockingQueue? How can we implement Producer-Consumer problem using Blocking Queue?
- What is Callable and Future?
- What is FutureTask class?
- What are Concurrent Collection Classes?
- What is Executors Class?
- What are some of the improvements in Concurrency API in Java 8?