Message Passing - Message Passing Versus Calling

Message Passing Versus Calling

Message passing should be contrasted with the alternative communication method for passing information between programs – the Call. In a traditional Call, arguments are passed to the "callee" (the receiver) typically by one or more general purpose registers or in a parameter list containing the addresses of each of the arguments. This form of communication differs from message passing in at least three crucial areas:

  • total memory usage
  • transfer time
  • locality

In message passing, each of the arguments has to have sufficient available extra memory for copying the existing argument into a portion of the new message. This applies irrespective of the size of the original arguments – so if one of the arguments is (say) an HTML string of 31,000 octets describing a web page (similar to the size of this article), it has to be copied in its entirety (and perhaps even transmitted) to the receiving program (if not a local program).

By contrast, for the call method, only an address of say 4 or 8 bytes needs to be passed for each argument and may even be passed in a general purpose register requiring zero additional storage and zero "transfer time". This of course is not possible for distributed systems since an (absolute) address – in the callers address space – is normally meaningless to the remote program (however, a relative address might in fact be usable if the callee had an exact copy of, at least some of, the callers memory in advance). Web browsers and web servers are examples of processes that communicate by message passing. A URL is an example of a way of referencing resources that does depend on exposing the internals of a process.

A subroutine call or method invocation will not exit until the invoked computation has terminated. Asynchronous message passing, by contrast, can result in a response arriving a significant time after the request message was sent.

A message handler will, in general, process messages from more than one sender. This means its state can change for reasons unrelated to the behaviour of a single sender or client process. This is in contrast to the typical behaviour of an object upon which methods are being invoked: the latter is expected to remain in the same state between method invocations. (in other words, the message handler behaves analogously to a volatile object).

Read more about this topic:  Message Passing

Famous quotes containing the words message, passing and/or calling:

    Television does not dominate or insist, as movies do. It is not sensational, but taken for granted. Insistence would destroy it, for its message is so dire that it relies on being the background drone that counters silence. For most of us, it is something turned on and off as we would the light. It is a service, not a luxury or a thing of choice.
    David Thomson, U.S. film historian. America in the Dark: The Impact of Hollywood Films on American Culture, ch. 8, William Morrow (1977)

    Take care to sell your horse before he dies. The art of life is passing losses on.
    Robert Frost (1874–1963)

    I keep having the same experience and keep resisting it every time. I do not want to believe it although it is palpable: the great majority of people lacks an intellectual conscience. Indeed, it has often seemed to me as if anyone calling for an intellectual conscience were as lonely in the most densely populated cities as if he were in a desert.
    Friedrich Nietzsche (1844–1900)