Most of the concurrent programming utilities we have studied so far are used in order to enable different threads of computation to exchange information. Atomic variables, the synchronized
statement, concurrent queues, futures, and promises are focused on ensuring the correctness of a concurrent program. On the other hand, the parallel collections programming model is designed to be largely identical to that of sequential Scala collections; parallel collections exist solely in order to improve the running time of the program. In this chapter, we will measure the relative speedup of programs using parallel collections. To make this task easier, we will introduce the timed
method to the package object used for the examples in this chapter. This method takes a block of code body, and returns the running time of the executing block of code body
. It starts by recording the current time with the nanoTime
method from the JDK System
class. It then runs the body, records...

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