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
Feature request: priorities for tasks and threads #36348
Comments
One requirement to keep in mind is wether you need preemptive tasks or not. Even if you had the priority feature in Threads, you may still need to wait until a task is finished to start a new priority task in case all threads are busy, which is not a good thing for real time applications (and then you start using Distributed computing using the Distributed stdlib is preemptive given that you have different OS processes. Each process has its own pool of threads. What I've been doing to mimic this feature is to mix the two. I have a master and slave processes using the Distributed stdlib. All priority work runs on master, and the rest is scheduled in the slave process. |
Hi @felipenoris Very interesting, thanks! I will look into this combination with |
Just as an FYI, I made a very lightweight package that allows spawning multithreaded tasks on a non-main thread. i.e. it will keep a single main thread free to respond to other tasks/things, and only extra "worker" threads will be eligible to perform |
Hi @quinnj ! Thanks for the info! I noticed that package uses a strategy similar to the MusicAlbums project featured in your JuliaCon seminar. |
Hi!
I am having a problem when working with threads and tasks in Julia. In my embedded application, I have three tasks. One is very important, and the other two are not. To meet the real-time requirement of the first, I currently need to write a lot of
yield()
in the threads that are not that important. Even so, I cannot guarantee that, whenyield()
is called, the next thread to be executed will be the first one. Hence, I would like to propose a schedule priority feature for Julia.It can be something very simple, like this:
When the scheduler is called, list all runnable threads and execute the one with the highest priority. If there are multiple threads with the same priority, then execute the one that is waiting longer on the list.
This kind of approach will solve at least my problem. I will still need a lot of
yield()
s (maybe I can even construct a macro to add ayield()
after every newline), but I will be sure what will be the next thread to be run.The text was updated successfully, but these errors were encountered: