Splitting
Responsibility into a Producer and a Consumer
A producer-consumer model is
similar to both the pipeline model and the client-server. Here, the producer is
generating units of work, and the consumer is taking those units of work and
performing some kind of process on them.
For example, the movie-rendering problem described
earlier might have a set of pro-ducers generating rendered frames of a movie.
The consumer might be the task that has the work of ordering these frames
correctly and then saving them to disk.
This can be represented as multiple copies of task A sending results to
a single copy of task B, as shown in Figure 3.21. Alternatively, there could be
multiple producers and a single consumer or multiple producers and consumers.
Again, this approach does not necessarily reduce
the latency of the tasks but provides an improvement in throughput by allowing
multiple tasks to progress simultaneously. In common with the client-server
task, it may also provide a way of reducing the complex-ity of combining the
output from multiple producers of data.
Related Topics
Privacy Policy, Terms and Conditions, DMCA Policy and Compliant
Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.