晶羽科技-解读点评影视小说作品

微信
手机版

炒股容错率(炒股容错率是什么)

2021-12-30 21:50 作者:闪念基因 围观:

作者:TurkeyCock

出处:https://blog.csdn.net/TurkeyCock/article/details/81781082

经常听到有文章引用下面这句话:在同步系统中容错率可以达到50%,而在异步系统中容错率下降到33%。

那么问题来了,到底什么是同步系统,什么是异步系统?

同步系统(Synchronous System)

援引《Introduction to Reliable and Secure Distributed Programming》第46页中的权威定义:

1. Synchronous computation. There is a known upper bound on processing delays. That is, the time taken by any process to execute a step is always less than this bound. Remember that a step gathers the delivery of a message (possibly nil) sent by some other process, a local computation (possibly involving interaction among several layers of same process), and the sending of a message of some other process (possibly omitted).

2. Synchronous communication. There is known uppder bound on message transmission delays. That is, the time period between the instant at which a message is sent and the instant at which the message is delivered by the destination process is smaller than this bound.

也就是说,同步系统可以保证在有限时间内完成计算,在有限时间内完成网络传输。

异步系统(Asynchronous System)

显然,异步系统就是不符合上面两个条件的系统了。

部分同步系统(Partial Synchronous System)

事实上,在实际系统中,大多数情况下都属于同步系统,只有在某些极端情况下(如网络丢包、缓存被塞满等),系统会转变为异步系统。这种系统被称为部分同步系统。

部分同步系统有两种形式的定义:

1. 系统可以保证在有限时间内完成计算和网络传输,但是这个时间无法被预先知道

2. 系统只能在一段无法预知的时间内,保证计算和网络传输有一个时间上限

同步系统的容错率

这里只讨论签名消息,直观来说,需要通过少数服从多数来达成共识,那么显然容错率是50%。

当然,Andrew Miller在他的论文给出了证明过程:

1. 假设集合P中都是诚实节点,Q中都是恶意节点,输入为0,结果如左图所示

2. 假设集合P中都是恶意节点,Q中都是诚实节点,输入为1,结果如右图所示

通过一个”passive client”去观察(这个passive client只能接收消息,不能发送消息),无法区分这两种情况。因此,同步系统的容错率为50%。

同步系统和异步系统容错率的思考

如果要求所有节点转发消息时都带上自己的签名,将可以获得更强的容错性。例如Lamport设计了一种算法,理论上可以达到99%的容错率:

同步系统和异步系统容错率的思考

假设有m个恶意节点,诚实节点只需要确保收到m+1个不同节点签名,就可以保证所有诚实节点达成一致。

以图中情况为例:图中有4个恶意节点,2个诚实节点。当节点6收到4个签名的时候(实线部分),还无法确认该消息是否有效,因为有可能都是恶意节点的签名。但是,当它收到5个签名时(虚线部分),就可以确认节点2一定也已经收到过该信息,这样所有诚实节点就可以达成一致了。

异步系统的容错率

在异步系统中,网络传输可能出现长时间的延迟,因此节点可能无法收全所有信息。在这种情况下,节点会进入等待,需要在收到有限条消息的时候做出决策。PBFT就是一种异步系统中的拜占庭容错算法,最大容错率为33%,推导如下:

假设系统中有m个恶意节点这些恶意节点可能选择不发送消息,这样诚实节点最多只能收到n-m条消息,并在此时做出决策但是,由于网络延迟,诚实节点发送的消息有可能没收到,也就是说,这n-m条消息中有可能包含了m个恶意节点的消息为了作出正确的决策,至少需要m+1个诚实节点的消息,才能推翻这m个恶意节点的消息也就是说,需要n-m >= 2m+1,即n >= 3m+1,证毕同步系统和异步系统容错率的思考

关于POW

POW是一种比较特殊的算法,它依靠算力竞赛而非网络交互完成共识。参见以太坊wiki上的描述:

Proof of work has been rigorously analyzed by Andrew Miller and others and fits into the picture as an algorithm reliant on a synchronous network model. We can model the network as being made up of a near-infinite number of nodes, with each node representing a very small unit of computing power and having a very small probability of being able to create a block in a given period. In this model, the protocol has 50% fault tolerance assuming zero network latency, ~46% (Ethereum) and ~49.5% (Bitcoin) fault tolerance under actually observed conditions, but goes down to 33% if network latency is equal to the block time, and reduces to zero as network latency approaches infinity.

也就是说,POW在网络无延时的情况下可以达到50%的容错率,当网络延时和出块时间相当时容错率下降到33%,而当网络延时趋于无穷大时容错率趋于0(会出现大量分叉,导致网络不可用)。

参考:

https://books.google.com/books?id=Y8lHVFeJ6EQC&printsec=frontcover&source=gbs_ge_summary_r&cad=0#v=onepage&q&f=false

https://groups.csail.mit.edu/tds/papers/Lynch/jacm88.pdf

https://eprint.iacr.org/2016/454.pdf

https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQs

https://groups.csail.mit.edu/tds/papers/Lynch/jacm88.pdf

作者:TurkeyCock

出处:https://blog.csdn.net/TurkeyCock/article/details/81781082

相关文章