CHAPTER 6

image

Lambda Concurrency

The Java programming language is, at its core, a series of instructions. These instructions are executed in sequence. By default, you only ever have one of these series going at a time. However, if you have multiple processing cores on your machine, or if you have any kind of I/O, then this single series of instructions suddenly becomes very inefficient. If your program has a lot to do, but its single stream has to wait for the “read” I/O instruction to complete before doing anything else, then your program is wasting time. If you have four processing cores, but only one stream of instructions, then you are at best ...

Get Java Closures and Lambda now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.