I wrote a multi-threaded program that randomly generates strings, and after generating, checks to see if the string contains a certain value. Namely,
StringChecker. What I'm trying to figure out is how many
StringGenerator threads I would need in order to keep
StringGenerator threads have a reference to a
Queue that contains all of the Strings needed to be checked, and when they generate a String, it gets added to the
StringChecker threads also have a reference to the same
Queue and poll it to get the next string, and checks to see if it contains the keyword.
Because generating the Strings takes more time than checking them, what I want to know is if there are any equations, algorithms or analyses that can be done on the code that can help tell me approximately how many threads of each I will need such that the sum of all Strings generated by the
StringGenerators is as close to the number of strings checked by the
StringCheckers as possible.