views:

191

answers:

2

Correct me if I'm wrong, but I'm surprised this hasn't been asked before on here ...

+4  A: 

Message passing models (Erlang, for example) do not have any shared state; all synchronization and communication is done by exchanging messages. Shared memory models communicate by reading/writing to shared memory blocks, which are protected by semaphores or similar.

JesperE
+5  A: 

It's a pretty simple difference. In a shared memory model, multiple workers all operate on the same data. This opens up a lot of the concurrency issues that are common in parallel programming.

Message passing systems make workers communicate through a messaging system. Messages keep everyone seperated, so that workers cannot modify each other's data.

By analogy, lets say we are working with a team on a project together. In one model, we are all crowded around a table, with all of our papers and data layed out. We can only communicate by changing things on the table. We have to be careful not to all try to operate on the same piece of data at once, or it will get confusing and things will get mixed up.

In a message passing model, we all sit at our desks, with our own set of papers. When we want to, we can pass a paper to someone else as a "message", and that worker can now do what they want with it. We only ever have access to whatever we have in front of us, so we never have to worry that someone is going to reach over and change one of the numbers while we are in the middle of summing them up.

Ok, silly analogy!

Chris
Silly analogy, but +1 for creativity. :)
musicfreak