I am working on a socket application, my app is receiving very fast packets and i have to process and replay each packet within specific time (say 100 milliseconds). i am adding every packet to a queue, a thread is picking a packet and executing a tbb::task to process packet. i have 16 cores, and not able to process all packets in given time.
my question is can i change task priority to high or kill task which is not started in 50 ms and execute new task ?
what i am doing in my queue processing thread is:
I do not see whether wait_for_all is called somewhere. TBB library does not guarantee processing of spawned tasks until that moment.
TBB library has priority support (please see the documentation) but we do not recommend using it because it involves higher overheads which are not always justified since in most of the time the semantics of the workload could be changed towards better use of the library features.
As an example, I would also recommend to try splitting the processing of each packet onto several tasks to extract more parallelism from the system. Consider use of TBB Flow Graph feature because it is a good match for such sporadic (not known in advance) semantics.