Friday, November 16, 2007
Fork-Join Framework for Java 7
Brian Goetz does a good job explaining an upcoming Fork-Join framework for Java 7 here. Doug Lea also describes it here.Initially I thought the idea was kind of lame because Java has had very good threading support from the beginning, so this is nothing you couldn't do yourself. It does however continue extending upon higher level abstractions appearing in the java.util.concurrent package. In particular, I like the discussion of "work-stealing" which makes this framework actually make sense over the naive approach of a new thread per recursive task. Work stealing seems like such a smart idea especially when coupled with a work deque instead of a work queue That way work stealing can happen from the tail instead of the head, so thread contention with the normal(non-stolen) work is reduced.