implemented basic producer-consumer