... continued
This lesson explains implementing a bounded buffer using the Monitor class.
Monitor Implementation
We can also implement the bounded buffer using the Monitor
class. In fact, using the Monitor
class saves us from busy-waiting, as a blocked thread can relinquish the monitor until it gets signaled.
Let's implement the enqueue()
method first. We'll define the entire method as a critical section as we manipulate shared data-structures within it. ...
Access this course and 1400+ top-rated courses and projects.