parallel program that uses a monitor to handle threading in a search program