Calculate no_threads