Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Are there other popular paradigms besides actor concurrency?

 
Marco Ehrentreich
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Venkat and welcome to JavaRanch!

I'm relatively new to Scala, so please excuse this simple question ;-)

Every tutorial, article etc. describing Scala's concurrency features talks about the actor model. I'm wondering if this is the one and only concurrency paradigm in Scala?!? And moreover, can you address every needs for concurrent programming with actors?

Thanks for your answer!


Marco
 
Venkat Subramaniam
Author
Ranch Hand
Posts: 109
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Marco,

The actor based model is the most prominent solution offered in Scala.
There are a few other approaches implemented in additional libraries.
Other approaches may gain prominence in the future. However, as of now
actor based model is the most popular.

Yes, you can address your concurrency need using actor. However, that does not
mean that is the only way it should be done. The immutability and functional aspects
combined with message passing makes quite a bit of sense. At the same time, I also
like, within reason, the transaction model of Clojure. I hope for that to gain some
acceptance and use within Scala in the future.
 
Burk Hufnagel
Ranch Hand
Posts: 814
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Venkat Subramaniam wrote:At the same time, I also like, within reason, the transaction model of Clojure. I hope for that to gain some acceptance and use within Scala in the future.


I'm intrigued and confused. Are you suggesting Scala implement a transaction model that's based on Clojure's? Or are you saying we could actually use Clojure within a Scala app to handle transactions?
 
Venkat Subramaniam
Author
Ranch Hand
Posts: 109
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was suggesting the former.
 
Marco Ehrentreich
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think Venkat is talking about the concurrency paradigm "software transactional memory" which is used in the Clojure language, although it's not Clojure specific. But I'm not an expert on this. It sounds very interesting but from what I know it's currently a bit slow as it has do be done all in software until it gets integrated in modern CPUs for home computers one day.

Marco
 
Marco Ehrentreich
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oops, too late :-)

I guess, that should be really possible to do with the power of Scala. Unfortunately (or luckily) from what I read Clojure has a really good performance. So I suspect that Scala would suffer from the same slow down when using transactional memory?!? But as I said, I have no practical experience so I can't even tell how slow "slow" could be...

Marco
 
Venkat Subramaniam
Author
Ranch Hand
Posts: 109
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Polymorphism was once very slow.
That's not the case any more. You
wouldn't reject the concept based on
an implementation. So I will not assume
Scala can't do better.

Also, general performance concerns are often
misleading. Knowing the real details,
we can design our apps to make good use of
these techniques.
 
Marco Ehrentreich
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh no, please don't get me wrong with this point, Venkat!

I definitely agree with you here. In my opinion good concepts for the future should never be abandoned because of some technical limitations at present which we are able to solve in the near future anyway. Regarding performance I'd say garbage collected memory is one prominent example for this. It has vastly improved and surely helped for the success of Java. And the technology is still improving today... The performance problems with transactional memory implemented purely in software was just one thing I read about in an article. But as I wrote above the idea behind it generally sounds very promising.

Marco
 
Burk Hufnagel
Ranch Hand
Posts: 814
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Venkat Subramaniam wrote:I was suggesting the former.

Thanks, Venkat. That's what I thought but I've learned over the years to check my assumptions.
Burk
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic