NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Remoting-By-Val

In disributed computing, we may want to execute a method, not within the current thread, but within a thread in a separate process on the same machine, or even a thread in a process on another machine. We speak of this as Remoting the method invocation.

Suppose the method to be Remoted takes, as one of its arguments, an object which lies at the root of a graph of objects. If all objects in the graph are marked as remote-by-val, then we have to Serialize a copy of graph and pass to the remote process.

For efficiency, remoting is investigating whether an object’s fields can be Serialized, without also Serializing a specifier for each field. However, the runtime makes no guarantee that fields will be laid out in memory, in the same order, from one instantiation of an object to the next; even more so if these instantiations lie on different platforms, such as Windows NT versus WinCE.

Is there any way to achieve this? Discussions to-date have thrown up a few possible approaches. For example, we might Serialize the fields in some canonical order – alphabetical by the source code, in strict order of definition in the source code, in order of decreasing field size, etc. Various options have various performance tradeoffs – all of those mentioned so far would likely require a “scatter-gather” approach – where Serialization gathers fields into canonical order, and Deserialization scatters them from that canonical order back to the in-memory layout selected by the runtime for the new object. (Again, we mention these possible approaches here, simply as background to explain the requirement).