Linked Questions
48 questions linked to/from Task vs Thread differences
447
votes
8
answers
293k
views
What is the difference between task and thread?
In C# 4.0, we have Task in the System.Threading.Tasks namespace. What is the true difference between Thread and Task. I did some sample program(help taken from MSDN) for my own sake of learning with
...
2
votes
1
answer
269
views
Does code in a .NET Task ultimately run on a CPU or CPU Core via native Windows Thread? [duplicate]
Referring to the following post, which leads one to believe a .NET Task executes without native OS threads being involved. Is this true?
Difference between Task (System.Threading.Task) and Thread
...
0
votes
1
answer
197
views
Is it better to use Threads for very small operations, or tasks are always preferred? [duplicate]
I've been tinkering through some stuff, and this code sample made me wonder - should I implement the StopCalculation method with a Task, or the way it's been done is perfectly okay, and actually ...
0
votes
0
answers
85
views
Which is more efficient: Thread or Task if I don't need a result value? [duplicate]
I'm starting new thread for every different job. I think it is better way. But with my coworker we have some conflict about using thread or task. He think Task is more efficient. But there is no ...
91
votes
4
answers
42k
views
When to use TaskCreationOptions.LongRunning?
I've wondered this for quite a while, but never really found the answer.
I understand that it's a hint for the task scheduler where the task will run on, and that the task scheduler can (or nowadays ...
3
votes
3
answers
20k
views
Update progress bar in another form while task is running
**Ultimately I am going to have four tasks running concurrently and have another form that contains four progress bars. I would like for each progress bar to update as it's work task is completing.
...
4
votes
5
answers
5k
views
Threading: Application Freezes after using Thread.Join()
I understand that the .Join() causes the threads to pause and wait till a thread finishes its work but how can I avoid the UI from getting frozen? This is what my codes look like"
Thread dataThread = ...
1
vote
4
answers
10k
views
TPL vs Multithreading
I am new to threading and I need a clarification for the below scenario.
I am working on apple push notification services. My application demands to send notifications to 30k users when a new deal is ...
2
votes
3
answers
9k
views
C# Webservice: Webmethod, that calls an async method, returns Taskoff object
I'm a total beginner with webservices and I ran in
the following problem, which is about a webservice and asynchronous logging. (c#)
Problem Description
I have a webservice that returns some data to ...
10
votes
1
answer
4k
views
How can I achieve maximum parallelism and utilize maximum CPU with Parallel.ForEach?
There is a C# function A(arg1, arg2) which needs to be called lots of times. To do this fastest, I am using parallel programming.
Take the example of the following code:
long totalCalls = 2000000;
...
2
votes
2
answers
2k
views
Is there any point to using Task Parallel Library
I have a quad core PC.
I had considered programmatically of uterlising multi-core processing using the Task Parallel Library. However, when I Googled for examples I was informed that the CPU will ...
2
votes
3
answers
2k
views
async Task - What actually happens on the CPU?
I've been reading about Tasks after asking this question and seeing that I completely misunderstood the concept. Answers such as the top answers here and here explain the idea, but I still don't get ...
5
votes
2
answers
347
views
F# task parallelism under Mono doesn't "appear" to execute in parallel
I have the following dummy code to test out TPL in F#. (Mono 4.5, Xamarin studio, quad core MacBook Pro)
To my surprise, all the processes are done on the same thread. There is no parallelism at all.
...
-3
votes
4
answers
1k
views
Are method call statements executed synchronously, in the order in which they are written? [closed]
For example:
void Function1()
{
Function2();
Function3();
}
Will Function3 be guaranteed to wait until Function2 is done processing each and every time Function1 is called?
1
vote
1
answer
2k
views
Task or Threads c# [duplicate]
I have two scenarios and I am not sure whether to use Tasks or Threads (working with dot net Framework 4.7)
Scenario 1: Database Queries
I have a set of data base queries that I execute with ...