Everyone knows about what sorting is. There are so many computer algorithms that have emerged to support sorting. Some of the well-known algorithms are quick sort, heap sort, merge sort etc. All these sorting algorithms are working based on sequential sorting. Means, a single thread is used to perform the complete sorting operation. However, this... Continue Reading →
Parallelism in ConcurrentHashMap
ConcurrentHashMap is used extensively in multi-threaded applications. The examples of multi-threaded applications are online gaming applications, chat applications, it adds the benefit of concurrency to the application. To make application more concurrent in nature, ConcurrentHashMap introduces a concept called ‘Parallelism’. In this article we will learn more about parallelism in ConcurrentHashMap. What is Parallelism? Basically,... Continue Reading →
Synchronized method – Boy Friend Threads & Girl Friend Object
When a method is synchronized, only one thread can enter that object's method at a given point in time. If any other thread tries to enter the synchronized method, it will NOT be allowed to enter. It will be put in the BLOCKED state. In this post, let’s learn a little more details about synchronized... Continue Reading →
Can threads execute different synchronized methods on same object?
In our earlier post, we learnt that when a method is synchronized only one thread will be allowed to enter the method. In this post, let's do a little bit of deep dive - What would happen if an object has two synchronized methods? When a thread is executing the first synchronized method, will another... Continue Reading →
Java Static Synchronized method behavior
In our earlier post, we learnt that when a method is synchronized, only one thread will be allowed to enter the method. In this post, let's discuss the behavior of static synchronized methods. Video: To see the visual walk-through of this post, click below: https://youtu.be/YFNklSkT1js Multiple static synchronized methods in a same object example To facilitate... Continue Reading →
Java synchronized block
In the earlier post we learnt about the Java synchronized method. In this post, let's learn about the synchronized block. Video: To see the visual walk-through of this post, click below: https://youtu.be/NIeEiK_eklE What is Synchronized Block? Synchronized block is used to prevent multiple threads from executing a portion of a code in a method at the... Continue Reading →
Can threads execute same synchronized method on different objects?
In our earlier post, we learnt that when a method is synchronized, only one thread will be allowed to enter the method. In this post, let's do a little bit of deep dive - let’s discuss whether threads can invoke the same synchronized method on different objects at the same point in time. Video: To see... Continue Reading →
Advantages of Java Virtual Threads
Java virtual thread is a new type of threading model architecture introduced in JDK 19. Before you try to learn the benefits of Java Virtual Threads, you might want to understand how Java virtual thread works. Here is a post that gives you a quick introduction to Java virtual threads (we highly recommend you to... Continue Reading →
APIs to create Java Virtual Thread
Java virtual thread is a new feature available from JDK 19. It has potential to improve an application’s availability, throughput and code quality on top of reducing memory consumption. If you are interested in learning more about Java virtual thread, here is a quick introduction to it. Video: To see the visual walk-through of this post,... Continue Reading →