-
读者写者问题
说明: 1、定义一个数据缓存buffer及用于实现同步互斥的信号量。
2、定义一个读者函数:
?当有写者在占用buffer时,读者应该等待,直到写者不再使用该buffer。
?当有其他读者在占用buffer时,读者可对buffer进行读取操作。
?当buffer中有数据时,则从其中读取一个数据,并显示然后退出。
?当buffer中没有数据时,应等待,直到buffer中有数据可读。
3、定义一个写者函数
?当有读者在占用buffer时,写者应该等待,直到所有的读者都退出为止。
?当有其他写者占用buffer时,该写者应该等待,直到占用buffer的写者退出为止。
?当buffer有空闲时,写者应该在buffer中写入一个数据并退出。
?当buffer满时,写者应该等待,直到buffer有空闲为止。
4、定义主函数,在其中可以任意创建读者与写者。
可根据用户输入创建读者或写者进程(线程)。(1. Define a data buffer and semaphores for synchronization and mutual exclusion.
2. Define a reader function:
When a writer is occupying the buffer, the reader should wait until the writer no longer uses the buffer.
When other readers occupy the buffer, they can read the buffer.
When there is data in the buffer, read a data from it, display and exit.
When there is no data in the buffer, wait until the data in the buffer is readable.
3. Define a writer function
When a reader is occupying the buffer, the writer should wait until all readers quit.
When other writers occupy the buffer, the writer should wait until the writer who occupies the buffer exits.)
- 2019-12-27 18:49:46下载
- 积分:1
-
5种摄像头算法
说明: 五种阳光算法,对摄像头遇到的阳光进行减弱(Five sun algorithms to reduce the sunlight the camera encounters)
- 2020-03-04 20:31:44下载
- 积分:1
-
80套经典网页设计模版 80套完整的经典网页设计模板,很酷!有些模板您修改修改就可建站,真的不错! 对于不习惯用各种工具但是又渴望做一个网页的你特别适用,而大侠...
80套经典网页设计模版 80套完整的经典网页设计模板,很酷!有些模板您修改修改就可建站,真的不错! 对于不习惯用各种工具但是又渴望做一个网页的你特别适用,而大侠级的朋友们也值得研究研究-80 sets of classic web design templates 80 complete sets of the classic web design templates, cool! Some templates you can amend the amendment the establishment of the station, really good! For those using various tools but also eager to do a special website you apply, and the heroes- class friends is worth studies
- 2022-02-10 17:05:55下载
- 积分:1
-
php中英版本 仿alibaba贸易平台
php中英版本 仿alibaba贸易平台-English and Chinese versions of php like alibaba trading platform
- 2022-08-24 23:55:34下载
- 积分:1
-
DL645-2007协议调试器
支持DL-T2007协议的多功能电能表调试(Debugging of Multifunctional Watt-hour Meter Supporting DL-T2007 Protocol)
- 2020-06-21 06:40:02下载
- 积分:1
-
matlab太阳黑子
说明: 基于matlab,实现太阳黑子周期辐射信号周期的分析(Based on MATLAB, the period of sunspot periodic radiation signal is analyzed)
- 2020-07-12 16:26:23下载
- 积分:1
-
针对NSF
针对NSF-14的负载均衡的最短路算法
-NSF-14
- 2022-02-05 22:15:45下载
- 积分:1
-
tuike_jd
拼多多微擎模块 查优惠卷 配合主程序使用(Put together multiple micro engine modules to check preferential vouchers)
- 2020-06-21 14:20:02下载
- 积分:1
-
AVO
说明: 随着地震勘探飞速的发展,正演模拟技术已成为地震资料采集、处理和解释不可缺少的重要手段.AVO技术是利用反射波振幅直接寻找气藏的一种新技术.(With the rapid development of seismic exploration, forward modeling technology has become an indispensable and important means of seismic data acquisition, processing and interpretation.)
- 2019-03-24 17:28:46下载
- 积分:1
-
RC控制
说明: 针对逆变器的并网THD的改善策略,可以在ccs中通过加入该重复控制RC的代码,来有效减少并网电流THD(For the improvement strategy of grid-connected THD of inverter, the code of repetitive control RC can be added in CCS to effectively reduce grid-connected current THD)
- 2020-11-21 15:02:39下载
- 积分:1