Reader/Writer problem
---------------------

int rc = 0
semaphore mutex = 1
semaphore wrt = 1

reader-process
   wait (mutex);
   rc++;
   if (rc == 1)
      wait (wrt);
   signal(mutex);
   READ THE OBJECT
   wait(mutex);
   rc--;
   if (rc == 0)
      signal (wrt);
   signal(mutex);


writer-process
   wait(wrt);
   WRITE INTO THE OBJECT
   signal(wrt);


main
   rc = 0
   begin (reader-process, writer-process)