文件名称:Reader-Writer
介绍说明--下载内容均来自于网络,请自行研究使用
创建一个控制台进程,此进程包含n个线程,用这n个线程来表示n个读者或写者,每个线程按相应测试数据文件(后面有介绍)的要求进行读写操作,用信号量机制分别实现读者优先和写者优先的读者-写者问题。
读者-写者问题的读写操作限制(包括读者优先和写者优先):
写-写互斥,即不能有两个写者同时进行写操作。
读-写互斥,即不能同时有一个线程在读,而另一个线程在写。
读-读允许,即可以有一个或多个读者在读。
读者优先的附加限制:如果一个读者申请进行读操作时已有另一个读者正在进行读操作,则该读者可直接开始读操作。
写者优先的附加限制:如果一个读者申请进行读操作时已有另一写者在等待访问共享资源,则该读者必须等到没有写者处于等待状态后才能开始读操作。-Create a console process, this process contains n threads, n-reader or writer to represent with n threads, each thread according to the corresponding test data files (followed by descr iption) the requirements of the read and write operations, semaphores mechanisms, respectively reader priority and the write priority reader- writer problem. Reader- the writer to read and write operating limits (including the reader priority and priority to the writer): write- write mutually exclusive, ie can not have two writers write. Read- write mutex that is not at the same time there is a thread in another thread writing. Read- read permission, which can have one or more readers. Readers priority additional restrictions: If a reader application for the read operation has been another reader being read, the reader can directly read. Write priority additional restrictions: If a reader application for the read operation has been another writer in waiting for access to shared resources, the reader must
读者-写者问题的读写操作限制(包括读者优先和写者优先):
写-写互斥,即不能有两个写者同时进行写操作。
读-写互斥,即不能同时有一个线程在读,而另一个线程在写。
读-读允许,即可以有一个或多个读者在读。
读者优先的附加限制:如果一个读者申请进行读操作时已有另一个读者正在进行读操作,则该读者可直接开始读操作。
写者优先的附加限制:如果一个读者申请进行读操作时已有另一写者在等待访问共享资源,则该读者必须等到没有写者处于等待状态后才能开始读操作。-Create a console process, this process contains n threads, n-reader or writer to represent with n threads, each thread according to the corresponding test data files (followed by descr iption) the requirements of the read and write operations, semaphores mechanisms, respectively reader priority and the write priority reader- writer problem. Reader- the writer to read and write operating limits (including the reader priority and priority to the writer): write- write mutually exclusive, ie can not have two writers write. Read- write mutex that is not at the same time there is a thread in another thread writing. Read- read permission, which can have one or more readers. Readers priority additional restrictions: If a reader application for the read operation has been another reader being read, the reader can directly read. Write priority additional restrictions: If a reader application for the read operation has been another writer in waiting for access to shared resources, the reader must
(系统自动生成,下载前可以参看下载内容)
下载文件列表
Reader-Writer.doc