دانلود کتاب Concurrency in C# Cookbook برای سیشارپ_فرمت PDF
پنجشنبه, ۱۵ مهر ۱۳۹۵، ۰۵:۲۷ ق.ظ
gameover.blog.ir
همزمانی در سیشارپ(سطح:حرفه ای)
لینک دانلود:http://s9.picofile.com/file/8269827342/Concurrency_in_C_Cookbook.rar.html
سرفصل ها(فهرست)
1. Concurrency: An Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1. Introduction to Concurrency 1
1.2. Introduction to Asynchronous Programming 3
1.3. Introduction to Parallel Programming 7
1.4. Introduction to Reactive Programming (Rx) 10
1.5. Introduction to Dataflows 12
1.6. Introduction to Multithreaded Programming 14
1.7. Collections for Concurrent Applications 15
1.8. Modern Design 15
1.9. Summary of Key Technologies 15
2. Async Basics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.1. Pausing for a Period of Time 18
2.2. Returning Completed Tasks 20
2.3. Reporting Progress 21
2.4. Waiting for a Set of Tasks to Complete 22
2.5. Waiting for Any Task to Complete 25
2.6. Processing Tasks as They Complete 26
2.7. Avoiding Context for Continuations 30
2.8. Handling Exceptions from async Task Methods 31
2.9. Handling Exceptions from async Void Methods 32
3. Parallel Basics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
3.1. Parallel Processing of Data 35
3.2. Parallel Aggregation 37
3.3. Parallel Invocation 39
3.4. Dynamic Parallelism 40
iii
3.5. Parallel LINQ 42
4. Dataflow Basics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
4.1. Linking Blocks 46
4.2. Propagating Errors 47
4.3. Unlinking Blocks 49
4.4. Throttling Blocks 50
4.5. Parallel Processing with Dataflow Blocks 51
4.6. Creating Custom Blocks 52
5. Rx Basics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
5.1. Converting .NET Events 56
5.2. Sending Notifications to a Context 58
5.3. Grouping Event Data with Windows and Buffers 60
5.4. Taming Event Streams with Throttling and Sampling 62
5.5. Timeouts 64
6. Testing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
6.1. Unit Testing async Methods 68
6.2. Unit Testing async Methods Expected to Fail 69
6.3. Unit Testing async void Methods 71
6.4. Unit Testing Dataflow Meshes 72
6.5. Unit Testing Rx Observables 74
6.6. Unit Testing Rx Observables with Faked Scheduling 76
7. Interop. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
7.1. Async Wrappers for “Async” Methods with “Completed” Events 81
7.2. Async Wrappers for “Begin/End” methods 83
7.3. Async Wrappers for Anything 84
7.4. Async Wrappers for Parallel Code 86
7.5. Async Wrappers for Rx Observables 87
7.6. Rx Observable Wrappers for async Code 88
7.7. Rx Observables and Dataflow Meshes 90
8. Collections. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
8.1. Immutable Stacks and Queues 96
8.2. Immutable Lists 98
8.3. Immutable Sets 100
8.4. Immutable Dictionaries 102
8.5. Threadsafe Dictionaries 104
8.6. Blocking Queues 106
8.7. Blocking Stacks and Bags 108
8.8. Asynchronous Queues 110
iv | Table of Contents
1.1. Introduction to Concurrency 1
1.2. Introduction to Asynchronous Programming 3
1.3. Introduction to Parallel Programming 7
1.4. Introduction to Reactive Programming (Rx) 10
1.5. Introduction to Dataflows 12
1.6. Introduction to Multithreaded Programming 14
1.7. Collections for Concurrent Applications 15
1.8. Modern Design 15
1.9. Summary of Key Technologies 15
2. Async Basics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.1. Pausing for a Period of Time 18
2.2. Returning Completed Tasks 20
2.3. Reporting Progress 21
2.4. Waiting for a Set of Tasks to Complete 22
2.5. Waiting for Any Task to Complete 25
2.6. Processing Tasks as They Complete 26
2.7. Avoiding Context for Continuations 30
2.8. Handling Exceptions from async Task Methods 31
2.9. Handling Exceptions from async Void Methods 32
3. Parallel Basics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
3.1. Parallel Processing of Data 35
3.2. Parallel Aggregation 37
3.3. Parallel Invocation 39
3.4. Dynamic Parallelism 40
iii
3.5. Parallel LINQ 42
4. Dataflow Basics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
4.1. Linking Blocks 46
4.2. Propagating Errors 47
4.3. Unlinking Blocks 49
4.4. Throttling Blocks 50
4.5. Parallel Processing with Dataflow Blocks 51
4.6. Creating Custom Blocks 52
5. Rx Basics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
5.1. Converting .NET Events 56
5.2. Sending Notifications to a Context 58
5.3. Grouping Event Data with Windows and Buffers 60
5.4. Taming Event Streams with Throttling and Sampling 62
5.5. Timeouts 64
6. Testing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
6.1. Unit Testing async Methods 68
6.2. Unit Testing async Methods Expected to Fail 69
6.3. Unit Testing async void Methods 71
6.4. Unit Testing Dataflow Meshes 72
6.5. Unit Testing Rx Observables 74
6.6. Unit Testing Rx Observables with Faked Scheduling 76
7. Interop. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
7.1. Async Wrappers for “Async” Methods with “Completed” Events 81
7.2. Async Wrappers for “Begin/End” methods 83
7.3. Async Wrappers for Anything 84
7.4. Async Wrappers for Parallel Code 86
7.5. Async Wrappers for Rx Observables 87
7.6. Rx Observable Wrappers for async Code 88
7.7. Rx Observables and Dataflow Meshes 90
8. Collections. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
8.1. Immutable Stacks and Queues 96
8.2. Immutable Lists 98
8.3. Immutable Sets 100
8.4. Immutable Dictionaries 102
8.5. Threadsafe Dictionaries 104
8.6. Blocking Queues 106
8.7. Blocking Stacks and Bags 108
8.8. Asynchronous Queues 110
iv | Table of Contents
۹۵/۰۷/۱۵