File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Languages and the fly likes Java Multi Thread vs Go Multi Thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Languages » Other Languages
Bookmark "Java Multi Thread vs Go Multi Thread" Watch "Java Multi Thread vs Go Multi Thread" New topic
Author

Java Multi Thread vs Go Multi Thread

Ninad Kulkarni
Ranch Hand

Joined: Aug 31, 2007
Posts: 797

Will multi threading in GO is better than Java?


SCJP 5.0 - JavaRanch FAQ - Java Beginners FAQ - SCJP FAQ - SCJP Mock Tests - Tutorial - JavaSE7 - JavaEE6 -Generics FAQ - JLS - JVM Spec - Java FAQs - Smart Questions
Mark Summerfield
author
Ranch Hand

Joined: Jun 20, 2012
Posts: 37

Hi Ninad,

Yes, concurrency in Go is better than in Java or C++.

This is because Go uses extremely lightweight "threads" called goroutines. On many desktop computers even creating 10s or 100s of threads causes problems, using Go to create 100s, 1000s, or 10000s of goroutines is no problem at all. Also Go's approach to concurrency is much higher level than Java or C++'s approaches: this makes concurrency in Go easier to program and reason about.


Mark Summerfield
"Programming in Go" - http://www.qtrac.eu/gobook.html
Ninad Kulkarni
Ranch Hand

Joined: Aug 31, 2007
Posts: 797

Thanks Mark,
GO seems to be interesting.
Mark Summerfield
author
Ranch Hand

Joined: Jun 20, 2012
Posts: 37

Hi Ninad,

Yes, I think that Go is the most interesting new language I've seen since Java appeared in the mid 1990s!
Michael Swierczek
Ranch Hand

Joined: Oct 07, 2005
Posts: 107
    
    1
Mark Summerfield,

I've read a lot of good things about go's goroutines. However, Java now has something similar (which may have been inspired by goroutines, I don't know) from the Akka library: http://akka.io/

For certain classes of multi-threaded programming in Java, thanks to Akka you no longer need to manage threads and synchronization yourself.

Mark Summerfield
author
Ranch Hand

Joined: Jun 20, 2012
Posts: 37

Hi Michael,

As I mentioned in another post there's no doubt that C++ and Java will get CSP libraries---but this isn't the same as having the facility built-in.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java Multi Thread vs Go Multi Thread