Michel Fortin wrote:
On 2009-05-28 12:52:06 -0400, Andrei Alexandrescu
<seewebsiteforem...@erdani.org> said:
What happens is that memory is less shared as cache hierarchies go
deeper. It was a great model when there were a couple of processors
hitting on the same memory because it was close to reality. Cache
hierarchies reveal the hard reality that memory is shared to a
decreasing extent and that each processor would rather deal with its
own memory. Incidentally, message-passing-style protocols are
prevalent in such architectures even at low level. It follows that
message passing is not only an attractive model for programming at
large, but also a model that's closer to machine than memory sharing.
While message-passing might be useful for some applications, I have a
hard time seeing how it could work for others. Try split processing of a
4 Gb array over 4 processors, or implement multi-threaded access to an
in-memory database. Message passing by copying all the data might happen
at the very low-level, but shared memory is more the right abstraction
for these cases.
Perhaps at an implementation level in some instances, yes. But look at
fold...@home, etc. The approach is based on message passing. Just if
you were fold...@ononepconly then you might pass references to array
regions around instead of copying the data. I suppose what I'm getting
at is that an interface doesn't typically necessitate a particular
implementation.
There's a reason why various operating systems support shared memory
between different processes: sometime it's easier to deal with shared
memory than messaging, even with all the data races you have to deal with.
Shared memory becoming more and more implemented as message passing at
the very low level might indicate that some uses of shared memory will
migrate to message passing at the application level and get some
performance gains, but I don't think message passing will ever
completely replace shared memory for dealing with large data sets. It's
more likely that shared memory will become a scarse resource for some
systems while it'll continue to grow for others.
Well sure. At some level, sharing is going to be happening even in
message-passing oriented applications. The issue is more what the
"encouraged" approach to solving problems that a language supports than
what the language allows. D will always allow all sorts of wickedness
because it's a systems language. But that doesn't mean this stuff has
to be the central feature of the language.