added equivalent testing code with threads instead of processes