update productor_consumer by derived function