I have a scenario where some functions need to complete as quickly as possible and be given computation resources at the expense of other tasks (i.e. they are high-priority). Specifically, graphics rendering and any tasks that are spawned for rendering should run as quickly as possible but do not consume the full CPU capacity. Simultaneously, I want to fill empty cycles of the CPU with other work that is not as time-critical and make sure not to steal cycles from the rendering tasks.
The basic idea is fairly simple, but I cannot figure out how to do what I want through PPL. I have found how to set the default scheduler to different priorities, but I don't want to globally change the priority. Rather, I want to have two distinct scheduling policies that I can add tasks to at any time.
The ideal situation is if I could create two task_group instances with different priorities and add tasks to the relevant group as needed, but I don't see how to do that. I linked the most relevant documentation I found, which does what I want, but uses agents in a way that leaves me unsure how to do the simple action of just adding a task. I would also rather not add the complexity of agents and message passing if I can use the basic facilities in PPL.
It is also important that I can ensure that any sub-tasks spawned from a thread inherit the priority of the parent. Specifically, I call parallel_for from both high and low priority tasks and the parallel_for blocks should keep the same priority.