Java multithreading on producer-consumer -
i following video tutorial on java multi-threading. introduces on using java implement famous "producer-consumer" problem.
it used wait() , notifyall() ensure proper communication between producer threads , consumer threads.
the tutor intentionally created several producer threads while 1 consumer threads, left question unanswered: "it best practice have equal number of producer , consumer threads, if there more producer threads consumer, there problems".
however, didn't specify problem is. imagine situation basket full. experts here? thanks.
you have number of producers , number of consumers.
if producers produce fast, queue fill up, until memory problems or producers forced stay idle until there's place left in queue.
if consumers consume fast, stay idle of time.
Comments
Post a Comment