Concurrent Collection Interview questions and Answers for experienced and freshers | Code Decode

preview_player
Показать описание
This video contains Concurrent Collection Interview questions and Answers for experienced and freshers Candidates.

Udemy Course of Code Decode on Microservice k8s AWS CICD link:

Course Description Video :

Concurrent collection is a very important topic in terms of collection interview questions and answers for experienced and answers

Q) Difference between Synchronized Collection and Concurrent Collection?
Both Synchronized and Concurrent Collection classes provide thread-safety
The differences between them comes in performance, scalability and how they achieve thread-safety.
Synchronized collections like synchronized HashMap are much slower than their concurrent counterparts e.g. ConcurrentHashMap, Main reason for this slowness is locking;

What is the need of concurrent collection

Traditional collections are not thread safe. only few classes like Vector, HashTable are thread safe.

Collections provide some methods like synchronizedList, synchronizedMap, synchronizedSet those provide thread safety but problem is they capture lock on complete collection even for reading that decreases performance.

In traditional collection if one thread iterates and other tries to modify structural change then ConcurrentModificationException is thrown.

Give few concurrent collections classes ?
ConcurrentHashMap
CopyOnWriteArrayList
CopyOnWriteArraySet

Why performance of ConcurrentHashMap is better than HashTable and synchronizedMap ?
In HashTable and synchronizedMap lock is acquired on complete collection so only single thread can capture lock at a time while in ConcurrentHashMap lock is acquired on bucket level so at a time multiple thread can capture lock on different different bucket.

Promotional Links

Code Decode Playlists

-------------------------------------------------------------------------------------------------------------------------------------
Subscriber and Follow Code Decode

--------------------------------------------------------------------------------------------------------------------------------------

#javacollectioninterviewquestion #topjavacollectioninterveiwquestion #javainterviewquestion #codedecode
Рекомендации по теме
Комментарии
Автор

This is the Best video on Concurrent HashMap on whole internet. We cant find such explanation anywhere else, Thanks alot Mam 😊

akshayengineer
Автор

This is the best video on CHM so far... Every video of yours are clear, to the point and well structured.. You explain very well.. This is a very dependable channel.. Thank you

rituparnadeshpande
Автор

Thanks for this video. Earlier I did not know that there are two concepts in CHM: concurrency level and number of buckets, and together these both spell the magic.

rishiraj
Автор

One important point you forgot to add that we can change legacy collections structure through iterator remove method.

ILuvBilli
Автор

Ma'am, You have mentioned t2 can't do read or write on segment 1 at 10:50 . But at 17:00 you said read can happen anywhere, segment does not matter. I'm confused. It would a great help if you help me understand.

sharvarirg
Автор

Thank you so much for upolading such a useful videos...this is helping a lot to clear my logic

suryadoynandan
Автор

thank you so much for clearing all the doubts

sneharaghuwanshi
Автор

is there any video for segmentation which u have made.. wanted for refernece

yoshitamahajan
Автор

Really helpful.
Can you please make part2 of concurrent collections

prinkpalsingh
Автор

Hi, why won't we get if we are iterating through ForEach loop and updating map during iterating..?

Iam_Raam
Автор

KIndly Please share the program to understand the concurrent hashmap where it is not allowed null and concurrency level program as well with bit more explanation.

hemantanahak
Автор

Mam in 13.26 timing.. In that slide t1 check the condition and t2 delete the key u said that na.... My question is t2 for delete operation is our assumption?? Is it correct mam??

premamalar
Автор

If one thread is accessing the value then on the same bucket other thread cannot modify right then how will it return null?

lohitharg
Автор

Program why null not allows in concurrent hashmapcode while allowed in hashmap please explain by debugging code

venkatsai
Автор

Great explaination but can you please explain modcount concept in a bit more detail

iloradas
Автор

Nice and expecting more videos like this

muralir
Автор

As for read, there is no lock.
Then say s0 is locked for writing then why does reading not allowed in s0?

shankardayal
Автор

Please make a video on why null are not allowed on concurrent hashmap.

kumaraditya
Автор

If we are iterating through forEach, we will not get but we will get if iterate through iterator, why ?

Iam_Raam
Автор

Yes please make video thanks in advance

venkatb