2PL,严格模型与严格模型,有什么好处吗? [英] 2PL, Rigorous vs Strict Model, Is there any benefit?

查看:158
本文介绍了2PL,严格模型与严格模型,有什么好处吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在2PL(两相锁定)中,严格模型比严格模型有什么优势?

In 2PL (two phase locking), what advantage(s) does the rigorous model have over the strict model?

I)严格模型没有任何优势.

I) There is no advantage over the strict model.

II)与严格模型相反,它保证了饥饿不会发生.

II) In contrast to the strict model, it guarantees that starvation cannot occur.

III)与严格模型相反,它保证了不会发生死锁.

III) In contrast to the strict model, it guarantees that deadlock cannot occur.

IV)与严格模型相比,无需预测将来所需的数据.

IV) In contrast to the strict model, there is no need to predict data needed in the future.

我的笔记说以上所有内容都是错误的.我有点困惑.有人可以为我澄清为什么所有这些都是错误的吗?

My note says all of the above are false. I am a bit confused. Can someone clarify for me why all of this is false?

推荐答案

什么是两阶段锁定(2PL)协议?

A transaction is two-phase locked if:

before reading x, it sets a read lock on x

before writing x, it sets a write lock on x

it holds each lock until after it executes the corresponding operation

after its first unlock operation, it requests no new locks

现在,什么是严格的相位锁定?

在这里,事务必须持有所有独占锁,直到提交/中止.

Here a transaction must hold all its exclusive locks till it commits/aborts.

但是,严格的2PL是什么?

严格的两阶段锁定更加严格:这里所有的锁定都将保留到提交/中止为止.在此协议中,事务可以按照提交的顺序进行序列化.

Rigorous two-phase locking is even stricter: here all locks are held till commit/abort. In this protocol transactions can be serialized in the order in which they commit.

更深入:

严格2PL:

与2PL相同,但保留所有排他锁,直到事务已成功提交或中止.–保证无级联的可恢复性

Same as 2PL but Hold all exclusive locks until the transaction has already successfully committed or aborted. –It guarantees cascadeless recoverability

严格的2PL:

与Strict 2PL相同,但保留所有锁,直到事务已成功提交或中止.–用于动态环境事先不知道数据访问方式的地方.

Same as Strict 2PL but Hold all locks until the transaction has already successfully committed or aborted. –It is used in dynamic environments where data access patterns are not known before hand.

没有死锁.此外,较年轻的交易要求由较旧的事务将中止并以相同的时间戳记重新启动,从而避免了饥饿.

There is no deadlock. Also, a younger transaction requesting an item held by an older transaction is aborted and restart with the same timestamp, starvation is avoided.

我希望以上图表的清晰说明一定使您清楚了概念和严格的优势.

I hope that above clear explanations with diagram must have made you clear about the concept and advantages of rigorous over the other.

谢谢

这篇关于2PL,严格模型与严格模型,有什么好处吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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