Mastering C# concurrency create robust and scalable applications, along with responsive UI, using concurrency and the multi-threading infrastructure in.NET and C#
Create robust and scalable applications along with responsive UI using concurrency and the multi-threading infrastructure in .NET and C# About This Book Learn to combine your asynchronous operations with Task Parallel Library Master C#'s asynchronous infrastructure and use asynchronous APIs eff...
Otros Autores: | , |
---|---|
Formato: | Libro electrónico |
Idioma: | Inglés |
Publicado: |
Birmingham :
Packt Publishing
2015.
|
Edición: | 1st edition |
Colección: | Packt enterprise.
|
Materias: | |
Ver en Biblioteca Universitat Ramon Llull: | https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009630021206719 |
Tabla de Contenidos:
- Cover ; Copyright; Credits; About the Authors; About the Reviewers; www.PacktPub.com; Table of Contents; Preface; Chapter 1: Traditional Concurrency; What's the problem?; Using locks; Lock statement; Monitor class; Reader-writer lock; Spin lock; Thread.SpinWait; System.Threading.SpinWait; System.Threading.SpinLock; Optimization strategy; Lock localization; Shared data minimization; Summary; Chapter 2: Lock-free Concurrency; Memory model and compiler optimizations; The System.Threading.Interlocked class; Interlocked internals; Writing lock-free code; The ABA problem; The lock-free stack
- The lock-free queueSummary; Chapter 3: Understanding Parallelism Granularity; The number of threads; Using the thread pool; Understanding granularity; Choosing the coarse-grained or fine-grained approach; Summary; Chapter 4: Task Parallel Library in Depth; Task composition; Tasks hierarchy; Awaiting task completion; Task cancellation; Checking a flag; Throwing an exception; Using OS wait objects with WaitHandle; Cancellation using callbacks; Latency and the coarse-grained approach with TPL; Exception handling; Using the Parallel class; Parallel.Invoke; Parallel.For and Parallel.Foreach
- Understanding the task schedulerSummary; Chapter 5: C# Language Support for Asynchrony; Implementing the downloading of images from Bing; Creating a simple synchronous solution; Creating a parallel solution with Task Parallel Library; Enhancing the code with C# 5.0 built-in support for asynchrony; Simulating C# asynchronous infrastructure with iterators; Is the async keyword really needed?; Fire-and-forget tasks; Other useful TPL features; Task.Delay; Task.Yield; Implementing a custom awaitable type; Summary; Chapter 6: Using Concurrent Data Structures
- Standard collections and synchronization primitivesImplementing a cache with ReaderWriterLockSlim; Concurrent collections in .NET; ConcurrentDictionary; Using Lazy; Implementation details; Lock-free operations; Fine-grained lock operations; Exclusive lock operations; Using the implementation details in practice; ConcurrentBag; ConcurrentBag in practice; ConcurrentQueue; ConcurrentStack; The Producer/Consumer pattern; Custom Producer/Consumer pattern implementation; The Producer/Consumer pattern in .NET 4.0+; Summary; Chapter 7: Leveraging Parallel Patterns; Concurrent idioms
- Process Tasks in Completion OrderLimiting the parallelism degree; Setting a task timeout; Asynchronous patterns; Asynchronous Programming Model; Event-based Asynchronous Pattern; Task-based Asynchronous Pattern; Concurrent patterns; Parallel pipelines; Summary; 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; Summary; Chapter 9: Concurrency in the User Interface
- The importance of asynchrony for UI