Operating system - Multi-producers and more consumers question

I. Description of the problem

 

 

An example of the only producer in the production of a product, consumers are consuming only one product, and where producers and consumers of production and consumption of the product types are different, where "many more consumers and producers," the "more" is not more, but multi-class, multi-class and multi-class producer of consumers!

Second, the problem analysis

 

Third, how to achieve

Consider a problem, can you do this mutex mutex?

 

The reason is that: the buffer size is 1 this question, at any time, apple, orange, plate three synchronization signals in the amount of at most only one is 1, and this must start several processes these three signals amount P operation, so only a P operation process will not be blocked at any time, and successfully enter the critical section!

However, if the plate capacity is 2, that is, the capacity of the buffer is then 2 ......

If plate = 2

semaphore plate = 2; 

 

IV Summary

 

 Considered from the perspective of an "event", should "context process behavior" abstract as a pair of "context of events"!

Guess you like

Origin www.cnblogs.com/wkfvawl/p/11531382.html