gpt4 book ai didi

java - 线性化和串行化有什么区别?

转载 作者:IT老高 更新时间:2023-10-28 20:40:06 27 4
gpt4 key购买 nike

线性化和可序列化(在 Java 的上下文中)有什么区别?您能否通过示例解释它们之间的区别或提供一个很好的引用?

最佳答案

两者的主要区别在于 serializability 是一个 global 属性;整个操作/交易历史的属性。 线性化是一个局部属性;单个操作/事务的属性。另一个区别是线性化包括实时的概念,而串行化不包括:操作的线性化点必须位于其调用和响应时间之间。 (请参阅 Tim Harris:Transactional Memory, 2ed。有关示例和证明,请参阅 多处理器编程的艺术,关于线性化的部分中 Herlihy 的幻灯片,这些幻灯片是 available here .

这两个属性都针对同一个目标:顺序一致性。来自 Herlihy 的论文:

Much work on databases and distributed systems uses serializability as the basic correctness condition for concurrent computations. In this model, a transaction is a thread of control that applies a finite sequence of primitive operations to a set of objects shared with other transactions. A history is serializable if it is equivalent to one in which transactions appear to execute sequentially, i.e., without interleaving. A (partial) precedence order can be defined on non-overlapping pairs of transactions in the obvious way. A history is strictly serializable if the transactions’ order in the sequential history is compatible with their precedence order...

...Linearizability can be viewed as a special case of strict serializability where transactions are restricted to consist of a single operation applied to a single object. Nevertheless, this single-operation restriction has far-reaching practical and formal consequences, giving linearizable computations a different flavor from their serializable counterparts. An immediate practical consequence is that concurrency control mechanisms appropriate for serializability are typically inappropriate for linearizability because they introduce unnecessary overhead and place unnecessary restrictions on concurrency.

引用资料:

更多详情:

如果您真的关心这一点,请阅读介绍定义的论文。对于线性化,即 Linearizability: A Correctness Condition for Concurrent Objects, Herlihy and Wing .它很密集,但值得关注。请注意,在软件事务内存社区中,线性化是否是正确的目标/属性是一个悬而未决的问题。

可序列化是关于操作集合的结果/“系统”可以表达为所有操作。线性化是系统中单个操作子集的属性......如果一个操作/一组操作在其他操作看来好像它们相对于其他操作发生在(逻辑)时间的特定时刻,那么它们就是可线性化的。这里的规范论文是Papadimitriou, The Serializability of Concurrent Database Updates .

当您考虑“可线性化”时,请考虑“原子操作”。当(似乎)相对于系统的其他部分原子地发生时,(一组)操作是可线性化的。一个常见的表述是“提供每个操作在其调用和响应之间立即生效的错觉”。 线性化的公式是由于Herlihy ,它强调这是一个局部属性,而其他类型的顺序一致性属性(如“可序列化”)是全局的。

关于java - 线性化和串行化有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4179587/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com