Mike McClurg

Posts Tagged ‘Concurrency

Java Concurrency Annotations

leave a comment »

I’ve been reading a series of papers by Chandrasekhar Boyapati on extensions to the Java type system. I found his papers on ensuring race-free programs by specifying that objects are either immutable thread local, or referenced by a unique pointer. There’s also the paper A Type and Effect System for Deterministic Parallel Java, from OOPSLA 2009. I’m fascinated by the idea of creating a type system that could ease the burden of writing threaded program, and this seems like a really promising idea to me.

I’d like to combine this approach to concurrency with Hybrid Type Checking. While I’d prefer to do as much at compile time as possible, I have a suspicion that we’ll always need to do some locking and unlocking at compile time, and that a system using both static types and runtime contracts might be our best bet.

I’m taking a stab at implementing these ideas in Java — but instead of modifying the compiler itself, I’ll be writing an annotation processor that will run before the compiler. The idea is that we could extend the Java type system using annotations. We could even go so far as to generate code at compile time that could do either runtime contract checking, or even lock and thread management. This is similar to the project Java Defensive Programming. If I can get this project off the ground, I’ll have to see if Federico would like to incorporate some of my code in his project.


Written by mcclurmc

February 12, 2010 at 3:21 pm

Posted in Projects, Thoughts

Tagged with , , ,