Thursday, November 6, 2014

Handling Concurrency

Programming languages offer various ways to handle concurrency. In languages like Java, concurrency is handled at library level, in other languages like Erlang concurrency is handled at language level itself.

Semantics of handing concurrency,
  • Locks/Mutex
  • Compare and Set
  • Copy on write
  • Event loop/machine
  • Messaging
    • Actor
    • Communicating via sequential processing (CSP)

Java language provides library to support Locks/Mutex, Compare and Set and Copy on write semantics.

Scala - a JVM based language provides Actor based semantic.

Ruby language provides Mutex based semantic and we also have event loop based semantic via external library (EventMachine.rb).

Node.js provides event loop based semantic at language level. At language level IO related events (such as Network, File system) are supported. Generation and handling of custom events also supported.

Go language supports Mutex based semantic and also CSP semantic via channels.

Erlang language supports Actor based semantic.