Stream Read And Write Queues

Is there any possibility that a Stream Read and Write queues will interchange messages of any kind. If so what are the different possiblites and under what circumstances ?

Thanks in advance.

Data on a Stream is passed in the form of messages. Each Stream head, STREAMS module, and driver has a read side and a write side. When messages go from one module's read side to the next module's read side they are said to be traveling upstream. Messages passing from one module's write side to the next module's write side are said to be traveling downstream.

Each Stream head, driver, and module has its own pair of queues, one queue for the read side and one queue for the write side. Messages are ordered into queues, generally on a first-in, first-out basis (FIFO), according to priorities associated with them.

The queue's service procedure deals with messages on the queue, usually by removing successive messages from the queue, processing them, and calling the put procedure of the next module in the Stream to pass the message to the next queue!

Following is the diagram I found in SCO manuals :-
(upstream) (downstream)
(up^stream) (downstr|eam)
(up|stream) (downstr|eam)
(up|stream) (downstrXeam)
READ QUEUE�.........�WRITE QUEUE
(up^stream) (downstr|eam)
(up|stream) (downstr|eam)
(up|stream) (downstrXeam)
READ QUEUE�...........�WRITE QUEUE
(upstream) (downstream)

The above figure shows queue's linkage with neighboring modules with links ( solid vertical arrows - --> or --X ) in both directions.
I can very well understand the flow of message from downstream to upstream direction. But according to the manual each queue locates it mates ( see dotted line ) .
My question is I am not able to understand why such a relation is required or else I am completely wrong ?

Thanks in advance.

I wanted to refer to my Streams Docs before I answered this. I found the answer in UNIX SYSTEM V RELEASE 4 Programmer's Guide: Streams. On page 3-4 on my book it has the diagram you show together with some qinit stuff.

I suspect that your book may be similiar to mine. My chapter 4 is STREAMS Processing Routines. On page 4-4, the Asynchonous Protocol Stream Example starts. A few pages in I have:

Sir, I am referring SCO Streams Runtime Systems Release and Installation Notes Manual - Streams Programmers Guide.

The diagram, which I have designed in my previous message, exists in Chapter 5 page 3.

Sir, could you explain me some basics concepts of Streams Scheduler with reference to queues. What is a Scheduling queue?

I found out that the q_link member of queue_t structure actually holds link to the queue scheduler. Kindly explain the scheduling operations.