Make number of threads a configuration option

Bug: 54060
Change-Id: I609dfc9a00662b14961b3e4bc7ef8b8f01370f88