[concurrency-interest] santa clause problem solved?

Joe Bowbeer joe.bowbeer at gmail.com
Mon Apr 7 16:10:59 EDT 2008


Does anyone have a nice solution to the Santa Claus Problem using
java.util.concurrent?

I know this is 1/4 turn out of season, but as we all know, Java
concurrency is not "real-time" ...

In Ch. 24 of Beautiful Code, Simon Peyton Jones solves the Santa Claus
Problem in Haskell using Software Transactional Memory (STM).  The
full source of his solution can be found at:

  http://www.crsr.net/Notes/SantaClausProblem.html

There's also a full discussion of a "correct" Ada solution in this
article Mordechai Ben-Ari:

  http://stwww.weizmann.ac.il/g-cs/benari/articles/santa-claus-problem.pdf

Ben-Ari, who wrote that Doug Lea invited the readers of Concurrent
Programming in Java to develop a full solution, also presents the
beginnings of a solution written in ancient BJUC Java.
(BJUC=BeforeJavaUtilConcurrent)

To my eye, a solution in jCSP would look similar to the Haskell and
Erlang solutions.

Has someone written a clean solution with java.util.concurrent?  I'm
thinking a custom AbstractQueuedSynchronizer (AQS) may be involved.

--Joe


More information about the Concurrency-interest mailing list