modify : mutex noreaders : event readers : int = 0 countmodify : mutex WriteLock: request(modify) wait(noreaders) WriteUnlock: release(modify) ReadLock: request(modify) request(countmodify) if(readers==0) reset(noreaders) readers++ release(countmodify) release(modify) ReadUnlock: request(countmodify) readers-- if(readers==0) signal(noreaders) release(countmodify)