
84 CHAPTER 4. SHARED MEMORY: R
# r e c e i v e from worker 2
y <− mpi . r e c v . Robj ( tag =0, so u rc e =2)
to run on process 5. By contrast, in a shared-memory environment, the
variables x and y would be shared, and the programmer would merely
write
y <− x
What a difference! Now that x and y are shared by the processes, we can
access them directly, making our code vastly simpler.
Note carefully that we are talking about human efficiency here, not machine
efficiency. Use of shared memory can greatly simplify our code, with far less
clutter, so that we can write and debug our program much faster than we
could in a message-passing environment. That doesn’t ...