with 2nd readers-writers problem implementation