资 源 简 介
通过研究Linux的线程机制和信号量实现读者写者(Reader-Writer)问题并发控制。
1)写-写互斥:不能有两个写者同时进行写操作;
2)读-写互斥:不能同时有一个线程在读,而另一个线程在写;
3)读-读允许:可以有一个或多个读者在读;
4)读者优先的附加限制:如果读者申请进行读操作时已有另一个读者正在进行读操作,则该读者可直接开始读操作;
5)写者优先的附加限制:如果一个读者申请进行读操作时已有另一个写者在等待访问共享资源,则该读者必须等到没有写者处于等待状态后才能开始读操作。
-By studying the Linux thread mechanism and semaphores realize readers who write (Reader-Writer) the issue of concurrency control. 1) to write- write mutex: Can not write at the same time there are two write operations 2) read- write mutex: Can not have a thread at the same time in reading and writing another thread 3) Reading- Reading of permit: can have one or more readers read 4) the priority of additional restrictions readers: If the readers apply for a read operation, there was another reader being read, the reader can be directly started reading operation 5) to write additional priority Restrictions: If an application for a reader reading write operation has been in waiting for another visit to a shared resource, the read