Parallel Programming with Microsoft.NET.pdf

所需积分/C币:7 2012-05-16 21:30:58 3.74MB PDF

Parallel Programming with Microsoft.NET
Parallel Programming with microsoft net Design Patterns for Decomposition and Coordination on multicore architectures Colin Campbell Ralph johnson Ade miller Stephen Toub N9780735640603 This document is provided"as-is "Information and views expressed in this document, including URL and other Internet website references, may change without notice. You bear the risk of using it. Unless otherwise noted, the people, places, and events depicted in examples herein are fictitious. NO companies, organizations, products, domain names, email addresses, logo association with any real company, organization, product, domain name, email address, logo, person, place, or event is intended or should be inferred Complying with all applicable copyright laws is the responsibility of the user ithout limiting the rights under copyright, no part of this document may be reproduced stored in or introduced into a retrieval system or transmitted in form or by any means(electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents trademarks, copyrights, or other intellectual property O 2010 Microsoft Corporation. All rights reserved Microsoft. msdn. visual basic. visual c. visual studio. Windows Windows Live. Windows Server, and Windows Vista are trademarks of the microsoft group of companies All other trademarks are property of their respective owners Contents Foreword Tony Hey Preface Who This book is for Why This Book Is Pertinent Now What You need to use the code How to Use this book Introduction XVI Parallelism with Control Dependencies Only XVI Parallelism with Control and Data Dependencies XVI Dynamic Task Parallelism and Pipelines Supporting Material What is not covered Goals Acknowledgments 1 Introduction The Importance of potential Parallelism Decomposition, Coordination, and Scalable Sharing Understand ing Coordinating Tasks Scalable Sharing of Data Design Approaches 6 Selecting the Right Pattern A Word About Terminology The Limits of parallelism A Few Tips 10 Exercises 11 For more information 11 2 Parallel Loops 13 The basic 14 Parallel for Loops 14 Parallel for each 15 Parallel LiNQ (PLinQ) 16 What to Expect 1 A n上 xample 18 Sequential Credit Review Example 19 Credit Review Example Using Parallel. for each 19 Credit Review Example with PLINQ 20 Performance Comparison 21 Variations 21 Breaking Out of Loops Early 21 Parallel break 21 Parallel Stop 23 External Loop cancellation 24 Exception handlin pecial Handling of Small Loop bodies 26 Controlling the Degree of Parallelism 28 Using Task-Local State in a Loop Bod 29 Using a custom Task Scheduler For a Parallel Loop 31 Anti-Patterns 32 Step Size Other than One 32 Hidden Loop Body Dependencies 32 Small Loop Bodies with Few Iterations 32 Processor Oversubscription And Undersubscription 33 Mixing the Parallel Class and PLINQ Duplicates in the input enumeration 34 Design Notes 34 Adaptive Partitioning 34 Adaptive Concurrency 34 Support for Nested Loops and Server Applications 35 Related patterns 35 Exercise 35 Further Reading 37 Parallel tasks 39 The basics 40 An Example 41 Variations 43 Canceling a Task 43 Handling exceptions 44 Ways to Observe an Unhandled Task Exception 45 Aggregate Exceptions 45 The handle method 46 The flatten method 47 Waiting for the First Task to Complete 48 Speculative Execution 49 Creating Tasks with Custom Schedul 8 50 Anti-Patterns 51 'ariables Captured by closures 51 Disposing a resource needed by a task 52 Avoid thread abort 53 Design Notes 53 Tasks and threads 53 Task Life cycle 53 Writing a Custom Task Scheduler 54 Unobserved Task Exceptions 55 Relationship between Data Parallelism and task parallelism 56 The Default task scheduler 56 he thread poo 57 Decentralized Scheduling techniques 58 Work Stealing 59 Top-Level Tasks in the Global Queue 60 Subtasks in a local Queu 60 Inlined Execution of subtasks 60 hread Injection 61 Bypassing the Thread Pool B E excises 64 Further reading 65 4 Parallel Aggregation 67 The basics 68 An Example 69 Variations 73 Using Parallel Loops for Aggregation 73 Using A Range Partitioner for Aggregation 76 Using PLINQ Aggregation with Range Selection Design Notes 80 Related Patterns 82 Exercises 82 Further Reading 83 Futures 85 The bas 86 Futures 86 Continuation tasks 88 Example: The Adatum Financial Dashboard 89 The business objec 91 The analysis engine 92 odin 8 External data 95 rging 95 ormalizin 96 Anal d Model creatio 96 Processing hi 8 torical data 96 Comparing Models 96 View and view model 97 Variations 97 Canceling futures and Continuation Tasks 97 Continue When"At Least One Antecedent completes 97 Using. Net Asynchronous Calls with Futures 97 Removing bottlenecks 98 Modifying the Graph at Run Time 98 D esign N 99 Decomposition into Futures And Continuation tasks 99 Functional Style 99 Related patterns 100 Pipeline pattern 100 Master/Worker pattern 100 Dynamic Task Parallelism Pattern 100 e Event patter 100 Exercises 101 Further Reading 101 6 Dynamic Task Parallelism 103 The basic 103 An Example 105 Variations 107 While-Not-Empty 107 Task Chaining with Parent/Child Tasks 108 Design Notes 109 Exercises 110 Further Reading 110 7 Pipelines 113 The basics 113 An example 117 Sequential Image Processing 117 he Image pipeline 119 Performance characteristics 120 Variations 122 Canceling a pipeline 122 Handling Pipeline Exceptions 124 Load Balancing Using Multiple Producers 126 Pipelines and Streams 129 Asynchronous Pipelines 129 Anti-Patterns 129 Thread starvation 129 Infinite Blocking Collection Waits 130 Forgetting Get Consuming Enumerable 130 Using Other Producer/Consumer Collections 130 Design notes 131 Related Patterns 131 Exercises 132 Further Reading 132 Appendices A Adapting Object-Oriented Patterns 133 Structural patterns 133 Facade 134 Examp le 134 Guidelines 134 Decorators 134 Example 135 Guidelines 136 Adapters 136 Examp le 137 Guidelines 138 Repositories and Parallel Data Access 138 Example 139 Guidelines 139 Singletons and Service Locators 139 Implementing a Singleton with the Lazy<T> class 140 Notes 141 Guidelines 141

...展开详情

评论 下载该资源后可以进行评论 14

CyberLogic 不错,好东西,就是有点老了
2020-05-18
回复
Peter Yelnav 浅显易懂,pdf质量很好
2018-05-11
回复
yuelianghexingxing 不错的书 学习了 值得下载
2017-03-29
回复
uephee 找这本PDF不容易啊!
2017-03-29
回复
zxqwert1983 很不错,感谢分享,很值得一看。翻译成中文
2016-09-21
回复
img
gengmingchina

关注 私信 TA的资源

上传资源赚积分,得勋章
相关内容推荐