读者写者问题_基于信号量机制

Directory: SourceCode/Document
Plat: C/C++
Size: 2KB
Downloads: 4
Upload time: 2019-06-04 10:27:07
Uploader: SSaiTex
Description:   A console application based on the semaphore mechanism to implement the reader's problem is written: a console process is created, which contains n threads, which are used to represent n readers or writers. The program enters the reader or writer priority mode according to the user's choice. Each thread reads and writes according to the requirements of the corresponding test data file, and the following rules are followed in the process: Reader first: If another reader is already reading while another reader is applying for a read operation, the reader can start the read operation directly.Writer first: If another reader is waiting to access the shared resource while a reader is applying for a read operation, the reader must wait until no writer is in the wait state before starting the read operation.

File list:
reader_and_writer.cpp, 12076 , 2019-06-04

Download users:

Relate files:

Comment: Add Comment

Favorite users: