没有合适的资源?快使用搜索试试~ 我知道了~
操作系统英文教学课件:Chapter 6 Process Synchronization.ppt
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 145 浏览量
2022-06-03
23:45:40
上传
评论
收藏 552KB PPT 举报
温馨提示
试读
64页
操作系统英文教学课件:Chapter 6 Process Synchronization.ppt
资源推荐
资源详情
资源评论
Chapter 6: Process Synchronization
6.2
Silberschatz, Galvin and Gagne ©2005
Operating System Concepts – 7
th
Edition, Feb 8, 2005
Process Synchronization
A Scenario
The Critical-Section Problem, here
Synchronization Hardware , here
Semaphores , here
Classic Problems of Synchronization, h
Monitors
6.3
Silberschatz, Galvin and Gagne ©2005
Operating System Concepts – 7
th
Edition, Feb 8, 2005
Scenario
Concurrent access to shared data may result in data
inconsistency
Maintaining data consistency requires mechanisms
to ensure the orderly execution of cooperating
processes
Suppose that we wanted to provide a solution to the
consumer-producer problem that fills all the buffers.
We can do so by having an integer count that keeps
track of the number of full buffers. Initially, count is
set to 0. It is incremented by the producer after it
produces a new buffer and is decremented by the
consumer after it consumes a buffer.
6.4
Silberschatz, Galvin and Gagne ©2005
Operating System Concepts – 7
th
Edition, Feb 8, 2005
Bounded-Buffer
Shared data
#define BUFFER_SIZE 10
typedef struct {
. . .
} item;
item buffer[BUFFER_SIZE];
int in = 0;
int out = 0;
int count = 0;
6.5
Silberschatz, Galvin and Gagne ©2005
Operating System Concepts – 7
th
Edition, Feb 8, 2005
Bounded-Buffer
Producer process
item nextProduced;
while (1) {
while (count == BUFFER_SIZE);
/* do nothing */
buffer[in] = nextProduced;
in = (in + 1) % BUFFER_SIZE;
count++;
}
剩余63页未读,继续阅读
资源评论
wxg520cxl
- 粉丝: 23
- 资源: 3万+
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功