Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Learning Concurrent Programming in Scala
  • Toc
  • feedback
Learning Concurrent Programming in Scala

Learning Concurrent Programming in Scala

By : Prokopec
4.7 (10)
close
Learning Concurrent Programming in Scala

Learning Concurrent Programming in Scala

4.7 (10)
By: Prokopec

Overview of this book

This book is a must-have tutorial for software developers aiming to write concurrent programs in Scala, or broaden their existing knowledge of concurrency. This book is intended for Scala programmers that have no prior knowledge about concurrent programming, as well as those seeking to broaden their existing knowledge about concurrency. Basic knowledge of the Scala programming language will be helpful. Readers with a solid knowledge in another programming language, such as Java, should find this book easily accessible.
Table of Contents (11 chapters)
close
10
Index

Chapter 4. Asynchronous Programming with Futures and Promises

 

Programming in a functional style makes the state presented to your code explicit, which makes it much easier to reason about, and, in a completely pure system, makes thread race conditions impossible.

 
 --John Carmack

In the examples of the previous chapters, we often dealt with blocking computations. We have seen that blocking synchronization can have negative effects—it can cause deadlocks, starve thread pools, or break lazy value initialization. While in some cases, blocking is the right tool for the job, in many cases we can avoid it. Asynchronous programming refers to the programming style in which executions occur independently of the main program flow. Asynchronous programming helps you to eliminate blocking: instead of suspending the thread whenever a resource is not available, a separate computation is scheduled to proceed once the resource becomes available.

In a way, many of the concurrency...

Unlock full access

Continue reading for free

A Packt free trial gives you instant online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech
bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete