I am trying run a total of 8 threads on 4 cores.
I bind the threads in sets of 2 to each of the core by setting the affinity.
0,1 -> core A
2,3 -> core B
4,5 -> core C
6,7 -> core D
I am able to poll the threads to check if they are running. I am also able to collect the time at which it (s)tarted, (e)nd and the time at which (p)erformnace events are collected precisely. I know which of the two threads in the set is dead(by dead, i mean, the execution time is over). There can be cases where the thread 0 or thread 1 is longer than one another.
In either of the cases, i.e, when thread 0 or thread 1 is longer, I want to reiterate the shorter thread till the end of the bigger thread.
Previously, when I had just two threads per core on the overall system. I used to do a manual check like.. if either of the thread is dead.. keep running it till the point where the other is also dead.
But this comes with a lot of redundancy and loss of efficiency(because I was using IF statements)
If I want to scale it for two threads/ more than two threads per core, when each of the cores have a two/ more than two. How can we that?
I need ideas so that we can discuss on that.
this is what I got: As an example take "ted" and "talks" and as two threads on Core A. Assuming ted is shorter of the two threads. the data we have: Time at which it starts, ends, and data collection time. We can calculate the time difference between end-start of the thread ted and the thread talks.
TED_TIME_DIFF = 100ms
but the time period of thread talks keeps on increasing(checking from the calulation of collected times(c)). Assuming the collection time is 1ms
for example it can TALKS_TIME_DIFF = 110ms next ms it is 111ms.. etc.
we can keep reiterating ted till talks time diff is stagnent.
Scripting language: Python 2.7
OS: Linux
Kernel:2.6.xx
using SPEC CPU BENCHMARK threads - if that is any importance
would be glad if you can help me out.
XORandFLAGS. (I've honestly no idea what you mean by that.)Taskobjects that encapsulate this code. Each thread will loop, consume oneTaskfrom the queue, and execute it. They should do so until a) the queue is empty; and b) no more tasks are to be added to the queue.