This course teaches learners (industry professionals and students) the fundamental concepts of concurrent programming in the context of Java 8. Concurrent programming enables developers to efficiently and correctly mediate the use of shared resources in parallel programs. By the end of this course, you will learn how to use basic concurrency constructs in Java such as threads, locks, critical sections, atomic variables, isolation, actors, optimistic concurrency and concurrent collections, as well as their theoretical foundations (e.g., progress guarantees, deadlock, livelock, starvation, linearizability).
Why take this course?
• It is important for you to be aware of the theoretical foundations of concurrency to avoid common but subtle programming errors.
• Java 8 has modernized many of the concurrency constructs since the early days of threads and locks.
• During the course, you will have online access to the instructor and mentors to get individualized answers to your questions posted on the forums.
• Each of the four modules in the course includes an assigned mini-project that will provide you with the necessary hands-on experience to use the concepts learned in the course on your own, after the course ends.
The desired learning outcomes of this course are as follows:
• Concurrency theory: progress guarantees, deadlock, livelock, starvation, linearizability
• Use of threads and structured/unstructured locks in Java
• Atomic variables and isolation
• Optimistic concurrency and concurrent collections in Java (e.g., concurrent queues, concurrent hashmaps)
• Actor model in Java
Mastery of these concepts will enable you to immediately apply them in the context of concurrent Java programs, and will also help you master other concurrent programming system that you may encounter in the future (e.g., POSIX threads, .NET threads).

Из урока

Critical Sections and Isolation

In this module, we will learn different approaches to coordinating accesses to shared resources without encountering the deadlock or livelock bugs studied earlier. Critical/isolated sections are higher-level concurrent programming constructs (relative to locks) that simplify the implementation of mutual exclusion by guaranteeing the absence of deadlocks and livelocks. Object-based isolation relaxes the constraints imposed by critical sections by allowing mutual exclusion to be specified on a per-object basis, as illustrated in the Spanning Tree example. Java's atomic variables represent an important, but restricted, case of object-based isolation that is implemented efficiently on all hardware platforms. Finally, we will learn how object-based isolation can be further relaxed with read/write access modes.