Volatile keyword in Java

Volatile keyword in Java In a multithreading environment, there are several situations where multiple threads try to update the same shared variable. This means it can lead to concurrency issues in Java. To handle this and make it thread-safe, we can use the volatile keyword in Java to update the …

Read more

Inter thread communication in Java

Inter thread communication in Java Inter thread communication in Java or cooperation is the process of coordinating the communication between the synchronized threads. This means, when a new thread wants to enter the critical section, it pauses the currently executing thread to allow the new thread. In this way, if …

Read more

Thread synchronization in Java

Thread synchronization in Java Thread synchronization is an important concept in Java Multithreading. It is important to achieve thread-safety since in multithreading uses shared resources. We can implement thread-safety using synchronized block and method in Java. Synchronization ensures the control of multiple threads accessing the same resource by allowing only …

Read more

Multitasking in Java

Earlier, we have seen about multithreading in Java. In this tutorial, we will discuss multitasking in Java along with key differences between Multitasking vs Multithreading. Multitasking in Java Multitasking is the ability of the CPU to perform multiple tasks simultaneously. There will be continuous context switching of CPU between the …

Read more

Daemon Thread in Java

In the previous articles, we have seen various topics related to user threads. In this article, we will understand about daemon threads in Java, their uses, methods with examples and see differences between daemon thread vs user thread. Java Daemon thread Daemon thread in Java is a system-generated thread that …

Read more

Thread Priority in Java

Thread Priority in Java In a Java multithreading environment, every thread has a priority which is an integer value between 1 and 10 where 1 is the lowest and 10 is the highest. Thread priority is an essential concept since the scheduler picks up the threads for execution based on …

Read more

Thread scheduler in Java

Java Thread Scheduler The thread scheduler in Java is an important concept in multi-threading which is part of the JVM. The scheduler decides which thread to pick up for execution and mainly depends on two factors: time-slicing and preemptive scheduling. A thread scheduler picks up those threads that are in …

Read more

Thread in Java

In the previous tutorial, we have discussed about Multithreading in Java. In this tutorial, we will discuss in detail Thread in Java, how to create a java thread and thread lifecycle. Java Threads A thread in Java is a lightweight process or the smallest unit of a process. Each thread …

Read more

Translate ยป