Producer - Consumer Problem in Java Multithreading

  Рет қаралды 2,472

Lazy Programmer

Lazy Programmer

Күн бұрын

Пікірлер: 2
@Werewolf5684
@Werewolf5684 6 ай бұрын
I have a question, if you closly the implementation using wait and notify method it is not exactly doing what blocking queue is doing, so I thing blocking queue is working Asynchronously where as wait and notify is working synchronously as we have added synchronized block over the shared resources, So basically I want to say if you look output of wait-notify method there always will be goring phase of the buffer sequaltially and once it reach the limit then shrinking phase of the buffer start sequentially and again growing phase vice-versa, but in the case of BlockingQueue the growing and shrinking phase of the queue is not sequential it is parallel. So how can we achieve that using wait and notify method approach, batter I would how BlockingQueue is achieving this kind of concurrent way of updatating the buffer.
@LazzyProgrammer
@LazzyProgrammer 6 ай бұрын
Blocking Queue handles concurrent updates to the buffer by allowing multiple threads to interact with the queue simultaneously without the need for explicit synchronization. It internally handles synchronization. Using wait and notify it's sequential order within synchronized blocks, where one thread must wait for another to release the lock before proceeding.
Interview Question | Print Even and Odd Numbers Using 2 Threads in Java
12:24
Thread Signaling in Java
23:26
Jakob Jenkov
Рет қаралды 12 М.
Кто круче, как думаешь?
00:44
МЯТНАЯ ФАНТА
Рет қаралды 6 МЛН
FOREVER BUNNY
00:14
Natan por Aí
Рет қаралды 36 МЛН
How Much Tape To Stop A Lamborghini?
00:15
MrBeast
Рет қаралды 257 МЛН
Twin Telepathy Challenge!
00:23
Stokes Twins
Рет қаралды 135 МЛН
Producer Consumer Problem in Java? | Blocking Queue in java | Threads and Concurrency
26:35
Java threads 🧵
16:01
Bro Code
Рет қаралды 122 М.
Кто круче, как думаешь?
00:44
МЯТНАЯ ФАНТА
Рет қаралды 6 МЛН