title: How to prevent writer starvation in a read write lock in pthreads
body: <p>I have some questions regarding read-write locks in POSIX Pthreads on a *nix system, say Linux for example.</p>
  
  <p>I wish to know what is the default bias for read write lock i.e does it prefer reads over writes or vice versa ? Does it provide some api to change this default behaviour.</p>
  
  <p>Does posix pthread provide some api so that we could change the pthread_rwlock_t to prevent writer starvation ? From what i have read(please correct me if i am wrong), the default implementation is biased towards reader threads and so writer threads can face starvation.</p>
  
  <p>I have read the sample implementation of rw lock from the book Programming with Posix threads by David Butenhof.</p>
  
  <p>I wish to know how posix pthreads handle starvation of writer threads ? Is there some api using which we could set the attributes of the read write lock that would prevent write starvation (i have never heard about that) ? Or does the user have to handle this problem ?</p>
  
  <p><strong>If you think that the answer is implementation-defined then please give me example of how it's done in Linux, because thats what i am looking for.</strong></p>
  
  <p><strong>Please note that i just want solutions for a *nix system. Don't think that i am rude, but posting some windows-specific code is useless for me.</strong></p>
  
  <p>Thank you all for your help and patience :)</p>