notify and wait to implements readers and writer