(如何)是否使用第三方物流(CLR)线程池? [英] (How) Does TPL use (CLR) Thread Pool?

查看:145
本文介绍了(如何)是否使用第三方物流(CLR)线程池?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在研究任务并行库和我读的地方,太平人寿实际使用的CLR级的线程池机制。我找不到任何物品,确认该信息。我知道,太平人寿已为每个线程任务队列,并使用一些特殊的工作窃取算法平衡。据我所知,它创建一个线程每个处理器。线程池开始使用第三方物流的任务,对象,因为.NET 4

I am currently researching Task Parallel Library and I read somewhere that TPL actually uses thread pool mechanism from CLR-Level. I couldn't find any article confirming this information. I know, TPL has task queues for each thread and uses some special work-stealing algorithm for balancing. As far as I know, it creates one thread for each processor. Thread pools started to use task objects of TPL since .NET 4.

我不明白TPL如何使用线程池。线程池模式状态,工作项进行排队,并在线程池中的可用线程需要一个从这个队列。然而TPL存储项目(任务)线程和工作窃取作品如果需要的话......因此,完全不同的队列。哪里是我的错?

I can not understand how TPL uses the thread pool. Thread-Pool pattern states, the work items are queued and the free threads in thread pool takes one from this queue. TPL however store the items (tasks) to queues of threads and work-stealing works if needed... Thus, quite differently. Where is my mistake?

额外的问题:因为这是我的第一个堆栈溢出的问题,我不知道这是否是合适的。是吗?

extra question: As this was my first Stack Overflow question, I am not sure if it was suitable. Is it?

推荐答案

在TPL,一个 的TaskScheduler 负责实际排队的任务,以便执行。该<一href="http://msdn.microsoft.com/en-us/library/system.threading.tasks.taskscheduler.default.aspx">Default调度程序将使用线程池 - 但我相信这是新的线程池实现,它实际上做的工作窃取聪明

In TPL, a TaskScheduler is responsible for actually queuing the tasks up for execution. The Default scheduler will use the thread-pool - but I believe it's the new thread pool implementation which actually does the work-stealing cleverness.

丹尼尔蛾具有博客文章与一些细节,你会发现有用的。

Daniel Moth has a blog post with some more details which you may find useful.

这篇关于(如何)是否使用第三方物流(CLR)线程池?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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