As discussed in Chapter 2, Concurrency on the JVM and the Java Memory Model, although creating a new thread in a Scala program takes orders of magnitude less computational time compared to creating a new JVM process, thread creation is still much more expensive than allocating a single object, acquiring a monitor lock, or updating an entry in a collection. If an application performs a large number of small concurrent tasks and requires high throughput, we cannot afford to create a fresh thread for each of these tasks. Starting a thread requires us to allocate a memory region for its call stack and a context switch from one thread to another, which can be much more time consuming than the amount of work in the concurrent task. For this reason, most concurrency frameworks have facilities that maintain a set of threads in a waiting state and start running when concurrently executable work tasks become available. Generally, we call such facilities thread...

Learning Concurrent Programming in Scala
By :

Learning Concurrent Programming in Scala
By:
Overview of this book
Table of Contents (18 chapters)
Learning Concurrent Programming in Scala
Credits
Foreword
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Introduction
Concurrency on the JVM and the Java Memory Model
Traditional Building Blocks of Concurrency
Asynchronous Programming with Futures and Promises
Data-Parallel Collections
Concurrent Programming with Reactive Extensions
Software Transactional Memory
Actors
Concurrency in Practice
Index
Customer Reviews