假设系统有n(n>5)个并发进程,它们竞争互斥资源R。若采用PV操作,当有3个 进程同时申请资源R,而系统只能满足其中1个进程的申请时,资源R对应的信号量S 的值应为( )。
- A.-1
- B.-2
- C.-3
- D.0
正确答案及解析
正确答案
解析
PV操作:是实现进程同步和互斥的常用方法,P操作和V操作是低级通信原语,在执行期间不可分割;其中P操作表示申请一个资源,V操作表示释放一个资源。
P操作的定义:S:=S-1,若S>=0,则执行P操作的进程继续执行;若S<0,则将该进程设为阻塞状态(因为无可用资源),并将其插入阻塞队列。
V操作的定义:S:=S+1,若S>0,则执行V操作的进程继续执行;若S<=0,则从阻塞状态唤醒一个进程,并将其插入就绪队列,然后执行V操作的进程继续。
本题3个进程同时申请,1个进程获得资源,即1个进程运行另2个进程等待;当S值为负值时,S值的绝对值就是等待进程的数量,因此,此时S的绝对值应该为2,所以S=-2。
包含此试题的试卷
你可能感兴趣的试题
Advancements in ( )have contributed to the growth of the automotive industry through the creation and evolution of self-driving vehicles.
-
- A.Artificial Intelligence
- B.Cloud Computing
- C.Internet of Things
- D.Big Data
- 查看答案
In project human resource management , ( )is not a source of power for the project manager.
-
- A.referent power
- B.expert power
- C.reward power
- D.audit power
- 查看答案
At the project establishment stage , the feasibility study mainly includes techinical feasibility analysis , ( ), operation environment feasibility analysis and other aspects of feasibility analysis.
-
- A.detail feasibility analysis
- B.opportunity analysis
- C.economic feasibility analysis
- D.risk analysis
- 查看答案
( )is a grid that shows the project resources assigned to each work package.
-
- A.Stakeholder engagement assessment matrix
- B.Requirements traceability matrix
- C.Probability and impact matrix
- D.Responsibility assignment matrix
- 查看答案
Xinhua News Agency reported in January 2022,Chian will further promote the developmet of a digital economy during the 14th Five-Year Plan eriod(2021-2025). The plan also emphasized industrial ( )transformation.
-
- A.digital
- B.networking
- C.intelligentize
- D.informatization
- 查看答案