Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
9540d978
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9540d978
编写于
2月 19, 1998
作者:
B
Bruce Momjian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FIFO lock wait queue, with readers grouped together.
上级
9a550134
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
34 addition
and
12 deletion
+34
-12
src/backend/storage/lmgr/proc.c
src/backend/storage/lmgr/proc.c
+34
-12
未找到文件。
src/backend/storage/lmgr/proc.c
浏览文件 @
9540d978
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.3
0 1998/01/28 02:29:29
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.3
1 1998/02/19 15:04:45
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -46,7 +46,7 @@
* This is so that we can support more backends. (system-wide semaphore
* sets run out pretty fast.) -ay 4/95
*
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.3
0 1998/01/28 02:29:29
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.3
1 1998/02/19 15:04:45
momjian Exp $
*/
#include <sys/time.h>
#include <unistd.h>
...
...
@@ -451,19 +451,42 @@ ProcSleep(PROC_QUEUE *waitQueue,
int
prio
,
LOCK
*
lock
)
{
int
i
;
int
i
=
0
;
PROC
*
proc
;
struct
itimerval
timeval
,
dummy
;
/*
* If the first entries in the waitQueue have a greater priority than
* we have, we must be a reader, and they must be a writers, and we
* must be here because the current holder is a writer or a
* reader but we don't share shared locks if a writer is waiting.
* We put ourselves after the writers. This way, we have a FIFO, but
* keep the readers together to give them decent priority, and no one
* starves. Because we group all readers together, a non-empty queue
* only has a few possible configurations:
*
* [readers]
* [writers]
* [readers][writers]
* [writers][readers]
* [writers][readers][writers]
*
* In a full queue, we would have a reader holding a lock, then a
* writer gets the lock, then a bunch of readers, made up of readers
* who could not share the first readlock because a writer was waiting,
* and new readers arriving while the writer had the lock.
*
*/
proc
=
(
PROC
*
)
MAKE_PTR
(
waitQueue
->
links
.
prev
);
for
(
i
=
0
;
i
<
waitQueue
->
size
;
i
++
)
{
if
(
proc
->
prio
>=
prio
)
proc
=
(
PROC
*
)
MAKE_PTR
(
proc
->
links
.
prev
);
else
break
;
}
/* If we are a reader, and they are writers, skip past them */
while
(
i
++
<
waitQueue
->
size
&&
proc
->
prio
>
prio
)
proc
=
(
PROC
*
)
MAKE_PTR
(
proc
->
links
.
prev
);
/* The rest of the queue is FIFO, with readers first, writers last */
while
(
i
++
<
waitQueue
->
size
&&
proc
->
prio
<=
prio
)
proc
=
(
PROC
*
)
MAKE_PTR
(
proc
->
links
.
prev
);
MyProc
->
prio
=
prio
;
MyProc
->
token
=
token
;
...
...
@@ -596,8 +619,7 @@ ProcLockWakeup(PROC_QUEUE *queue, char *ltable, char *lock)
/*
* ProcWakeup removes proc from the lock waiting process queue and
* returns the next proc in chain. If a writer just dropped its
* lock and there are several waiting readers, wake them all up.
* returns the next proc in chain.
*/
proc
=
ProcWakeup
(
proc
,
NO_ERROR
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录