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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:51:26+00:00 2026-06-13T13:51:26+00:00

When I create an array of tasks like this: var taskArray = new Task<double>[]

  • 0

When I create an array of tasks like this:

            var taskArray = new Task<double>[]
            {
                Task.Factory.StartNew(() => new Random().NextDouble()),
                Task.Factory.StartNew(() => new Random().NextDouble()),
                Task.Factory.StartNew(() => new Random().NextDouble())
            };

Will this create 3 threads for sure, or it is up to the CLR to create threads as it sees fit?

So if I perform this in a web request, this means there will be at least 4 threads created to service the request correct? (the web request + 1 for each task)

  • 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-13T13:51:28+00:00Added an answer on June 13, 2026 at 1:51 pm

    Will this create 3 threads for sure, or it is up to the CLR to create threads as it sees fit?

    The latter. In particular, as those tasks complete so quickly I wouldn’t be surprised if they all executed on the same thread (although not the same thread as the one calling StartNew) – particularly if this is in a “clean” process and the thread pool hasn’t had to fire up many threads yet. (IIRC, the thread pool only starts one new thread every 0.5 seconds, which would give plenty of time for all of your tasks to execute on a single thread.)

    You can use your own custom TaskScheduler if you really want to, but that would be relatively extreme.

    You should read the MSDN article on task schedulers (including the default one) for more information.

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

Sidebar

Related Questions

I create array: TextBox[] textarray = new TextBox[100]; Then in cycle set this params,
I use this code $builder->add('userTasks','collection',array('type' => new UserTaskType())); This is working fine userTasks will
I need to create an array for time that I will use in a
So suppose I create an array with 5 spaces, like so - String[] myArray
I've seen from this (http://stackoverflow.com/questions/1890709/combining-many-rake-tasks-into-one-rake-task) that you can combine rake tasks like this: desc
I'm new to javascript and have a simple task. I have an array values
I have an algorithm where I create two bi-dimensional arrays like this: TYPE TPtrMatrixLine
i am new to ZF i want to create ajax link that will go
I have my first task on python class: Create a module vectors.py It will
How to create array of generic type? How does generic Arrays.copyOf() method work? 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.