What is the difference between task and thread?

后端 未结 8 1601
庸人自扰
庸人自扰 2020-11-22 02:45

In C# 4.0, we have Task in the System.Threading.Tasks namespace. What is the true difference between Thread and Task. I did s

8条回答
  •  遇见更好的自我
    2020-11-22 03:15

    A task is something you want done.

    A thread is one of the many possible workers which performs that task.

    In .NET 4.0 terms, a Task represents an asynchronous operation. Thread(s) are used to complete that operation by breaking the work up into chunks and assigning to separate threads.

提交回复
热议问题