问题描述
我知道就几种分布式技术(例如RPC)而言,使用了封送处理"一词,但不了解它与序列化有何不同.他们不是都将对象转换为一系列位吗?
I know that in terms of several distributed techniques (such as RPC), the term "Marshaling" is used but don't understand how it differs from Serialization. Aren't they both transforming objects into series of bits?
推荐答案
在远程过程调用的上下文中,封送处理和序列化是松散的同义词,但从意图上来说在语义上是不同的.
Marshaling and serialization are loosely synonymous in the context of remote procedure call, but semantically different as a matter of intent.
特别地,封送处理是关于从此处获取参数,而序列化是关于在诸如字节流之类的原始形式之间复制结构化数据.从这个意义上讲,序列化是执行封送处理的一种方法,通常实现按值传递语义.
In particular, marshaling is about getting parameters from here to there, while serialization is about copying structured data to or from a primitive form such as a byte stream. In this sense, serialization is one means to perform marshaling, usually implementing pass-by-value semantics.
还可以通过引用将对象编组,在这种情况下,在线"上的数据只是原始对象的位置信息.但是,这样的对象可能仍然适合于值序列化.
It is also possible for an object to be marshaled by reference, in which case the data "on the wire" is simply location information for the original object. However, such an object may still be amenable to value serialization.
如@Bill所述,可能还有其他元数据,例如代码库位置甚至对象实现代码.
As @Bill mentions, there may be additional metadata such as code base location or even object implementation code.
这篇关于序列化和封送处理有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!