更新时间:2021-07-09 21:26:23
coverpage
Mastering C# Concurrency
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Support files eBooks discount offers and more
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Chapter 1. Traditional Concurrency
What's the problem?
Using locks
Reader-writer lock
Spin lock
Optimization strategy
Summary
Chapter 2. Lock-Free Concurrency
Memory model and compiler optimizations
The System.Threading.Interlocked class
Interlocked internals
Writing lock-free code
Chapter 3. Understanding Parallelism Granularity
The number of threads
Using the thread pool
Understanding granularity
Choosing the coarse-grained or fine-grained approach
Chapter 4. Task Parallel Library in Depth
Task composition
Tasks hierarchy
Awaiting task completion
Task cancellation
Latency and the coarse-grained approach with TPL
Exception handling
Using the Parallel class
Chapter 5. C# Language Support for Asynchrony
Implementing the downloading of images from Bing
Is the async keyword really needed?
Fire-and-forget tasks
Other useful TPL features
Implementing a custom awaitable type
Chapter 6. Using Concurrent Data Structures
Standard collections and synchronization primitives
Implementing a cache with ReaderWriterLockSlim
Concurrent collections in .NET
ConcurrentDictionary
ConcurrentBag<T>
ConcurrentQueue<T>
ConcurrentStack<T>
The Producer/Consumer pattern
The Producer/Consumer pattern in .NET 4.0+
Chapter 7. Leveraging Parallel Patterns
Concurrent idioms
Asynchronous patterns
Concurrent patterns
Chapter 8. Server-side Asynchrony
Server applications
The OWIN Web API framework
Load testing and scalability
I/O and CPU-bound tasks
Deep dive into asynchronous I/O
Real and fake asynchronous I/O operations
Synchronization context
CPU-bound tasks and queues
Chapter 9. Concurrency in the User Interface
The importance of asynchrony for UI
UI threads and message loops
Common problems and solutions
How the await keyword works
Performance issues
Chapter 10. Troubleshooting Parallel Programs
How troubleshooting parallel programs is different
Writing tests
Integration tests
Debugging
Performance measurement and profiling
Index