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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:57:37+00:00 2026-06-10T12:57:37+00:00

AS far as I understood , Plinq decides how many thread to open (

  • 0

AS far as I understood , Plinq decides how many thread to open ( each on a thread on different core)
by cores count.

__________

  Core 1
  Core 2
  Core 3
  Core 4
___________

So If I Have a Plinq task which finds all the first 1000 prime numbers ,
Plink will open a new Thread on each Core in order to maximize the efficiency.

So here , each core will be running on 1000/4 numbers , the logic of finding the prime numbers.

However I’ve read that a blocking operations like IO should be used with WithDegreeOfParallelism so that the cpu won’t think that this is an intensive cpu operation , and it allowed to use more threads than cores.

Question :

1) Is it accurate ? Did I understood it correctly ?

2)If I set WithDegreeOfParallelism (7) so it will definitely use all the 4 cores , but what about the other 3 ? ( 7-4) where will they be running ? on which core/s ?

  • 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-10T12:57:39+00:00Added an answer on June 10, 2026 at 12:57 pm

    First, .Net doesn’t choose which core executes which thread, the OS does. If there is no other CPU-intensive application running on the system, you can expect that each thread will execute on a separate core. But if there is some other application, the OS might for example decide to run all of your threads on a single core, switching between them.

    And it’s even more complicated than that. A thread usually doesn’t run on a single core, the OS switches it from core to core all the time. For example, have a look at the following screenshot from Task Manager showing the execution of a single-threaded CPU-intensive application.

    Task Manager CPU usage screenshot

    You’ll notice that the single thread executed on all of my 4 cores, and utilized approximately 25 % of each core over the few seconds it ran.

    .Net has no knowledge of the CPU usage of your computer, so it assumes that the optimal number of threads doing CPU-intensive work is the same as the number of cores.

    I don’t know how exactly does PLINQ work, but I wouldn’t expect each core to produce exactly 1000/4 prime numbers in your example. If one thread already produced its share of prime numbers and another one isn’t done yet, it wouldn’t be efficient to let the first thread stay idle.

    And yes, with IO operations, the optimal number of threads doesn’t depend on the number of cores, so you should set the degree of parallelism manually. (Don’t forget that the optimal number of threads may be 1; harddisks are fastest with sequential reads, not seeking back and forth between many files.)

    If you set WithDegreeOfParallelism(7) it will definitely use 7 threads (again, no guarantee on the number of cores). The OS will decide how to run those 7 threads on your 4 cores. If all of those threads are CPU-intensive, it will most likely give each thread something like 4/7 ≈ 57 % of a core. If they are IO-bound, it will execute the code for a thread that just woke up (unblocked) on any core that is just available.

    And WithDegreeOfParallelism() really does set exact number of threads, not their maximum number, see Stephen Toub’s ParallelOptions.MaxDegreeOfParallelism vs PLINQ’s WithDegreeOfParallelism.

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

Sidebar

Related Questions

As far as I have understood so far, every time I draw something in
I am new python programmer,what I have understood so far,yield keyword returns an object
Core features of node.js as far as I understood are (also): event-based structure and
As far as I understood the static initialization block is used to set values
As far as I understood it, BigInts are usually implemented in most programming languages
I want to understand exactly what unit test means. From what I have understood
I was reading about union in C from K&R, as far as I understood,
I have been doing some test on my Pentium D (an old dual core
As far as I understood it is not possible to rise privileges within the
I saw a field text[] (text array) in Postgresql. As far as I understood,it

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.