Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to prevent some task to run on thread 0 ? #130

Open
loudjanilef opened this issue Jul 16, 2024 · 2 comments
Open

Is there a way to prevent some task to run on thread 0 ? #130

loudjanilef opened this issue Jul 16, 2024 · 2 comments

Comments

@loudjanilef
Copy link

Hello,
First of all, thank you for providing this very good library.

I have a project with a main thread (enki thread 0) and N enki threads.
In this project, we have some high priority background tasks we want to schedule only on the workers threads and not on the main thread. This is because those tasks are long and unsliceable.
We don't want those task to be scheduled on the main thread when we are waiting for other tasks.
Waiting for a priority is not an option either since those tasks need to be scheduled as soon as possible (on any other thread) so they have the higher priority.
PinnedTasks does not provide the api we want since it will lock this high priority task on a given thread even if it is not available.

Do you have a way to set task <-> worker thread affinity or exclusion list ?

@dougbinks
Copy link
Owner

Do you have a way to set task <-> worker thread affinity or exclusion list ?

No, the only current exclusion list capability is the priority or pinned tasks.

I use the priority system for this. Define a set of priorities for the main thread (and other threads), and a set below this for only other threads.

Some form of task <> thread affinity is a reasonable ask, but it's tricky to implement (there are some edge cases) with enkiTS without a fair amount of extra functionality.

@loudjanilef
Copy link
Author

Thank you
I'll try with priorities, although it is not the best way because I would like the "non main thread" tasks to have a high priority too.
A thread affinity functionality would be very appreciate, but I understand that this can bring complexity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants