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

  • Home
  • SEARCH
  • 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 599977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:33:25+00:00 2026-05-13T16:33:25+00:00

Me and a friend were debating whether the number of threads in a threadpool

  • 0

Me and a friend were debating whether the number of threads in a threadpool should be processor count + 1 or just processor count.

I chose just processor count because there is a even number of threads that can be distributed to each processor, and he chose processor count + 1 because he thinks it’ll help him optimize performance.

Who is correct?

  • 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-13T16:33:25+00:00Added an answer on May 13, 2026 at 4:33 pm

    Neither of you.

    The correct answer is: you need a number of threads that produces the best overall result.

    Each thread you add has a cost. It’s a small cost but it’s definitely a cost. Put 30,000 threads in a thread pool and watch your system grind to a halt (if they’re all doing something).

    But each thread notionally saves you some amount of (overall) time.

    Conceptually you can plot that relationship and produce a range of threads that will give you the desired result given certain resource constraints. The correct number of threads is somewhere in that range.

    Note: I said “overall result”. That’s not necessarily the “fastest result”. One thread may do a task in 10 minutes. 100 threads may do it in 15 seconds. 1000 threads may do it in 10 seconds because you’re starting to hit contention limits for your particular problem. Is that a better overall result? There might be no real difference between 10 and 15 seconds but 1000 threads may use way more memory.

    Remember that not all threads are CPU bound so it makes perfect sense in a lot of situations to have way more threads than the number of cores because at some point in performing a task a thread may sleep while it waits for something to happen (network communication, disk read, whatever).

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

Sidebar

Related Questions

A friend and I were debating about whether he should use MySQL or a
I was debating with a friend who states that the static constructor could give
A friend was telling me the other day that there is a pyramid for
My friend gave me a database file: record.mdf . I copied that .mdf file
Friend functions should be able to access a class private members right? So what
A friend and developer I respect recently advised that I avoid using 'Includes' in
A friend of mine just used plain-old cat to concatenate two mp3 files,... cat
A friend wrote some code for me, and there was one file with a
My friend is trying to write a Windows application that can query an iPhone
Friend it just general question . How can write and retrieve the data on

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.