摘要
读者和写者问题是一类经典的进程同步问题。在传统的解决方案中,读者总是占优,使得写者永远等待。文章提出了写者优先的解决方案,可使系统能够在一个进程声明写的时候,不允许新的进程访问该数据区,有利于读者读到最新的数据。
The reader-writer problem is a process synchronization problem, which means that more than one person is visiting the same data area at the same time. The traditional solution always offers the reader the priority and keeps the writer waiting. A writer-priority solution was brought forward in this paper, which has made it possible for the system to disallow a new process to visit the data area while the original process claimed writing. This solution has enabled the reader to read the newest data.