Click here to Skip to main content
11,502,348 members (63,660 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0
Hi

Please tell me what's the difference between Thread , Asynchronous Programming and Parallel.

Programming in c#.

Thank you
Posted 29-Sep-12 23:19pm
Edited 30-Sep-12 9:48am
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

The .NET Framework provides several ways for you to use multiple threads of execution to keep your application responsive to your user while maximizing the performance of your user's computer.

Parallel programming model is to Parallelize your code to distribute work across multiple processors WHEREAS In an asynchronous process, the application can continue with other work that doesn't depend on the web resource until the potentially blocking task finishes.

Refer here for details: MSDN: Parallel Processing and Concurrency in the .NET Framework[^]
  Permalink  
Comments
Naerling at 30-Sep-12 5:49am
   
Good answer and nice link, my 5.
Sandeep Mewara at 30-Sep-12 5:50am
   
Ah. Thanks Naerling. :)
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

A Thread is a means to Async and Parallel programming. The real question is what is the difference between Async and Parallel programming.
Here's a blog[^] that explains it pretty well.
Here's the short of it:
Both Async and Parallel programming are methods to run code without blocking your UI (or main) thread
When you're programming Async you execute code on a different thread which prevents the UI from becoming unresponsive.
When you're doing Parallel programming you're doing multiple things at the same time. For example, you want to read all the files in a single folder on your file system. You could spawn a new thread for each file, which is theoretically faster than reading one file after another.
To illustrate the difference, in Async programming you could have the files being read one after another (so not parallel), but still do this on a different thread, so your UI stays responsive.
Also notice that the two are not mutually exclusive. You could spawn a thread to read the files (Async) and then read an x amount of files at the same time (Parallel).
I hope that clears things up for you Smile | :)
  Permalink  
Comments
Sandeep Mewara at 30-Sep-12 5:50am
   
Good answer. My 5! :)
Naerling at 30-Sep-12 5:52am
   
Thank you :)
Sergey Alexandrovich Kryukov at 30-Sep-12 10:49am
   
My 5. "The real question is" is a write approach. The OP's question is like "what's the difference between "Titanic" and "navigation"", not answerable. I tried to explain it in my answer, please see.
--SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

You need to solve completely different problem first. This is about your skills to ask correct question. This question is totally incorrect. I feel awkward to explain such elementary things, but please look at my past answer:
what is the difference between the class and encapsulation in programming[^].

Please see also this discussion:
How to ask a good question?[^].

Did you follow these directions for asking questions?

Code Project Questions and Answers FAQ[^]
How to Use Google and Other Tips for Finding Programming Help[^]
Some guidelines for posting questions in the forums[^].

Please, read them before you proceed.

—SA
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web04 | 2.8.150520.1 | Last Updated 30 Sep 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100