Distributed Programming: Message Passing
- Shared memory compared to distributed
memory offers increased flexibility and programming ease at the cost
of additional hardware complexity and thus lower peak performance for a
given machine cost. Software implementation is easier, and hardware implementation is harder.
- One could distinguish between physical sharing and logical (software) sharing.
- Physical sharing is when two CPU’s share physical memory, they have the same address space, and values
written into a word by one of them can be read by the other one.
- When two computers do not share physical memory, they must communicate by sending each other messages, or pretend
that they have a shared virtual memory.
- Logical sharing, in contrast, is determined by how the software views the world, as opposed to the hardware.
When two processes share logical memory, information written into a data structure by one of them can be read by the other.
- Without logical sharing, processes must communicate explicitly by some form of I/O or message-passing.
- Message-passing communication does not need to use critical section or mutual exclusion to guard/protect
shared variables. The shift of paradigm is that they instead guard/protect shared
communication links (channels with or without buffers). The bottom line is that
both shared memory and message passing must share something to be able to interact, and that they share either variables
or communication links to which access can be synchronized and protected by mutual exclusion or not.