首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
多个进程共享一个文件,其中只读文件的称为读者,其中只写文件的称为写者。读者可以同时读,但是写者只能独立地写。 用P、V操作写出其同步算法。
多个进程共享一个文件,其中只读文件的称为读者,其中只写文件的称为写者。读者可以同时读,但是写者只能独立地写。 用P、V操作写出其同步算法。
admin
2013-03-18
21
问题
多个进程共享一个文件,其中只读文件的称为读者,其中只写文件的称为写者。读者可以同时读,但是写者只能独立地写。
用P、V操作写出其同步算法。
选项
答案
用P、V操作的同步算法如下: Begin Integer mutex1,mutex2,rc; mutex1:=1; mutex2:=1; rc:=0; Cobegin Reader; Begin P(mutex1); rc:=rc+1; if rc_1 then p(mutex2); V(mutex1); Reading the file; rc:=rc-1; if rc=0 then V(mutex2); V(mutex1); End Writer: Begin p(mutex2); Writing the file; V(mutex2); End Coend End
解析
转载请注明原文地址:https://kaotiyun.com/show/3Vsp777K
本试题收录于:
二级VF题库NCRE全国计算机二级分类
0
二级VF
NCRE全国计算机二级
相关试题推荐
执行下列命令后,显示的结果是()X=50Y=100Z="X+Y"?50+&Z
分布式数据库系统不具有的特点是
软件的【】设计又称为总体结构设计,其主要任务是建立软件系统的总体结构。
可以伴随着表的打开而自动打开的索引是______。
分布式数据库系统不具有的特点是______。
n个顶点的强连通图的边数至少有______。
设计一个通话计费程序,假设每分钟通话费用为0.20元,初始时,开始时间、结束时间、通话分钟和应付金额都为空。单击“开始”按钮,显示开始时间:单击“计费”按钮,显示结束时间、通话分钟和应付金额(每分钟0.20元,不满1分钟按1分钟计费)。表单样式如图3-7
【】是数据库设计的核心。
将代数式转换成程序设计中的表达式为【】。
随机试题
油气的流动是各种能量同时作用的结果,在油田的不同开发阶段各自发挥的作用大小相同。()
下列哪项不是浅龋的临床表现
球后穴位于眶下缘的
定金合同是当事人双方为了保证债务的履行,按照合同规定向对方预先给付一定数额的货币,定金的数额由当事人约定,但不得超过主合同标的额的()。
某办公大楼在保修期间出现外墙裂缝,经查是由于设计缺陷造成,原施工单位进行了维修,之后应向( )主张维修费用。
计算机内处理的是汉字的交换码。()
法律制裁是实现法律责任的方式,其内容包括制裁、补偿和强制。其电,制裁是最主要的实现法律责任的方式。 ( )
用人单位与劳动者发生劳动争议,当事人可以依法申请调解、仲裁、提起诉讼,也可以协商解决。()
中国抗日战争全面爆发的标志是九一八事变。()
Ifyouwanttoimproveyourchild’sresultsatschool,【T1】______thattheydoplentyofexercise.Scientistshavealreadyshownt
最新回复
(
0
)