Multithreading and Concurrency

Multi-threading and Concurrency related collection

Producer Consumer Problem using Blocking Queue in Java

Carvia Tech | August 31, 2019 | 3 min read | 451 views | Multithreading and Concurrency

A producer consumer problem is a typical example of multi-thread synchronization problem where some shared resource (a work queue, blockingqueue) is used by two types of threads - Producer & Consumer

Read Article

Can the keys in HashMap be mutable

Carvia Tech | August 03, 2019 | 2 min read | 217 views | Multithreading and Concurrency

Simple answer is No, If we make the keys mutable then the hashcode of the key will no more be consistent over time which will cause lookup failure for that object from hashing data structure

Read Article

What is AtomicInteger class and how it works internally

Carvia Tech | August 03, 2019 | 2 min read | 239 views | Multithreading and Concurrency

AtomicInteger class was added in Java 5 that utilizes non-blocking concurrency for thread-safety, providing better throughput in highly concurrent environments.

Read Article

Top 20 Java Concurrency Interview Questions and Answers

Carvia Tech | May 28, 2019 | 1 min read | 90 views | Multithreading and Concurrency

We have compiled a list of top java concurrency and multi-threading interview questions.

Read Article

Discuss internals of a ConcurrentHashmap (CHM) in Java

Carvia Tech | May 25, 2019 | 4 min read | 308 views | Multithreading and Concurrency

A ConcurrentHashMap is a hashmap supporting full concurrency of retrieval via volatile reads of segments and tables without locking, and adjustable expected concurrency for updates. All the operations in this class are thread-safe.

Read Article

What do you understand by Java Memory Model?

Carvia Tech | May 19, 2019 | 2 min read | 200 views | Multithreading and Concurrency

Java Memory Model defines the legal interaction of threads with the memory in a real computer system. It determines when a Thread can reliably see writes to variables made by other threads.

Read Article

Design an Immutable class that has an java.util.Date member

Carvia Tech | May 19, 2019 | 1 min read | 91 views | Multithreading and Concurrency

As we know that java.util.Date is not immutable, we need to make a defensive copy of java.util.Date field while returning a reference to this instance variable.

Read Article

What is Immutable Class. Why would you choose it? How would you make a class immutable?

Carvia Tech | May 19, 2019 | 2 min read | 284 views | Multithreading and Concurrency

When the state of object can not be changed after its construction then the object is called Immutable. Immutable objects are inherently thread-safe, thus help writing multi-threading code without much worries.

Read Article

How will you handle ConcurrentModificationException in Java

Carvia Tech | May 06, 2019 | 1 min read | 62 views | Multithreading and Concurrency

ConcurrentModificationException is raised by fail-fast iterators when the underlying collection is modified structurally during iteration.

Read Article

What is ThreadLocal in Java, where will you use this class

Carvia Tech | May 05, 2019 | 4 min read | 103 views | Multithreading and Concurrency

ThreadLocal provides a mechanism of maintaining thread confinement for a given object. which allows you to associate a per-thread value with a value-holding object.

Read Article

This website uses cookies to ensure you get the best experience on our website. more info