0% completed
Problem 14: Advanced Synchronization in Multi-Buffered Master-Worker Thread Pools
Overview
In this problem, we are presented with a multi-buffered system where multiple master threads produce data, and multiple worker threads consume this data. The unique aspect of the problem is that while each master thread is dedicated to its own buffer, the worker threads have the flexibility to consume data from any buffer that has data available. This design aims to ensure optimal resource utilization; workers don't remain idle even if a particular buffer is empty
.....
.....
.....
Junaed Halim
· 9 months ago
Your workers never use bufferNotEmpty[i]. They just lock each buffer and check isEmpty(). That turns bufferNotEmpty[i] into a no-op and also causes permit drift: producers keep calling bufferNotEmpty[i].release() but no one ever acquires those permits, so the semaphore count grows and no longer matches the true item count.
Raman Ailawadhi
· 7 months ago
Shlomi Fisher
· 2 years ago
It's missing in the C++ solution