某停车场有多个入口和出口,车辆进入时从入口处由系统查询可用的停车位,从出口驶出时系统将其刚使用的车位标记为空车位。
根据上述描述,在入口处的伪代码程序为:
x = Get( );
IF x =NULL THEN return 0;
Writ(x, 1);
【问题1】(3)
若两辆车在不同的入口处同时执行上述代码,会出现什么问题?(100字以内描述)
【问题2】(8分)
为保证入口处伪代码正确地并发执行,引入共享锁指令 SLock(T)和独占锁指令XLock(T)对表 T 进行加锁;Upgrade(T)对表 T 所加的共享锁升级为独占锁;解锁指令Unlock(T)对表T 进行解锁。
(1)请修改上述入口处的伪代码程序,使其满足2PL协议。
(2)满足2PL协议的入口处的伪代码程序,在并发执行时是否会产生死锁?若是,给出一个产生死锁的调度。
【问题3】(4分)
若停车位表的关系模式为:park(parkno, isused),其中parkno为停车位号,isused为停车位标志,0为空,1为非空。
下面是用E-SQL实现的查询空车位的函数Get( ),请补全空缺处的代码。
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
EXEC SQL DECLARE getblk CURSOR FOR
(a) ;
EXEC SQL OPEN getblk ;
EXEC SQL FETCH getblk INTO :Hparkno; // Hparkno为已声明的主变量
IF SQLCA.sqlcode = 100 THEN
EXEC SQL CLOSE getblk ; Return NULL;
ELSE
(b) ;
END IF
正确答案及解析
正确答案
解析
包含此试题的试卷
你可能感兴趣的试题
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
- 查看答案