implemented the readers writers problem