文件名称:exp2RW
介绍说明--下载内容均来自于网络,请自行研究使用
创建一个控制台进程。此进程包含n个线程。用这n个线程来表示n个读者或写者。每个线程按相应测试数据文件(后面有介绍)的要求进行读写操作。用信号量机制分别实现读者优先和写者优先的读者-写者问题。
读者-写者问题的读写操作限制(包括读者优先和写者优先):
1)写-写互斥,即不能有两个写者同时进行写操作。
2)读-写互斥,即不能同时有一个线程在读,而另一个线程在写。
3)读-读允许,即可以有一个或多个读者在读。
读者优先的附加限制:如果一个读者申请进行读操作时已有另一个读者正在进行读操作,则该读者可直接开始读操作。
写者优先的附加限制:如果一个读者申请进行读操作时已有另一写者在等待访问共享资源,则该读者必须等到没有写者处于等待状态后才能开始读操作。
运行结果显示要求:要求在每个线程创建、发出读写操作申请、开始读写操作和结束读写操作时分别显示一行提示信息,以确定所有处理都遵守相应的读写操作限制。
-Create a console. This process contain n threads. Use of these n threads to express n readers who write. Each thread according to the corresponding test data files (with a) on the request and write. Signal mechanism volume respectively priority and writing preferred reader readers- who write. Readers- limit read and write operations to write the problem (including the readers of priority and writing preferred): 1) Write- write exclusive, that can not have two writers write the same time. 2) read- write exclusive, that can not simultaneously reading a thread while another thread in writing. 3) Read- allows, that can have one or more of those who read it. Readers priority additional restrictions: If an application for readers read another operation has been under way readers read operation, the reader can start to read. Additional restrictions writer priority: If an application for readers read another writer has to start a read operation is waiting to access a shared resource, the reade
读者-写者问题的读写操作限制(包括读者优先和写者优先):
1)写-写互斥,即不能有两个写者同时进行写操作。
2)读-写互斥,即不能同时有一个线程在读,而另一个线程在写。
3)读-读允许,即可以有一个或多个读者在读。
读者优先的附加限制:如果一个读者申请进行读操作时已有另一个读者正在进行读操作,则该读者可直接开始读操作。
写者优先的附加限制:如果一个读者申请进行读操作时已有另一写者在等待访问共享资源,则该读者必须等到没有写者处于等待状态后才能开始读操作。
运行结果显示要求:要求在每个线程创建、发出读写操作申请、开始读写操作和结束读写操作时分别显示一行提示信息,以确定所有处理都遵守相应的读写操作限制。
-Create a console. This process contain n threads. Use of these n threads to express n readers who write. Each thread according to the corresponding test data files (with a) on the request and write. Signal mechanism volume respectively priority and writing preferred reader readers- who write. Readers- limit read and write operations to write the problem (including the readers of priority and writing preferred): 1) Write- write exclusive, that can not have two writers write the same time. 2) read- write exclusive, that can not simultaneously reading a thread while another thread in writing. 3) Read- allows, that can have one or more of those who read it. Readers priority additional restrictions: If an application for readers read another operation has been under way readers read operation, the reader can start to read. Additional restrictions writer priority: If an application for readers read another writer has to start a read operation is waiting to access a shared resource, the reade
(系统自动生成,下载前可以参看下载内容)
下载文件列表
exp2RW.cpp