I have one server with 10 cpu cores, when I ran the following code which one thread, one of the cpu cores usage was 100%:
def fun():
while 1:
pass
but when I use 5 threads to run the same code, there were 5 cpu cores usages were: 30%, 20%, 15%, 25%, 12% respectively.
Why were not 5 cpu cores with 100% usages respectively? If multiple python threads can not fully use CPUs, how should multiple thread is faster than one thread?