Java Multithreading
Runtime class
Java Runtime class is used to interact with java runtime environment. Java Runtime class provides methods to execute a process, invoke GC, get total and…
Garbage Collection
In java, garbage means unreferenced objects. Garbage Collection is process of reclaiming the runtime unused memory automatically. In other words, it is a way to…
Performing multiple task
If you have to perform single task by many threads, have only one run() method.For example: Program of performing single task by multiple threads class TestMultitasking1 extends Thread{…
Shutdown Hook
The shutdown hook can be used to perform cleanup resource or save the state when JVM shuts down normally or abruptly. Performing clean resource means…
Thread Group
Java provides a convenient way to group multiple threads in a single object. In such way, we can suspend, resume or interrupt group of threads…
Thread Pool
Java Thread pool represents a group of worker threads that are waiting for the job and reuse many times. In case of thread pool, a…
Daemon Thread
Daemon thread in java is a service provider thread that provides services to the user thread. Its life depend on the mercy of user threads…
Thread Priority
Each thread have a priority. Priorities are represented by a number between 1 and 10. In most cases, thread schedular schedules the threads according to…
Naming A Thread
The Thread class provides methods to change and get the name of a thread. public String getName(): is used to return the name of a…
Joining A Thread
The join() method waits for a thread to die. In other words, it causes the currently running threads to stop executing until the thread it…