Producer-consumer, Operating System

Assignment Help:

The general idea of a producer-consumer architecture is related to building a pipeline of threads, similar to the web spider from Project 2. Each step of the processing will now be done by a specialized threads; whenever one thread is done with its part of the processing, it forwards the data to the next stage of the pipeline, like a factory assembly line. In a producer-consumer system, we guarantee that each stage of the pipeline signals the next stage of the pipeline when it completes its task, and blocks when there's nothing else for it to do, etc.

If we were to implement our web server in a producer-consumer fashion, we could simply create a pair of threads: one for reading the URL requested by the client, and another one for writing the answer back to the network. We could also create yet another intermediate thread, which would ?rst look for the URL in a cache. This intermediate threadmight help the overall average response time of the system, if we can implement the shortest time to completion ?rst policy, i.e. ?nish the easy things ?rst, which leads to the lowest average response time.

As with the thread pool approach, it is not always clear how many threads we need for each of stage of the pipeline; the exact amount depends on the application and is usually ?ne-tuned manually. Since each thread has a specialized task, if the number of threads for each task is not well-tuned, then many threads might be idle, wasting resources.

In general, the producer-consumer approach works well if the producer and the consumer are symmetric, i.e. if they proceed roughly at same rate. On the other hand, if the order of processing doesn't matter, it doesn't make sense to use a producer-consumer architecture, with its ordered pipeline of processing.


Related Discussions:- Producer-consumer

What are the disadvantages of linked allocation, What are the disadvantages...

What are the disadvantages of linked allocation? The drawbacks are a. Used only for sequential access of files. b. Direct access is not supported c. Memory space neede

Palm os provides no signifies of concurrent processing, Q. Palm OS provides...

Q. Palm OS provides no signifies of concurrent processing. Discuss three major complications that concurrent processing adds to an operating system. Answer: a. A meth

Explain process description in the unix system, Process Description A pr...

Process Description A process in UNIX is a somewhat complex set of data structures that provides the operating system with all of the information necessary to dispatch and manag

Explain and differentiate programmed and interrupt i/o, Question 1 Explain...

Question 1 Explain the structure of operating system in detail Question 2 Explain the following scheduling algorithm                                     1) First come Firs

Semaphore, mention the three problems that mat be caused by wrong initializ...

mention the three problems that mat be caused by wrong initialization and placement of wait() and signal()operations in the use of semaphore

State the advantage of multiprocessor system, State the advantage of multip...

State the advantage of multiprocessor system? The advantages of multiprocessor system are:- a)      Enhanced throughput. b)      Economy of scale. c)       Enhanced re

Virtual memory, In modern operating systems, applications do not directly a...

In modern operating systems, applications do not directly access the physical memory. Instead, they use so-called virtual memory, where each virtual address is translated to a phys

Explain lru approximation page replacement in detail, LRU approximation pag...

LRU approximation page replacement In this we utilize the reference bit associated with the page entry to choose a page to be removed. The various algorithms used for the imp

Define properties of distributed operating system, Define properties of Dis...

Define properties of Distributed operating system Distributed:- This system distributes computation among several physical processors. The processors do not share memory or a

Memory hierarchy, Difference between cache and associate memory

Difference between cache and associate memory

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd