It depends upon following factors:
- CPU cores
- CPU bound task
- I/O bound tasks
General formula is No. of threads(t) = No. of cores(c) (1+ wait time/CPU time) = No. of cores (1+ blocking co-efficient)
wait time: How much time a thread takes for one task/s I/O operations to complete. blocking coefficient can be 0 to 1
for CPU bound task: t = c * (1+ 0/cpu time) = no. of cores ( since CPU will be utilized fully even with one thread, hence CPU will not be idle, hence no context switching occurs)
for I/O bound task: t = c * (1+ >0)