
PFX(Parallel Framework) and Traditional Multithreading
发布日期:2025-05-02 01:11:16
浏览次数:2
分类:技术文章
本文共 1162 字,大约阅读时间需要 3 分钟。
A traditional multithreading scenario is one where multithreading can be of benefit even on a single-core machine—with no true parallelization taking place. We covered these in the previous chapter: they include such tasks as maintaining a responsive user interface and downloading two web pages at once.
Some of the constructs that we’ll cover in this chapter are also sometimes useful in traditional multithreading. In particular:
• PLINQ and the Parallel class are useful whenever you want to execute operations in parallel and then wait for them to complete (structured parallelism).This includes non-CPU-intensive tasks such as calling a web service.
• The task parallelism constructs are useful when you want to run some operation on a pooled thread (we introduced this in the previous chapter), and also to manage a task’s workflow through continuations and parent/child
tasks.
• The concurrent collections are sometimes appropriate when you want a thread-safe queue, stack, or dictionary.
• BlockingCollection provides an easy means to implement producer/consumer structures.
本文转自cnn23711151CTO博客,原文链接:http://blog.51cto.com/cnn237111/541331 ,如需转载请自行联系原作者
发表评论
最新留言
很好
[***.229.124.182]2025年04月10日 07时05分05秒
关于作者

喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!