Date of Award


Document Type

Thesis (Undergraduate)

Department or Program

Department of Computer Science

First Advisor

Prasad Jayanti


The reader-writer problem [1] seeks to provide a lock that protects some critical section of code for two classes of processes: readers and writers. Multiple readers can have access to the critical section simultaneously, but only one writer can have access to the critical section to the exclusion of all other processes. The difficulties in solving the reader-writer problem lie not only in developing a correct and efficient algorithm, but also in rigorously formulating the desirable properties for such an algorithm to have. Bhatt and Jayanti accomplished both of these tasks for several priority variants of the standard reader-writer problem [2][3]. Diamond and Jayanti subsequently formulated the notions of upgrading and downgrading, in which a reader can attempt to become a writer or a writer can become a reader, respectively, while in the critical section of the lock [4]. They presented an algorithm for a reader-writer lock that supports upgrade/downgrade while giving readers priority over writers in accessing the critical section (the reader-priority variant). In this paper, we formulate the desirable properties of a reader-writer lock which supports upgrade/downgrade as atomic primitives. Furthermore, we propose an algorithm that transforms a standard reader-writer lock of one of several priority variants into a reader-writer lock of the same priority variant that supports upgrade/downgrade as atomic primitives.


Originally posted in the Dartmouth College Computer Science Technical Report Series, number TR2014-756.