Angelika Langer - Training & Consulting
HOME | COURSES | TALKS | ARTICLES | GENERICS | LAMBDAS | IOSTREAMS | ABOUT | NEWSLETTER | CONTACT | Twitter | Lanyrd | Linkedin
Course Curriculum Angelika LangerCourse Curriculum Angelika Langer  
HOME

  GENERAL INFO
  SCHEDULE
  REGISTRATION
  
  JAVA
    EFFECTIVE JAVA
    CONCURRENCY
    PERFORMANCE
    LAMBDAS
    JAVA 8
    GC TUNING
    MEMORY MODEL 
    JAVA INTRO

  C++
    RELIABLE C++
    EFFECTIVE STL
    TEMPLATES
    IOSTREAMS
    C++ INTRO   
 

GENERICS 
LAMBDAS 
IOSTREAMS 
ABOUT 
NEWSLETTER 
CONTACT 
JMM - Java Memory Model

JMM - Java Memory Model
COURSE DESCRIPTION

The Java Memory Model is a part of the Java Language Specification that covers, among other topics, the effects of synchronization by means of locks, the use of volatile and atomic variable, the guarantees given for final fields. It has been around since the advent of Java and underwent a major overhaul in release 5.0 of Java. Despite of its existence since day one of Java it is an area of the language that many developers do not feel comfortable with.  It is considered guru knowledge and best ignored. Avoidance, however, is no longer practical.

These days the prevalence of multicore processors requires that essentially all Java applications must be multi-threaded if the want to take advantage of the available cpu power. Inevitably many applications will make the transition from a single-core architecture to a multi-core or multi-cpu platform.  This migration occasionally reveals (so far dormant) bugs in the program: applications that worked properly and reliably in a single-core context suddenly and inexplicably exhibit errors in a multi-core context. Often this is due to the substantially more aggressive caching techniques used on the processor level in combination with misconceptions regarding the Java Memory Model on the programmer's side.  In order to avoid such misconeptions, the workshop discusses the Java Memory Model comprehensively and in depth.

A proper understanding of the Java Memory Model does not only help tracking down and fixing bugs.  In addition, it allows development Java programs with perceivably higher performance.

The elimination or at least reduction of sychronization is becoming increasingly  important in a multi-core and multi-processor world.  Using a multi-cpu platform users expect that an application should scale, that is, its performance should increase with the number of available cpus.  This highly desirable effect does not occur automatically, but has to be built into the application.  Sequential, i.e., non-parallel, parts of the program must be drastically reduced in order to utilize the multiple cpus effectively.  There are several technique for reduction of sequential processing, among them the elimination of lock-based sychronization, but also the use of atomic operations and programming techniques such as lock-free programming.

The workshop discusses the Java Memory Model, the issues of visibilty and reordering, the use of volatile and atomic variable, the implementation of immutable types based on the memory model's initialization safety garantee, and provides an introduction to the techniques of lock-free programming.

In this workshop, participants have the opportunity to practice and apply the newly gained knowledge in hands-on labs.  They will review code, spot bugs, and fix them.  In addition, they will use atomic variables to eleminate lock-based synchronisation. 
 

Prerequisite Courses and Skills: Working knowledge of Java and Java concurrency. 
Duration: 1 day
Exercises: Workshops and hands-on labs

This is a course for Java programmers who want to round up their knowledge of Java concurrency issues.

The course is designed to build on existing expertise as Java programmers and aims to take the skills one step further. Prerequisite for the seminar is sound knowledge of Java concurrency and substantial  practical experience with concurrent programming in Java. 

OBJECTIVES
 
Know when to replace locks by volatile and atomics
Understand the effects of locks, volatile, final and atomics
Learn how to avoid subtle visibility bugs
Understand the principles of  lock-free programming

The course is designed by Klaus Kreft & Angelika Langer and backed by years of experience in teaching and more than a decade of practical experience in industrial software development both in C++ and Java.
Angelika Langer is a freelance trainer/consultant in the area of software development in C++ and Java, author of language reference material such as the Java Generics FAQs [ ], the Lambdas/Streams Tutorial & Reference  [ ], and countless articles on C++ and Java topics [ ]. 
Klaus Kreft is a senior consultant for more than 25 years and has served as the lead architect and performance expert on several successful industry projects. He has been working in Java since its advent in 1995. 
Both are recognized speakers at OO and Java conferences and author of numerous articles on C++ and Java topics in various computer magazines worldwide. Together they write a column for the German Java magazine JavaMagazin  [ ] and are authors of the  books "Standard C++ IOStreams and Locales" (2000) [ ] and "Java Core Programmierung" (2011) [ ], the Online FAQ on Java Generics [ ], and the Lambdas/Streams Tutorial & Reference  [ ].

 


 
COURSE CONTENT


 
  • Purpose of the Java memory model
  • Visibility, atomicity, reordering
  • Guarantees for volatile 
  • Double-checked locking
  • Initialization safety of final fields
  • Atomic variables
  • Lock-free programming
     
 
FURTHER READING

To get an impression of some topics covered in this course check out the sample reading: 
 
EFFECTIVE JAVA
Column in JavaSpektrum 
(available in German only)
  JAX TV
Java-Programmierung im Multicore-Zeitalter
(available in German only)
  JavaZone 2011
Details of the Java Memory Model 
(English)

 
 
TRAINING LOCATIONS

Open Enrollment
Public courses are conducted in collaboration with partner companies worldwide. Presentation language is English or German, depending on the location. For further information go to GENERAL INFO.
On-Site Training
Courses can be held at your company site. Duration and content will be tailored to your specific needs and prerequisites. Presentation language is English or German.  For further information go to GENERAL INFO.
For information regarding training locations and the current schedule of public courses go to SCHEDULE. For further information or enrollment send me EMAIL or use the REGISTRATION form.
Schedule
To check for availability, price and other details send me EMAIL or use the REGISTRATION form.
  © Copyright 1995-2014 by Angelika Langer.  All Rights Reserved.    URL: < http://www.AngelikaLanger.com/Courses/JMM.html  last update: 26 Nov 2014