Skip to Content
数据库系统内幕
book

数据库系统内幕

by Alex Petrov
May 2020
Beginner to intermediate
319 pages
7h 3m
Chinese
China Machine Press
Content preview from 数据库系统内幕
复制和一致性
|
191
11.3
共享内存
对于客户端来说,分布式系统在储存数据时仿佛拥有共享的存储,类似于单节点的系
统。节点间通信和消息传递则被抽象出来并发生在幕后。这就造成了一种共享内存的
假象。
可通过读写操作来访问的单个存储单元通常被称为
寄存器
(register)。我们可以将分布式
数据库中的
共享内存
视为一个寄存器阵列。
我们用
调用
(invocation)和
完成
(completion)事件来标识每个操作。如果调用该操作的
进程在操作完成之前崩溃,则将该操作定义为
失败
操作。如果一个操作的调用和完成事
件都发生在另一个操作被调用之前,我们说这个操作在另一个操作
之前
,并且这两个操
作是
顺序的
(sequential)。否则说它们是
并发的
。
图 11-1 中,你可以看到进程 P
1
和 P
2
执行不同的操作:
•
a) 进程 P
2
执行的操作在进程 P
1
执行的操作已经完成
之后
才开始,两个操作是
顺序
的
。
•
b) 两个操作之间有重叠,因此这两个操作是
并发的
。
•
c) 进程 P
2
执行的操作在 P
1
执行的操作
之后
开始,并在 P
1
执行的操作完成
之前
结
束,这两个操作也是
并发的
。
a
)
b
)
c
)
图
11-1
:顺序操作和并发操作
多个读取者或写入者可以同时访问寄存器。对寄存器的读写操作
不是即时
的,即需要一
些时间。由不同进程执行的并发读写操作不是
串行的
(serial):根据操作重叠时寄存器
的行为,它们的顺序可能不同,并可能产生不同的结果。根据寄存器在并发操作下的行
为,我们将寄存器分为以下三类:
安全寄存器
在并发写操作期间,对安全寄存器的读取可能返回寄存器范围内的 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

解密金融数据

解密金融数据

Justin Pauley

Publisher Resources

ISBN: 9787111655169