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 8074173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:34:05+00:00 2026-06-05T14:34:05+00:00

I am working on a small library which uses the Task Parallel Library to

  • 0

I am working on a small library which uses the Task Parallel Library to run parallel searches for a solution. The current design works along these lines:

  • a ConcurrentQueue receives the result of Searches,
  • a main Task works as a loop, operating as a background thread. When a new Solution arrives to the Queue, it dequeues and processes it, and then launches a new Search on a new Task,
  • a Search is launched in its own Task, and returns its result to the Queue once complete.

[Edit based on Eric J’s answer: the activities involved are entirely CPU bound, there is no IO involved]

The framework works great as is for now. However, I have complete control over the number of Search tasks which will be triggered, and my understanding is that while the TPL handles the situation very well for the moment, shoving a large number of searches at the system will not result in increased parallelism because it will be bound by the number of cores available on the system, and will become counter-productive after a certain level.

My question is the following: can I “help” the TPL by limiting the number of Search tasks that will be run, and if yes, how would I go about determining what that upper-limit should be? Would it be appropriate to limit it based for instance on System.Environment.ProcessorCount?

  • 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-06-05T14:34:07+00:00Added an answer on June 5, 2026 at 2:34 pm

    First off, unless there is a real performance problem here, I would just let the TPL do it’s thing. It is quite good at that.

    If you do need to control the number of tasks to solve a real performance issue, you need to understand what is limiting performance. Are your tasks CPU bound? IO bound? Are you running out of physical memory, causing swapping?

    Once you know what the limiting factor is, you can certainly monitor that factor and adjust the number of running tasks based on that (runtime) measured value. For example, if your tasks are CPU bound but have some IO time, hard limiting based on the # of cores is close but not optimal. Limit instead based on overall CPU utilization. This assumes that the machine is mostly dedicated to processing this task. If not, hand-tuning is significantly more complex and error prone.

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

Sidebar

Related Questions

I'm working on a small Fortran library (novel code) which is being called from
I have been working on a project which uses Tiger's SQLite3 library (which if
Iam working on small booking room system. In my solution I have a Reservation
I'm working on a small app that uses the Facebook API. What I want
I've built a small, limited-scope, cross-platform UI library in C++. It uses the following
At the moment I am working on creating a small library for common data
I'm working on a small library for for ASP.NET MVC 3 that should offer
I'm working on a small library for our in-company use, and have been heavily
I am working on a small library, where I have following requirements for any
I am working on an .NET library project, containing a bunch of interfaces which

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.