Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Parallel processing vs. multithreading: Java 1.7 fork/join vs. new Thread() etc.

 
Benjamin Weaver
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to know whether Java's new fork/join parallel processing functionality is meant to replace Java multithreading, or, rather, supplement it.

I ask because somewhere I read a statement to the effect that functional languages (Haskell, Clojure) represent a more 'reliable' way to achieve the benefits of multithreading than concurrent multithreading itself.

I can at least partially understand this reasoning if it is in fact correct: why not divide into many processes what would have been divided into threads if common resources might be controlled by the process that forks and joins others?
But I could also understand how multithreading might be done on EACH parallel process. By this thinking the result of using fork/join functionality in combination with multithreading would be a multitude of multi-threaded processes.

So, at least in practice, are the two meant, or enabled, to be combined? or does fork/join functionality in Java 1.7 effectively replace concurrency and multithreading in Java?

Any perspective are greatly appreciated! Thanks in advance.

 
rudra tripathy
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Benjamin,

There are three things.

fork/join would not replace multi threading, it s just another added advantage. the functional languages are trying to provide distributed features which is better than concurrent, but those are not yet become standards. One who what to implement multi threading features still could use concurrent package.

Hopefully it answers your question.

Regards,
Rudra
 
Jimmy Mersen
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java's basic multi-threading , with Thread, wait etc is simply the lowest level. Higher levels are built on it -- all the libraries in java.util.concurrent, and others. Fork/Join is just one example of what can be built using the lowlevel primitives. In most cases, you indeed do want to use the higher level libraries.
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought fork/join was actually a completely separate mechanism that offered finer-grained control than was possible with the previous mutlithreading constructs. Guess I gotta go read up on Java 7.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic