Take the 2-minute tour ×

-edit- i'd like a large list so i can reference this for ideas. Some answers already have been enlightening

What are some concurrency models? I heard of message passing where there is no memory shared. futures which returns an object right away (so it doesnt block) and allows you to dereference the original function returns value later when you need it blocking if the result are not ready yet. I heard of coroutines, software transactional memory and random others.

I searched for a list or a wiki and couldnt find any good ones (many did not list 3 i mentioned above) and many results gave me a complicated description explaining how it works rather then what it does or how it is to be used.

What are some concurrency models and what is a simple description of what they do? One per answer.

share|improve this question
Concurrency from Wikipedia is a good start. It lists (and links) a number of models not yet mentioned. –  user166390 Nov 23 '10 at 4:52
Also note this thread currently has answers the wiki page makes no mention of. Lets have more –  acidzombie24 Nov 23 '10 at 6:58
check out this for a comparision of the major ones: java-is-the-new-c.blogspot.de/2014/01/… –  R.Moeller Feb 1 '14 at 19:56

9 Answers 9

up vote 1 down vote accepted

COM Threading (Concurrency) Model

  • Single-Threaded Apartments
  • Multi-Threaded Apartments
  • Mixed Model Development

COM objects can be used in multiple threads of a process. The terms "Single- threaded Apartmen*t" (STA) and "*Multi-threaded Apartment" (MTA) are used to create a conceptual framework for describing the relationship between objects and threads, the concurrency relationships among objects, the means by which method calls are delivered to an object, and the rules for passing interface pointers among threads. Components and their clients choose between the following two apartment models presently supported by COM:

Single-threaded Apartment model (STA): One or more threads in a process use COM and calls to COM objects are synchronized by COM. Interfaces are marshaled between threads. A degenerate case of the single-threaded apartment model, where only one thread in a given process uses COM, is called the single-threading model. Previous Microsoft information and documentation has sometimes referred to the STA model simply as the "apartment model." Multi-threaded Apartment model (MTA): One or more threads use COM and calls to COM objects associated with the MTA are made directly by all threads associated with the MTA without any interposition of system code between caller and object. Because multiple simultaneous clients may be calling objects more or less simultaneously (simultaneously on multi-processor systems), objects must synchronize their internal state by themselves. Interfaces are not marshaled between threads. Previous Microsoft information and documentation has sometimes referred to this model as the "free-threaded model." Both the STA model and the MTA model can be used in the same process. This is sometimes referred to as a "mixed-model" process.

Other models according to Wikipedia

There are several models of concurrent computing, which can be used to understand and analyze concurrent systems. These models include:

share|improve this answer

Actor Model

I heard of message passing where there is no memory shared.

Is it about Erlang-style Actors?

Scala uses this idea in its Actors framework (thus, in Scala its not a part of the language, just a library) and it looks quite sexy!

In a few words Actors are objects that have no shared data at all, but can use async messages for interaction. Actors can be located on one or different hosts and use interesting error handling policy (when error happened - actor just dies).

You should read more on this in Erlang and Scala docs, its really straightforward and progressive approach!

Chapters 3, 17, 17.11:


share|improve this answer
Thanks, Cedrik, exactly. Had not enough reputation to post the second link :D –  tuxSlayer Nov 24 '10 at 13:49

Software transactional memory

In computer science, software transactional memory (STM) is a concurrency control mechanism analogous to database transactions for controlling access to shared memory in concurrent computing. It is an alternative to lock-based synchronization. A transaction in this context is a piece of code that executes a series of reads and writes to shared memory. These reads and writes logically occur at a single instant in time; intermediate states are not visible to other (successful) transactions. The idea of providing hardware support for transactions originated in a 1986 paper and patent by Tom Knight[1]. The idea was popularized by Maurice Herlihy and J. Eliot B. Moss[2]. In 1995 Nir Shavit and Dan Touitou extended this idea to software-only transactional memory (STM)[3]. STM has recently been the focus of intense research and support for practical implementations is growing.

share|improve this answer

There's also map/reduce.

The idea is to spawn many instances of a sub problem and to combine the answers when they're done. A simple example would be matrix multiplication, which is the sum of several dot products. You spawn a worker thread for each dot product, and when all the threads are finished you sum the result.

This is how GPUs, functional languages such as LISP/Scheme/APL, and some frameworks (Google's Map/Reduce) handle concurrency.

share|improve this answer


A future is a place-holder for the undetermined result of a (concurrent) computation. Once the computation delivers a result, the associated future is eliminated by globally replacing it with the result value. That value may be a future on its own.

Whenever a future is requested by a concurrent computation, i.e. it tries to access its value, that computation automatically synchronizes on the future by blocking until it becomes determined or failed.

There are four kinds of futures:

  • concurrent futures stand for the result of a concurrent computation,
  • lazy futures stand for the result of a computation that is only performed on request,
  • promised futures stand for a value that is promised to be delivered later by explicit means,
  • failed futures represent the result of a computation that terminated with an exception.
share|improve this answer


In computer science, coroutines are program components that generalize subroutines to allow multiple entry points for suspending and resuming execution at certain locations. Coroutines are well-suited for implementing more familiar program components such as cooperative tasks, iterators, infinite lists and pipes.

share|improve this answer

There's also non-blocking concurrency such as compare-and-swap and load-link/store-conditional instructions. For example, compare-and-swap (cas) could be defined as so:

bool cas( int new_value, int current_value, int * location );

This operation will then attempt to set the value at location to the value passed in new_value, but only if the value in location is the same as current_value. This only requires one instruction and is usually how blocking concurrency (mutexes/semaphores/etc.) are implemented.

share|improve this answer

IPC (including MPI and RMI)

in the wiki pages you can find that MPI (message passing interface) is a methods of a general IPC technique: http://en.wikipedia.org/wiki/Inter-process_communication
Another interesting approach is a Remote procedure call. For example Java's RMI enables you to focus only on your application domain and communication patterns. It's an "application level" concurrency.

There a various design patterns/tools available to aid in shared memory model prallelization. Apart from the mentioned futures one can also take advantage of:
1. Thread pool pattern - focuses on task distribution between fixed number of threads: http://en.wikipedia.org/wiki/Thread_pool_pattern
2. Scheduler pattern - controls the threads execution according to a chosen scheduling policy http://en.wikipedia.org/wiki/Scheduler_pattern
3. Reactor pattern - to embed a single threaded application in a parallel environment http://en.wikipedia.org/wiki/Reactor_pattern
4. OpenMP (allows to parallelize part of code by means of preprocessor pragmas)


share|improve this answer

Parallel Random Access Machine (PRAM) is useful for complexity/tractability isues (please refer to a nice book for details).

About models you will also find something here (by Blaise Barney)

share|improve this answer

Your Answer


