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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:03:00+00:00 2026-06-13T15:03:00+00:00

Question 1. Is using Parallel.For and Parallel.ForEach better suited to working with tasks that

  • 0

Question 1.

Is using Parallel.For and Parallel.ForEach better suited to working with tasks that are ordered or unordered?

My reason for asking is that I recently updated a serial loop where a StringBuilder was being used to generate a SQL statement based on various parameters. The result was that the SQL was a bit jumbled up (to the point it contained syntax errors) in comparison to when using a standard foreach loop, therefore my gut feeling is that TPL is not suited to performing tasks where the data must appear in a particular order.

Question 2.

Does the TPL automatically make use of multicore architectures of must I provision anything prior to execution?

My reason for asking this relates back to an eariler question I asked relating to performance profiling of TPL operations. An answer to the question enlightened me to the fact that TPL is not always more efficient than a standard serial loop as the application may not have access to multiple cores, and therefore the overhead of creating additional threads and loops would create a performance decrease in comparison to a standard serial loop.

  • 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-13T15:03:01+00:00Added an answer on June 13, 2026 at 3:03 pm

    my gut feeling is that TPL is not suited to performing tasks where the data must appear in a particular order.

    Correct. If you expect things in order, you might have a misunderstanding about what’s going to happen when you “parallelize” a loop.

    Does the TPL automatically make use of multicore architectures of must I provision anything prior to execution?

    See the following article on the msdn magazine:
    http://msdn.microsoft.com/en-us/magazine/cc163340.aspx

    Using the library, you can conveniently express potential parallelism
    in existing sequential code, where the exposed parallel tasks will be
    run concurrently on all available processors.

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

Sidebar

Related Questions

My question centers on some Parallel.ForEach code that used to work without fail, and
I am using Parallel.ForEach on WCF service that hosted in IIS . As far
Simple question :) How can I reduce build time using a parallel build /
I recently posted a question using a lambda function and in a reply someone
Quick question about using IQueryable objects. Can I do something like that and if
I asked a related question here and the response worked well: using parallel's parLapply:
I may be asking the wrong question here, and I'm open to that, so
I have an IronPython script that uses the TPL and Parallel.ForEach to process files
I have several loops that I wrote using the traditional syntax foreach(x in xs)
I am working on an MVVM app that performs several tasks in the background,

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.