Java Fundamentals - Lesson 55 - Semaphore vs. ReadWriteLock vs. CyclicBarrier

preview_player
Показать описание
Are you new to Java development? Do you want to know what to start with? This is a complete stream dedicated to you - the junior developer or future developer.

- Java OCP 11 certification
- Learn Java basics
- Find a junior java developer role

If your target is at least one of the above, then this lesson streaming is for you. Join!

Don't forget to follow me on Twitter @laurspilca or LinkedIn for more posts and discussions.

Рекомендации по теме
Комментарии
Автор

I think the first chat question was referring to the experimental project loom.

acronis
Автор

How to decide how many threads to choose for the newFixedThreadPoolExecutor?

ganeshk
Автор

Thanks for this video sir.
First time.my doubt is cleared how parties thread task cpu available are interrelated and how they affect.

Please make video on countdown latch and reentrant lock.
Visual difference between cyclic barrer and countdown latch
Why we say reentrant?

I know above things. as you cleared my concept of cyclic barrer i won't forget. Sameway i want to learn deep concept of above mentioned topic.

vivekguptacs
Автор

Hello, here's a thing that makes me think, when using a ReadWriteLock, and say we have a thread in the read block, and then a thread enters the write block, what happens to the read thread? does it get kicked out of the block? Does the write thread wait for the read thread to finish reading? Because if nothing happens then it will be a race condition between the read and the write thread.

alphapicturesentertainment
Автор

Hello Laurentiu! Just like we have a 'fair' parameter in semaphore's constructor, do we have anything like that in ReadWriteLock? If not, isn't there a chance that the writer threads can suffer from starvation if read operations are more frequent than write/increment operations?

arnold
Автор

Hello Laurentiu,

In the case of CyclicBarrier example i noticed that you used the CyclicBarrier object instance as a dependency of the task itself so that in your main method you just duplicate your task three times, but what will happen when we try to use the same CyclicBarrier object instance across multiple tasks ? is it possible ? if it is, we could then instantiate other tasks rather than reuse the same one over and over again like on the example, is it right ?

Thank you a lot Laurentiu, for your help & effort.
Have a good day.

Keep on hacking ;)
Best regards.

Achraf

achrafrhariss