Reputation: 832
In a producing and consuming application, let's say producting takes one cpu cycle and consuming takes 3 avarage cpu cycles. Then how do we manage to keep equal number of productions and consumptions boundry. this is a problem I imaginge while I was studying threads.
If you have any idea to implement this with Java please share your knoweledge.
Upvotes: 0
Views: 75
Reputation: 533442
You have to design your system so that you consumers can keep up with your producer in the long run. Most producers are bursty and if you use a queue it doesn't matter that for very short periods they are producing faster than your can consume. If this is not the case you can
Upvotes: 3