Concurrent Patterns and Best Practices : Build Scalable Apps with Patterns in Multithreading, Synchronization, and Functional Programming 🔍
Atul S. Khot Packt Publishing, Limited, Packt Publishing, Birmingham, 2018
英语 [en] · PDF · 6.4MB · 2018 · 📘 非小说类图书 · 🚀/lgli/lgrs · Save
描述
A definitive guide to mastering and implementing concurrency patterns in your applications
Key Features Build scalable apps with patterns in multithreading, synchronization, and functional programming Explore the parallel programming and multithreading techniques to make the code run faster Efficiently use the techniques outlined to build reliable applications Book Description Selecting the correct concurrency architecture has a significant impact on the design and performance of your applications. This book explains how to leverage the different characteristics of parallel architecture to make your code faster and more efficient.
To start with, you'll understand the basic concurrency concepts and explore patterns around explicit locking, lock free programming, futures & actors. Then, you'll get insights into different concurrency models and parallel algorithms and put them to practice in different scenarios to realize your application's true potential. We'll take you through multithreading design patterns, such as master, slave, leader, follower, map-reduce, and monitor, also helping you to learn hands-on coding using these patterns.
Once you've grasped all of this, you'll move on to solving problems using synchronizer patterns. You'll discover the rationale for these patterns in distributed & parallel applications, followed by studying how future composition, immutability and the monadic flow help create more robust code.
Toward the end of the book, you'll learn about the actor paradigm and actor patterns - the message passing concurrency paradigm.
What you will learn Explore parallel architecture Get acquainted with concurrency models Internalize design themes by implementing multithreading patterns Get insights into concurrent design patterns Discover design principles behind many java threading abstractions Work with functional concurrency patterns Who this book is for This is a must-have guide for developers who want to learn patterns to build scalable and high-performing apps. It's assumed that you already have a decent level of programming knowledge.
Table of Contents Concurrency - a kick start introduction A taste of some concurrency patterns More threading patterns Thread Pools Increasing the Concurrency Functional Concurrency Patterns Actor Patterns
备用文件名
lgrsnf/Khot A.S. Concurrent Patterns and Best Practices (Packt, 2018)(ISBN 9781788627900)(O)(258s)_CsCd_.pdf
备选作者
Khot, Atul S.
备用版本
United Kingdom and Ireland, United Kingdom
备用版本
Place of publication not identified, 2018
备用版本
Birgmingham, UK, 2018
备用版本
2018-09-27
备用描述
Cover
Title Page
Copyright and Credits
Packt Upsell
Contributors
Table of Contents
Preface
Chapter 1: Concurrency – An Introduction
Concurrency in a breeze
The push for concurrency
The MapReduce pattern
Fault tolerance
Time sharing
Two models for concurrent programming
The message passing model
Coordination and communication
Flow control
Divide and conquer
The concept of state
The shared memory and shared state model
Threads interleaving – the need for synchronization
Race conditions and heisenbugs
Correct memory visibility and happens-before
Sharing, blocking, and fairness
Asynchronous versus synchronous executions
Java's nonblocking I/O
Of patterns and paradigms
Event-driven architecture
Reactive programming
The actor paradigm
Message brokers
Software transactional memory
Parallel collections
Summary
Chapter 2: A Taste of Some Concurrency Patterns
A thread and its context
Race conditions
The monitor pattern
Thread safety, correctness, and invariants
Sequential consistency
Visibility and final fields
Double-checked locking
Safe publication
Initializing a demand holder pattern
Explicit locking
The hand-over-hand pattern
Observations – is it correct?
The producer/consumer pattern
Spurious and lost wake-ups
Comparing and swapping
Summary
Chapter 3: More Threading Patterns
A bounded buffer
Strategy pattern – client polls
Strategy – taking over the polling and sleeping
Strategy – using condition variables
Reader or writer locks
A reader-friendly RW lock
A fair lock
Counting semaphores
Our own reentrant lock
Countdown latch
Implementing the countdown latch
A cyclic barrier
A future task
Summary
Chapter 4: Thread Pools
Thread pools
The command design pattern
Counting words
Another version
The blocking queue
Thread interruption semantics
The fork-join pool
Egrep – simple version
Why use a recursive task?
Task parallelism
Quicksort – using fork-join
The ForkJoinQuicksortTask class
The copy-on-write theme
In-place sorting
The map-reduce theme
Work stealing
Active objects
Hiding and adapting
Using a proxy
Summary
Chapter 5: Increasing the Concurrency
A lock-free stack
Atomic references
The stack implementation
A lock-free FIFO queue
How the flow works
A lock-free queue
Going lock-free
The enque(v) method
The deq() method
Concurrent execution of the enque and deque methods
The ABA problem
Thread locals
Pooling the free nodes
The atomic stamped reference
Concurrent hashing
The add(v) method
The need to resize
The contains(v) method
The big lock approach
The resizing strategy
The lock striping design pattern
Summary
Chapter 6: Functional Concurrency Patterns
Immutability
Unmodifiable wrappers
Persistent data structures
Recursion and immutability
Futures
The apply method
by-name parameters
Future – thread mapping
Futures are asynchronous
Blocking is bad
Functional composition
Summary
Chapter 7: Actors Patterns
Message driven concurrency
What is an actor?
Let it crash
Location transparency
Actors are featherlight
State encapsulation
Where is the parallelism?
Unhandled messages
The become pattern
Making the state immutable
Let it crash - and recover
Actor communication – the ask pattern
Actors talking with each another
Actor communication – the tell pattern
The pipeTo pattern
Summary
Other Books You May Enjoy
Index
备用描述
A definitive guide to mastering and implementing concurrency patterns in your applications Key Features Build scalable apps with patterns in multithreading, synchronization, and functional programming Explore the parallel programming and multithreading techniques to make the code run faster Efficiently use the techniques outlined to build reliable applications Book Description Selecting the correct concurrency architecture has a significant impact on the design and performance of your applications. This book explains how to leverage the different characteristics of parallel architecture to make your code faster and more efficient. To start with, you'll understand the basic concurrency concepts and explore patterns around explicit locking, lock free programming, futures and actors. Then, you'll get insights into different concurrency models and parallel algorithms and put them to practice in different scenarios to realize your application's true potential. We'll take you through multithreading design patterns, such as master, slave, leader, follower, map-reduce, and monitor, also helping you to learn hands-on coding using these patterns. Once you've grasped all of this, you'll move on to solving problems using synchronizer patterns. You'll discover the rationale for these patterns in distributed and parallel applications, followed by studying how future composition, immutability and the monadic flow help create more robust code. Toward the end of the book, you'll learn about the actor paradigm and actor patterns - the message passing concurrency paradigm. What you will learn Explore parallel architecture Get acquainted with concurrency models Internalize design themes by implementing multithreading patterns Get insights into concurrent design patterns Discover design principles behind many java threading abstractions Work with functional concurrency patterns Who this book is for This is a must-have guide for developers who want to learn patterns to build scalable and high-performing apps. It's assumed that you already have a decent level of programming knowledge. Downloading the example code for this book You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you
备用描述
Selecting the correct concurrency architecture has a significant impact on the design and performance of your applications. Concurrency and parallelism are synonymous to performance and high-end scalability, and this book equips you with all the tools and techniques necessary to achieve those.
开源日期
2025-02-02
更多信息……

🚀 快速下载

成为会员以支持书籍、论文等的长期保存。为了感谢您对我们的支持,您将获得高速下载权益。❤️
如果您在本月捐款,您将获得双倍的快速下载次数。

🐢 低速下载

由可信的合作方提供。 更多信息请参见常见问题解答。 (可能需要验证浏览器——无限次下载!)

所有选项下载的文件都相同,应该可以安全使用。即使这样,从互联网下载文件时始终要小心。例如,确保您的设备更新及时。
  • 对于大文件,我们建议使用下载管理器以防止中断。
    推荐的下载管理器:JDownloader
  • 您将需要一个电子书或 PDF 阅读器来打开文件,具体取决于文件格式。
    推荐的电子书阅读器:Anna的档案在线查看器ReadEraCalibre
  • 使用在线工具进行格式转换。
    推荐的转换工具:CloudConvertPrintFriendly
  • 您可以将 PDF 和 EPUB 文件发送到您的 Kindle 或 Kobo 电子阅读器。
    推荐的工具:亚马逊的“发送到 Kindle”djazz 的“发送到 Kobo/Kindle”
  • 支持作者和图书馆
    ✍️ 如果您喜欢这个并且能够负担得起,请考虑购买原版,或直接支持作者。
    📚 如果您当地的图书馆有这本书,请考虑在那里免费借阅。