I'm using Ubuntu 13.04 dev and have noticed a high cpu overhead if a process is using multiple threads and computing them on different threads. To measure this I have written a little script in Python which I will attach.
The script will create 2 threads which are using only a little time of a cpu core. On my AMD Phenom II X6 1045T the Linux kernel will assign the 2 threads on 2 cores which will use a total cpu time of 40% from a maximum of 600%. But if I'm using "taskset -ap 0x00000001 pid_of_script" the 2 threads will be assigned to 1 core and the total cpu usage will be only 25% from 600%.
I'm wondering why there is a cpu overhead of 60% if the Linux kernel is using 2 cores instead of 1 core.
I'm using Ubuntu 13.04 dev and have noticed a high cpu overhead if a process is using multiple threads and computing them on different threads. To measure this I have written a little script in Python which I will attach.
The script will create 2 threads which are using only a little time of a cpu core. On my AMD Phenom II X6 1045T the Linux kernel will assign the 2 threads on 2 cores which will use a total cpu time of 40% from a maximum of 600%. But if I'm using "taskset -ap 0x00000001 pid_of_script" the 2 threads will be assigned to 1 core and the total cpu usage will be only 25% from 600%.
I'm wondering why there is a cpu overhead of 60% if the Linux kernel is using 2 cores instead of 1 core.