I'd like to be able to request Linux to schedule two or more threads in the same time. I mean today when my multi-threaded program is being executed I know that in worst case only one of my threads is being physically executed (scheduled) at a time. Now I'd like to tell Linux: here is the list of thread Ids, please try to schedule them in the same time, possibly with core affinities. Does such capability exist, or has someone worked on this ?
The goal is to have one or even more task threads (dedicated to tasks) running in the same time as the main thread. The main thread would give them very short tasks to execute, like storing to or searching a hash or array. Meanwhile the main thread would go on until it would reach a dependency on one of tasks' result. If the task was really executed in parallel the dependency would not stop the main thread and the program would run faster.
With the usual scheduling scheme the tasks could be scheduled much later than the sync point and this could even run slower than a single-threaded version.
Thanks