Producer/Consumer Model
Readers familiar with the Producer/Consumer programming model may choose to skip this section and proceed directly to "Native PCI Express Ordering Rules" on page 318.
The Producer/Consumer model is a common methodology that two requestercapable devices might use to communicate with each other. Consider the following example scenario:
A network adapter begins to receive a stream of compressed video data over the network and performs a series of memory write transactions to deliver the stream of compressed video data into a Data buffer in memory (in other words the network adapter is the Producer of the data). After the Producer moves the data to memory, it performs a memory write transaction to set an indicator (or Flag) in a memory location (or a register) to indicate that the data is ready for processing. Another requester (referred to as the Consumer) periodically performs a memory read from the Flag location to see if there's any data to be processed. In this example, this requester is a video decompressor that will decompress and display the data. When it sees that the Flag has been set by the Producer, it performs a memory write to clear the Flag, followed by a burst memory read transaction to read the compressed data (it consumes the data; hence the name Consumer) from the Data buffer in memory. When it is done consuming the Data, the Consumer writes the completion status into the Status location. It then resumes periodically reading the Flag location to determine when more data needs to be processed. In the meantime, the Producer has been reading periodically from the Status location to see if data processing has been completed by the other requester (the Consumer). This location typically contains zero until the other requester completes the data processing and writes the completion status into it. When the Producer reads the Status and sees that the Consumer has completed processing the Data, the Producer then performs a memory write to clear the Status location. The process then repeats whenever the Producer has more data to be processed.
Ordering rules are required to ensure that the Producer/Consumer model works correctly no matter where the Producer, the Consumer, the Data buffer, the Flag location, and the Status location are located in the system (in other words, no matter how they are distributed on various links in the system).
 |