The producers produce items off-line, then post these to the tail of the circular buffer when one or more spaces are free. Otherwise they block until a space opens up for them. Each item is classified by a procedure provided by the system and is marked with a label indicating the types of consumer that should process the item. There are three types of consumer, A, B and C, and several processes of each type. If the head of the buffer is of the wrong type for a consumer, then it must wait until that and all other incompatible items are deleted and the head of the buffer contains an item with a compatible label.
Consumers read the item into a local buffer and process it off-line.
Both producers and consumers may modify the label. This array need not be in sorted order. The problem is to identify all the significant elements of the array. Present an time algorithm for this problem. Input is a graph in adjacency matrix form.