Showing posts with label concurrency. Show all posts
Showing posts with label concurrency. Show all posts

Wednesday, 18 May 2016

Working with Akka Actors | Let's Do Big Data...

Working with Akka Actors | Let's Do Big Data...: "I am going to explain Akka actor model with a simple example fetching weather data from Yahoo, I am going to use akka scala API."



'via Blog this'

Thursday, 28 April 2016

Rainer Grimm: Multithreading in modern C++

http://www.modernescpp.com/index.php/multithreading-in-modern-c

With the new C++11 Standard, C++ faces the first time the challenges of multicore architectures. The 2011 published standard defines how a C++ program has to behave in the presence of multiple threads. The C++11 multithreading capabilities are composed of two components. This is on the one hand, the defined memory model, which is on the other hand, the standardized threading interface.
Timeline

 

Monday, 28 March 2016

Julia Evans: Thread pools! How do I use them?

http://jvns.ca/blog/2016/03/27/thread-pools-how-do-i-use-them/

In Java, a thread is "blocked" when it's waiting for a "monitor" on an object. When I originally googled this I was like "er what's a monitor?". It's when you use synchronization to make sure two different threads don't execute the same code at the same time.
// scala pseudocode
class Blah {
    var x = 1
    def plus_one() {
        this.synchronized {
            x += 1
        }
    }
}
This synchronize means that only one thread is allowed to run this x += 1block at a time, so you don't accidentally end up in a race. If one thread is already doing x += 1, the other threads end up -- you guessed it -- BLOCKED.
The two things that were blocking my threads were:
  • lazy vals in Scala used synchronized internally, and so can cause problems with concurrency
  • Double.parseDouble in Java 7 is a synchronized method. So only one thread can parse doubles from strings at a time. Really? Really. They fixed it in Java 8 though so that's good.

Saturday, 14 November 2015

JVM Concurrency links

Jessica Kerr: Concurrency Options on the JVM


Jessica Kerr covers some of the concurrency tools existing in JVM languages including ExecutorService, Futures, Akka actors, and core.async coroutines, providing advice on writing deadlock-free code.




Gentle Introduction to Lockless Concurrency

I've recently visited #jcrete, a Java Un-Conference. After talking with people, it struck me that many things that were available and extremely popular in the other communities (like Clojure and Haskell) are still so little used in Java world.
Ever since Java got LambdasStreams and default method implementations in Interfaces, it actually became much more enjoyable language to use. It should have also changed ways people write their code, although this process is much slower than I would have expected.
Lambdas allowed us to pass anonymous functions in order to avoid creating a class for every single possible clause where variables escape the context. They also allow to think of operations in terms of small, atomic pieces that can be combined, passed around, reused and referenced.
In this post I’ll try to examine the question of lockless concurrency in Java - an extremely useful, yet shamefully overlooked topic. Implementing lockless algorithms and data structures requires some intuition on basic principles, so let's start with something simple.