C#任务是否在一个内核上运行? [英] Does a C# Task run on one core?

查看:90
本文介绍了C#任务是否在一个内核上运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

C#任务是否在一个内核上运行?

Does a C# Task run on one core?

我有一个项目,需要确定要创建多少个任务. 我需要创建尽可能多的计算机. 那是处理器,核心或逻辑处理器的数量吗? 混淆了这三个选项.

I have a project where I need to decide how many Tasks to create. I need to create as many, as the computer can take. Is that the number of processors, cores, or logical processors, I am confused between the three options.

推荐答案

任务在线程上执行.操作系统将线程调度到内核.内核是一个逻辑概念,与物理CPU芯片不同.

A task executes on a thread. The OS schedules threads to cores. Cores are a logical concept and different from physical CPU chips.

创建Environment.ProcessorCount任务,或者更好地使用PLINQ或Parallel之类的更高级别的TPL构造之一.

Create Environment.ProcessorCount tasks, or better use one of the higher level TPL constructs like PLINQ or Parallel .

这篇关于C#任务是否在一个内核上运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆