Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1109943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:19:03+00:00 2026-05-17T02:19:03+00:00

I want to implement a Producer – Consumers pattern using a ThreadPool for the

  • 0

I want to implement a Producer – Consumers pattern using a ThreadPool for the Consumers. I will have 1 producer of requests and multiple consumers that will handle the incoming requests. When Implement the consumers using a threadpool my question if I should still have my own Queue for the producer to put requests on and then pass them to the Cosumers ThreadPool or if I should just have the Producer pass it straight to the ThreadPool Queue?

My concern with the last is how many tasks one can pass to a ThreadPool queue and at what rate? The Producer should be fairly fast in doing some ‘pre-processing’ work before passing it on to the consumer threads.

Will I not have more control when I have a Queue in between Producer – Consumer thread?

This is for a Server application that needs to be high performance and will need to handle lots of incoming client requests. (In the hundreds at a time).

Any advice is appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T02:19:03+00:00Added an answer on May 17, 2026 at 2:19 am

    A queue between producer and threadpool requires 1 or 2 extra context switches: the threadpool waits on an empty queue and then needs to dispatch to a consumer thread. At the end the consumer must be presented back to the threadpool. Dispatching and handling the end can be managed by the message class.
    With all consumer threads waiting on a queue, one of the listeners will consume and stop listening until ready. When all consumers are busy, the next message will be handled when the first consumer is ready.
    So the former has a bit more predictable behaviour with the cost of extra contextswitches.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to implement a concurrent producer-consumer collection (multiple producers and consumers) that supports
I have an object Producer which internally starts a thread that will listen for
I have to implement a multiple producers / multiple consumers example application for a
I would like to implement a Multiple file downloading with pattern of single producer
I want to implement a one-producer, multiple-consumer model with shared memory in Unix Producer:
i starter in jqgrid, i want implement inline edit in jqgrid i have this
Microsoft has announce that WindowsLiveID become a OpenID provider . I want implement it
I want to implement an application which will work as a parser. User will
I want to implement login using facebook in my windows phone 7.1 application When
I would like to implement a number of functions in (32bit) NASM that have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.