Lecture 3: Concurrency Abstractions

Today’s lecture reviewed the built-in Java concurrency primitives, the challenges of writing thread-safe code, and patterns that may help with that: immutability, synchronization wrappers, and control abstractions like producer/consumer. More high-level concurrency abstractions, such as those in the java.util.concurrent package, support programming that is not only thread-safe but takes distinct advantage of concurrency to increase performance and responsiveness.

There were also announcements about the course web pages, Facebook page and Twitter feed; and a walk through some intentionally racy code in the source for the standard Java String class.

Link: Slides for Lecture 3

Homework

Before the next lecture:

To understand more about the meaning and effect of the volatile keyword, Silver Taza recommends the Javamex tutorial.

Links: Java Concurrency Tutorial; Javamex on volatile

References

  • Brian Goetz, Time Peierls, Joshua Block, Joseph Bowbeer, David Holmes and Doug Lea. Java Concurrency In Practice. Addison-Wesley, 2006.

    The current standard reference for concurrent Java programming.

  • Doug Lea. Concurrent Programming in Java: Design Principles and Patterns. Second Edition. Addison-Wesley, 1999.

    The original text describing many of the patterns now implemented inside java.util.concurrent.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s