Series: multithreading

Java programs on multiple threads with screenshots explained in simple terms

Multithreading Tutorial Java

Multithreading Tutorial Introduction Comparative to other languages, multithreading is very easy and simple in Java and the credit goes to the portability nature and support of many Java API classes. The built-in support for threads is simple and straight so that any programmer can do with multithreading operations without confusion and special attention. Multithreading uses …

Multithreading Tutorial Java Read More »

Thread Lightweight Heavyweight Java

Introduction to Thread Lightweight Heavyweight Java If only one process exists before the processor and if the process execution is stopped for some reason, the microprocessor becomes idle without any work. This type of programming is known as monolithic programming. In monolithic programming, the whole process constitutes a single module. To get a better understanding, …

Thread Lightweight Heavyweight Java Read More »

Extends Thread vs Implements Runnable

It is a big question, even in interviews, which style of creation of thread is preferable. Explained in simple terms. Start reading. Thread creation styles There are two ways of creating threads – one by extending Thread class and the other by implementing Runnable interface. Now the discussion is which to prefer in normal situations. …

Extends Thread vs Implements Runnable Read More »

Create Lightweight Heavyweight Threads

Create Lightweight Heavyweight Threads Summary: In this tutorial "Create Lightweight Heavyweight Threads", you will create both lightweight and heavyweight threads in simple terms, programs and screenshots. We know earlier, the meaning of heavyweight and lightweight threads in in Java Thread Basics with figures. Now, let us see how to create them. 1. Creating Heavyweight Threads …

Create Lightweight Heavyweight Threads Read More »

Thread join() Method Example Java

It is very confusing for a novice, the difference between join(), yield(), sleep(), suspend() and wait() methods in Java thread management. Here we go with join() method. To understand easily, I take the example of parent and child threads. Parent and Child Threads One thread creates another thread. The thread which creates is known as …

Thread join() Method Example Java Read More »

isDaemon isAlive isInterrupted getThreadGroup

isDaemon isAlive isInterrupted getThreadGroup Summary: So far, we studied the methods like sleep(), start() and currentThread() etc. of Thread class. Let us study some more, very less used by the Programmers, like methods isDaemon isAlive isInterrupted getThreadGroup etc. Program with Methods isDaemon isAlive isInterrupted getThreadGroup : public class MoreMethods { public static void main(String args[]) …

isDaemon isAlive isInterrupted getThreadGroup Read More »

Thread yield sleep Java

Summary: By the end of this tutorial "Java Thread yield sleep", you will understand the narrow difference between yield() and sleep() methods. Thread Scheduler Scheduling the threads to the Microprocessor for execution, one after another, is entirely the responsibility of the underlying operating system. The scheduler (controlled by OS or part of OS) considers many …

Thread yield sleep Java Read More »

Difference Process Thread Program

Difference Process Thread Program Summary: It is very confusing for a novice the difference between a Process, Thread and Program. These concepts are explained in simple words in this tutorial "Difference Process Thread Program". Difference Process Thread Program A Program when started execution is known as Process. Or to say, a program under execution is …

Difference Process Thread Program Read More »