Strong and weak fairness in formal method(形式化方法中的强公平性和弱公平性)

找到了讲解详尽的片段:

Fairness properties are liveness properties which guarantee some "fair" behavior. Let's consider the following example:

There is a (reliable) channel connecting a sender and a receiver. Now, we want to guarantee that when the sender sends a message, the receiver will indeed receive it, i.e. get its contents. This will hold when we assume weak fairness on receiving the message. Why? 
Weak fairness says that when an action is (continuously)  enabled, the action will be (eventually) executed. When the sender sends the message and the message reaches the other end of the channel, the receiver is allowed to receive the message (i.e. the action is enabled). The receiver could decide to do something else, while the action will still be enabled without the receiver reading its contents. Assuming weak fairness on receiving the message implies that the receiver can do something else, but at some moment, will indeed get the message.
In terms of temporal logic this is:  F G  Enabled (A) ->  F  A
Sometimes this formula is used:  F G  Enabled (A) ->  G F  A

If there is some point from which the action is enabled, then it will be applied.

Now, strong fairness implies weak fairness, but the other way around doesn't work.
Strong fairness relaxes the assumption that the action needs to be continuously enabled to be applied. Instead, it requires it to be enabled infinitely often (possible with intervals where it is not enabled).

Considering the previous example, let's now assume that the channel isn't reliable, that is, it sometimes loses messages. Then the sender sends the message, and it may get or not to the end of the channel. Since the sender doesn't know if the message was lost it continues sending the same copy of that message (for instance, until receiving acknowledge). Now, while the receiver is doing other things, at some moments the message could be ready to be read, or it may be erased, but as long as the message is sent, there will be infinite states in which the receiver  could  read its contents. Then assuming strong fairness says that if the action of reading the message contents is infinitely often enabled, it will be done. 

In terms of temporal logic this is:  G F  Enabled (A) ->  F  A
Sometimes this formula is used:  G F  Enabled (A) ->  G F  A

Note that for weak fairness we have written F G for the first part, whereas for strong fairness we have written G F. 
F G says that there is a point in the future from which the action will always be enabled, and G F says that the action will be enabled an infinite number of times (but not necessarily continuously).

References:  Introduction to TLA

摘自Quora

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值