当前位置:首页计算机类软件水平考试中级软件评测师->某企业的生产流水线上有2名工人P1和P2,1名检验员P3。P

某企业的生产流水线上有2名工人P1 和P2,1名检验员P3。P1将初步加工的半成品放入半成品箱B1,P2从半成口箱B1取出继续加工,加工好的产品放入成品箱B2,P3从成口箱B2取出产品检验。假设B1可存放n件半成品,B2可存放m件产品,并设置6个信号量S1、S2、S3、S4、S5和S6,且S3和S6的初值都为0,采用PV操作实现P1、P2和P3的同步模型如下图所示,则信号量S1和S5( ),S2 、S4的初值分别为(请作答此空)

中级软件评测师,章节练习,操作系统基础知识

  • A.n,0
  • B.m,0
  • C.m,n
  • D.n,m
查看答案 纠错
答案: D
本题解析:

在将物品放入B1前执行P(S2),再从B1取走物品后执行V(S2),说明该信号量S2应为同步信号量,执行P(S2)时先判定B1中是否有存储空间,如果有则放入物品,没有则进行等待;V(S2)是在从B1拿走物品后执行,即:当从B1中取出1件商品后,B1就有一个空间,接下来通过V(S2)来唤醒队列中等待向B1中放物品的进程。由于B1可以放n件物品,所以S2应该为n;S4与S2相似,所以S2应该为m。

也就是说:S2的初始值表示成品箱B1的剩余空间,所以期初始值为n;S4表示成品箱B2所剩余的空间,所以初始值为m。

更新时间:2021-11-26 01:12

你可能感兴趣的试题

单选题

(  )is the process of transforming information so it is unintelligible to anyone but the intended recipient.

  • A.Encryption
  • B.Decryption
  • C.Security
  • D.Protection
查看答案
单选题

As each application module is completed,it undergoes(  )to ensure that it operates correctly and reliably.

  • A.unit testing
  • B.integration testing
  • C.system testing
  • D.acceptance testing
查看答案
单选题

(  )algorithm specifies the way to arrange data in a particular order.

  • A.Search
  • B.Random
  • C.Sorting
  • D.Merge
查看答案
单选题

After analyzing the source code,(  )generates machine instructions that will carry out the meaning of the program at a later time.

  • A.an interpreter
  • B.a linker
  • C.a compiler
  • D.a converter
查看答案
单选题

(  )can help organizations to better understand the information contained within the data and will also help identify the data that is most important to the business and future business decisions.

  • A.Data processing system
  • B.Big Data analytics
  • C.Cloud computing
  • D.Database management
查看答案
单选题

浏览器开启无痕浏览模式后,(  )依然会被保存下来。

  • A.浏览历史
  • B.搜索历史
  • C.已下载文件
  • D.临时文件
查看答案
单选题

下列协议中,不属于TCP/IP协议簇的是(  )。

  • A.CSMA/CD
  • B.IP
  • C.TCP
  • D.UDP
查看答案
单选题

下列传输介质中,带宽最宽、抗干扰能力最强的是(  )。

  • A.双绞线
  • B.红外线
  • C.同轴电缆
  • D.光纤
查看答案
单选题

数控编程常需要用参数来描述需要加工的零件的图形。在平面坐标系内,确定一个点需要2个独立的参数,确定一个正方形需要(  )个独立的参数。

  • A.3
  • B.4
  • C.5
  • D.6
查看答案
单选题

某书的页码为1,2,3,...,共用数字900个(一个多位数页码包含多个数字),据此可以推断,该书最大的页码为(  )。

  • A.237
  • B.336
  • C.711
  • D.900
查看答案