皮皮学,免费搜题
登录
logo - 刷刷题
搜题
【简答题】
有A、B两人通过信箱进行辩论,每个人自己的信箱中取得对问题,将答案和向对方提出的新问题组成一个邮件放人对信箱中。假设A的信箱最多放M个邮件,B的信箱最多放N个邮件。初始时A的信箱中有x个邮件(0 semaphore Full_A = x ; //表示A的信箱中的邮件数量 semaphore Empty_A = _____1_____; //表示A的信箱中还可存放的邮件数量 semaphore Full_B = _____2_____ ; //表示B的信箱中的邮件数量 semaphore Empty_B = N-y; //表示B的信箱中还可存放的邮件数量 semaphore mutex_A = mutex_B = _____3_____ ; //用于信箱A和B的互斥 CoBegin A. { while(TRUE){ _____4_____ ; P(mutex_A); 从A的信箱中取出一个邮件; V(mutex_A); _____5_____ ; 回答问题并提出新问题; _____6_____ ; P(mutex_B); 将新邮件放入 B. 的信箱; V(mutex_B); V(Full_B); } } B { while(TRUE){ _____7_____ ; P(mutex_B); 从B的信箱中取出一个邮件; V(mutex_B); V(Empty_B) ; 回答问题并提出新问题; _____8_____ ; P(mutex_A); 将新邮件放入A的信箱; V(mutex_A); V(Full_A); } } CoEnd(1)M-x;(2)y;(3)1;(4) P(Full_A);(5)V(Empty_A);(6)P(Empty_B);(7)P(Full_B);(8)P(Empty_A)
手机使用
分享
复制链接
新浪微博
分享QQ
微信扫一扫
微信内点击右上角“…”即可分享
反馈
参考答案:
举一反三
【单选题】A C program starts its execution from( )
A.
the main function in the program and ends its execution in the main function
B.
the first function of the program and ends its execution in the last function of the program
C.
the main function in the program and ends its execution in the last function of the program
D.
the first function of the program and ends its execution in the main function
【简答题】完型填空。 Today, English is spoken in many countries. 1 English spoken in the UK is a little different from that in the USA in spelling, meaning, pronunciation, grammar, usage and so on. Sometimes, 2 Engl...
【判断题】模块就是一种电子装置,节点则不是。
A.
正确
B.
错误
【简答题】完型填空。 It is Saturday today. Mother and Jack are sitting 1._____ the table. They 2._____ their lunch. ' Mum, I don't like 3._____ tomatoes(西 红柿). I don't want 4._____ them,' says Jack, 5._____ puts dow...
【单选题】What is the MOST accurate way to determine a project’s duration before execution?()
A.
The project manager performs all estimates
B.
Incorporate each individual worker’s estimates
C.
Acquire expert estimates
D.
There is no way to determine the duration
【简答题】The experiments show that high-fat diets_______.
【简答题】______cancer is not among the cancers that can be protected against by diets high in vegetables and fruits.
【单选题】An interrupt breaks the execution of instructions and diverts its execution to
A.
Interrupt service routine
B.
Counter word register
C.
Execution unit
D.
control unit
【单选题】What is the sign of Tess's execution?
A.
A gloomy day.
B.
A dark prison.
C.
A black gallows.
D.
A black flag.
【简答题】The experiments show that high-fat diets_______
相关题目:
参考解析:
知识点:
题目纠错 0
发布
创建自己的小题库 - 刷刷题