Actors, Messages and Low Lock Contention for Java
Using actors and messages, concurrency is easier to understand. However, most developers don't want to learn a new programming language in order to use actors and messages. If you want to forget a bit about threads and locks, you can add nice actor support to an existing Java application using Jetlang.
There are two very popular phrases related to acting:
"All the world's a stage and we are merely actors."
"All the world practices the art of acting."
According to these phrases, the actor model should be suitable for representing any concurrent real-life situation. In a previous post "A Domain-Specific Language to Let Groovy Go Parallel", I talked about exciting intuitive ways to handle tasks, actors and messages using a DSL for Groovy. I've received many e-mails asking for a similar project based purely on the Java programming language. One possible answer is the interesting open source project created by Mike Rettig: Jetlang.
Jetlang offers a simple yet powerful lightweight concurrency model borrowing concepts from Erlang and Scala. It offers actors, messages, fibers and channels complementing Java’s existing java.util.concurrency package.
One of the most interesting things about Jetlang is its high performance design. It offers a low lock contention and a low latency. Thus, it provides a great scalability. This happens because Jetlang was designed to exploit concurrency on multicore microprocessors. Therefore, it followed James Reinders' rule #5 "Avoid using locks. Simply say "no" to locks. Locks slow programs, reduce their scalability…".
Jetlang provides Fibers based on:
• A dedicated thread, also known as thread-bound).
• A thread pool, also known as thread-pool bound.
You can decide the most convenient implementation according to your needs. The flexible message passing models combined with the event-driven actors allow the implementation of really complex concurrent designs.
Each message supports single or multiple subscribers. Hence, it is very easy to take advantage of existing code to implement additional features. For example, Mike Rettig shows how to implement the basic Scala Actor functionality using around 100 lines of Jetlang and Java code.
It is easy to begin working with Jetlang because you don't have to learn a new programming language. You are still working on the Java programming language, but you can take advantage of fibers, messages and actors.
If you want to implement a parallel design based on concurrent actors offering nice multicore performance and scalability, without leaving Java, you can learn a lot from Jetlang.
Jetlang is still in its Alpha version. However, it is worth taking a look at it. Once you learn concurrency using actors and messages, you'll never go back to threads and locks. There are many other actor frameworks for Java. However, Jetlang offers a nice performance and low lock contention. Therefore, I've been working with it for two months.
Expect to see more libraries and frameworks born in the multicore era using baselines borrowed from old-fashioned languages. You won't have excuses to create code optimized for modern parallel architectures.
You can find nice examples about using Jetlang in Mike Rettig's Weblog
Multicore-enabling the N-Queens Problem Using Cilk++
Multicore Storage Allocation
The four basic problems that a good parallel storage allocator solvesQuickPath Interconnect: Rules of the Revolution
This Week's Multicore Reading List
- Intel Parallel Studio; Download the free eval today!
- Parallelism Breakthrough Video Series; Watch and learn more about Intel® Parallel Studio
- 2009 Intel Software Webinar Series; View On-Demand webinars
- Coding for Multi-core Processes; Intel® Compiler Pro eBook
- Performance Through Parallelism; Intel® Tuning for Vista eBook
- Intel® Software Network; Connect with developers and Intel engineers
-
November 17, 2009
Visual Effects for Animation - presented by DreamWorks Animation
Speaker: Ron Henderson (Bio)Ron Henderson manages the FX Tools group at DreamWorks Animation, where he is responsible for developing physical simulation and procedural modeling tools. These systems have been used for key visual effects in recent films such as Kung Fu Panda and Monsters vs. Aliens (March 2009).
Prior to joining DreamWorks in 2002 he was a senior scientist at Caltech with a joint appointment to the Applied Math and Aeronautics departments, where he worked on efficient techniques for the direct numerical simulation of fluid turbulence.Abstract:
In this webinar, Ron Henderson will show examples of visual effects, from hair and feathers to smoke and fire, from a variety of DreamWorks Animation feature films. He will discuss in general terms the kinds of techniques used to achieve particular visual effects. Finally, Henderson will show a detailed breakdown of the dam-breaking scene from Madagascar: Escape 2 Africa, demonstrating how different elements of key frame animation, simulation, and rendering are combined in a real production shot. -
December 1, 2009
A Quick and Easy Way to Parallelize a Legacy Codebase with Intel® Threading Building Blocks (TBBs)
Speaker: Bernard Laberge, Avid, Senior Principal Engineer (Bio)Bernard Laberge is a senior principal engineer in the video editors division at Avid. During his seven years with the company he has been actively involved in the replacement of the legacy video processing engines used by Avid editors with a common hardware-abstracted, component-based video processing engine currently running on the CPU with SIMD optimized code, GPU, and dedicated hardware.
Abstract:
Learn how to overcome the limitations of a thread-based scheduler, including dealing with the absence of recursive parallelism support and the inefficient handling of unbalanced processing load. Bernard Laberge addresses how Avid resolved the expensive refactoring of their thread-based scheduler into a task-based solution by choosing Intel® Threading Building Blocks (TBBs). He explores how Avid was able to easily integrate the Intel TBBs into their video editor applications and more than 5 million lines of code. -
December 15, 2009
How to Use Intel® Parallel Studio to Streamline Code Development in a Multicore Environment
Speaker: Matt Dunbar, Director for Performance Technology, SIMULIA (Bio)Matt Dunbar is the director for performance technology at SIMULIA. Since joining the company in 1993, he has worked on parallelization of the Abaqus suite of products, initially for shared memory architectures and more recently for distributed memory architectures. Dunbar has also been intimately involved in selecting both the hardware and software tools used in the development of the Abaqus product line.
Abstract:
Resolve elusive, costly multithreading errors quickly and efficiently with Intel® Parallel Studio. While many coding problems that lead to bugs in software applications are typically straightforward logic errors, errors in managing memory and in multithreading code can sometimes take weeks to months to diagnose and fix. Matt Dunbar explores how and why taking advantage of multicore processors through multithreaded code is critical for compute-intensive applications. While spotlighting his work on SIMULIA's Abaqus finite element solver, Dunbar addresses the need for multicore execution and shares his experiences using Intel Parallel Studio to streamline code development in a multicore environment.



