Skip to content

Latest commit

 

History

History
223 lines (172 loc) · 10.6 KB

File metadata and controls

223 lines (172 loc) · 10.6 KB

Concurrency

Under construction - currently mostly brainstorming

Problems

  • Mutual Exclusion (Critical Section)
  • Readers Writers
  • Producer Consumer

Starvation free, Fairness, Obstruction free, False Sharing, Cache Coherency

Concepts

  • Safety
  • Liveness
  • Execution Model
  • Process:
  • Thread: A stream of executable code within a process that has the ability to be scheduled 1

Laws

Models

Thread based

  • Thread per Request 1
  • Process per Request (old UNIX style) 1
  • Request dispatch to Thread Pool 1

Considerations

Event based

  • Event Model, Event Loop

Considerations

Combination

SEDA 1

If I were to design SEDA today, I would decouple stages (i.e., code modules) from queues and thread pools (i.e., concurrency boundaries)

Matt Welsh: Retrospective on SEDA

  • Actor
  • CSP

Implementation

  • Locking (Mutex, Semaphore)
  • Lock free

Thread Models

Patterns

  • Reactor 1
  • Proactor 1

Memory Barriers

https://mechanical-sympathy.blogspot.co.at/2011/07/memory-barriersfences.html

Techniques

  • Lock stripping to avoid coarse grained locks (see javas* ConcurrentHashMap*)

Java

JMM

Testing

.NET

People to learn from

  • Gil Tene, Nitsan Wakart, Cliff Click, basically everyone from Azul Systems
  • Lamport, Hoare, Knuth, Dijkstra
  • Martin Thomson
  • Doug Lea
  • Brian Goetz
  • Aleksey Shipilev
  • Norman Maurer
  • Todd L. Montgomery
  • Jonas Boner, Viktor Klang, Roland Kuhn, Konrad Malawski, people from Typesafe/Lightbend
  • Andrei Alexandrescu
  • Herb Sutter
  • Scott Meyers
  • Joe Duffy
  • http://jeremymanson.blogspot.co.at/

Code to learn from

  • JCTools
  • Disruptor
  • Fast Flow
  • Aeron
  • Netty
  • Vertx
  • RabbitMQ
  • NodeJS?
  • Akka
  • Erlang, Clojure, Haskell
  • Learn how hardware works - its super parallel
  • Some GPU stuff, havent looked into

Blogs

Literature

Name Author Language/Platform Rating Description
The art of multiprocessor programming Herlihy, Shavit Theory, Java 9 Tough but very good
7 concurrency models in 7 weeks Paul Butcher Java, Clojure, GPU, etc 9 Very good read!
Erlang and Akka Documentation - Erlang, Java, Scala 9 Very good explaination of actor concurrency model
Java Concurrency in Practice Brian Goetz etc Java 9 Classic Java Concurrency book, must read
Concurrent Programming in Java Doug Lea etc Java 8 Little outdated but still classic Java Concurrency book, (must) read
Java Memory Model Spec JSE Java Dont ask Its the spec, must read
JMM Pragmatics Shipilev Java 10 Very (very) good but requires a lot of time to read and understand
Close encounters of JMM kind Shipilev Java 10! Best article about the JMM
Tenes Developer JMM Cookbook Tene - Very practical, boils done to one simple matrix
Doug Leas JMM Cookbook Lea ? Not fully read
http://www.azulsystems.com/blog/cliff/2010-01-09-biased-locking Cliff Click Java 9 If you want to know how biased locking actual works
http://joeduffyblog.com/2015/11/19/asynchronous-everything/ Joe Duffy .NET 9 Highly recommended
http://joeduffyblog.com/2016/11/30/15-years-of-concurrency/ Joe Duffy .NET 9
http://highscalability.com/blog/2013/3/18/beyond-threads-and-callbacks-application-architecture-pros-a.html HighScalability - - -

Videos

Most videos have strong focus on performance because concurrency and performance are strongly related

Name Recorded At Speaker Language/Platform Rating Description
A Crash Course in Modern Hardware Devoxx Cliff Click HW,OS,JVM,Java 8 Really a crash course but still quite good
CPU caches and why you care code::dive conference 2014 Scott Meyers HW,C++ 9 Classic one about caches, must watch
History of Memory Models MIT course ? Theory ? Not complete watched yet
Concurrency is Not Parallelism ? Rob Pike Go 9 A classic one
From Concurrent to Parallel JFokus 2016 Brian Goetz Java 8 Short+good explaination about streams and parallelism
Deep Dive Performance ? Nitsan Wakart Java 6 3 talks - some good some not so good
CON1517 An Introduction to JVM Performance JavaOne 2015 Rafael Winterhalter Java 9 Very good and practical
CON1521 The Java Memory Model for Practitioners JavaOne 2015 Rafael Winterhalter Java 9 Very good and practical
Lock-Free Programming Part1 CppCon 2014 Herb Sutter C++ ? Not fully watched yet
Lock-Free Programming Part2 CppCon 2014 Herb Sutter C++ ? Not fully watched yet
The Illusion of Execution JFokus 2015 Nitsan Wakart Java 9 Nice deep dive
Finding Subtle but Common Concurrency Issues in Java Programs ? ? Java 5 Basics but with good visualization
Adventures with Concurrent Programming in Java Code Mesh 2015 Martin Thompson Java 9 Martins talks are always good
Aeron: Open-source high-performance messaging Strangeloop 2014 Martin Thompson Java 8 High level overview of Aeron
Advanded Topics: The Java Memory Model Google Talks 2007 ? Java 7 Fairly good introduction to JMM
Locks? We Don't Need No Stinkin' Locks! JAX 2012 Barker Java 8 Classic LMAX talk, nice low level
Understanding the Disruptor JAX 2011 Barker, Gee Java 8 Good introduction to the Disruptor
atomic<> Weapons, 1 of 2 C++ and Beyond 2012 Sutter C++ 9 Very good and low level
atomic<> Weapons, 2 of 2 C++ and Beyond 2012 Sutter C++ 8 Still very good and low level