编组或同步......? [英] Marshalling or synchronizing...?

查看:66
本文介绍了编组或同步......?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个关于编组的问题。

关于marshlling的维基百科页面(以及网络上的其他页面和文章)描述的编组操作类似于序列化,将对象转换为适合将数据传输到其他进程的格式。



这很清楚。除了我在谈论事件时看到过编组一词。那么谈论将事件编组到其他线程是否正确?



我个人在讨论交换线程时使用术语同步。还是编组事件而不仅仅是同步?



这里只有一些混乱,所以我想知道是否有人可以解释编组和线程之间的同步之间的区别。 />


作为奖励问题:编组一词来自何处?为什么用它来描述序列化的过程?



谢谢。

Hi all,
I have a question about marshalling.
The wikipedia page about marshlling (and other pages and articles across the web) describe marshalling as being similiar to serialization, transforming an object into a format that is suited for transporting data to other processes.

That is pretty clear. Except that I have seen the term 'marshalling' when talking about events. So is it correct to talk about 'marshalling an event to other threads'?

Personally I use the term 'synchronization' when talking about switching threads. Or is marshalling events more than just synchronizing?

There's just some confusion here, so I was wondering if anyone could explain the difference between marshalling and synchronizing between threads.

As a bonus question: Where does the word marshalling come from? Why is it used to describe the process of serialization?

Thanks.

推荐答案

Marhalling往往是该术语用于描述转换数据的过程,以便可以存储(即,编组数据)或移动数据。因此,当您听到正在编组的事件时,这意味着(实际上)正在转换事件以便它可以在线程上移动 - 换句话说,它正在讨论在另一个适合存在的线程上重新创建事件的状态在那个帖子上调用。



编组一词来自何处?为什么用它来描述序列化的过程?

它来自英文动词 - 编组意味着以正确的顺序排列 [ ^ ]。
Marhalling tends to be the term used to describe the process of transforming data so that it can either be stored (i.e., marshalling data), or moved. So, when you hear about an event being marshalled, what this means (in effect) is transforming the event so that it can be moved over threads - in other words, it's talking about recreating the state of the event on another thread suitable for being invoked on that thread.

"Where does the word marshalling come from? Why is it used to describe the process of serialization?"
It comes from the English verb - whereby marshalling means to arrange in proper order[^].


序列化是转换数据结构或对象的过程可以将其存储在文件,存储器缓冲器中,或者通过网络连接传输,以便稍后在相同或另一个计算机环境中使用。这个比特序列可以是用户选择的任何格式;然而,它们通常形成为XML或二进制。

这个过程的反向,将这些位转换回原始数据结构和对象,称为反序列化



.net中的序列化示例:DataSet.WriteXml(myfile.xml);

.net中的反序列化示例:DataSet.ReadXml(myfile.xml);



而Marshaling是将托管数据类型转换为非托管数据类型的过程。托管和非托管环境之间存在许多差异。其中一个是不可用的数据另一个环境中的一个环境的类型。为了能够与其他环境进行交互,您不需要更改类型格式,而是更改其名称。这是一个例子:

假设一个非托管代码有一个返回BOOL数据类型的函数,你不能解释返回类型,那是因为你的托管环境没有BOOL;虽然它有一个System.Boolean。



编组是如此命名的,因为它是由Edward Waite Marshall于1962年首次研究,然后是通用电气公司


参考:



[ ^ ]



如需更多信息,请查看本文。





[< a href =http://msdn.microsoft.com/en-us/library/eaw10et3%28v=vs.110%29.aspxtarget =_ blanktitle =New Window> ^ ]





http://msdn.microsoft.com/en-us/library/zah6xy75%28v=vs.110%29.aspx [

href =http://msdn.microsoft.com /en-us/library/zah6xy75%28v=vs.110%29.aspx\"target =_ blanktitle =新窗口> ^
]
Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file, a memory buffer, or transmitted across a network connection to be used later in the same or another computer environment. And this sequence of bits can be of any format the user chooses; however, they are usually formed as XML or binary.
The reverse of this process, converting these bits back to the original data structures and objects, is called Deserialization

Serialization example in .net: DataSet.WriteXml("myfile.xml");
Deserialization example in .net: DataSet.ReadXml("myfile.xml");

Whereas Marshaling is the process of converting managed data types to unmanaged data types. There’re many differences between the managed and unmanaged environments. One of them is not being available a data Type of one environment in the other one. In order to be able to interact with the other environment, you will need to not to change the type format, but to change its name. This is an example:
Let say a unmanaged code has a function returning a BOOL data type, you can’t interpret the return type, that’s because your managed environment doesn’t have a BOOL; although, it has a System.Boolean.

Marshalling is so named because it was first studied in 1962 by Edward Waite Marshall, then with the General Electric Corporation

Refrences:

[^]

and for more information you could take a look at this article.


[^]


http://msdn.microsoft.com/en-us/library/zah6xy75%28v=vs.110%29.aspx[
href="http://msdn.microsoft.com/en-us/library/zah6xy75%28v=vs.110%29.aspx" target="_blank" title="New Window">^
]


这篇关于编组或同步......?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆