Solution of producer-consumer problem with variable size of produced/consumed data