How to Calculate Sufficient Thread Length