Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know a little about how to use message passing and shared memory, but I still don't know when to choose one or another.

Can you tell me about their traits (not the implementation)?

share|improve this question
Anything specific? This is not a small subject. – Oded Oct 29 '11 at 17:11
up vote 6 down vote accepted

The quick summary:

Shared memory parallelism (e.g., OpenMP) is strictly more powerful than message passing (e.g., MPI) as you can simulate message passing with a shared memory system but not vice versa. However, it's also much more difficult to scale up the shared memory model (it needs very elaborate and expensive hardware once you go to more than one system board) and it is also much more difficult to analyze due to the number of possible interactions. The message passing model is considerably simpler to understand — you just have a stream of messages coming in that you want to process — and it maps much more nicely to what is actually possible with networks so it obviously can scale up massively.

share|improve this answer

From the point of view of how you actually design systems with them, they are in some sense mathematical duals, as this adage by Joe Armstrong, one of the original designers of Erlang, nicely demonstrates:

With shared memory, you communicate by sharing data, with messaging, you share data by communicating.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.