Skip to content

Feature request: priorities for tasks and threads #36348

@ronisbr

Description

@ronisbr

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, when yield() 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 a yield() after every newline), but I will be sure what will be the next thread to be run.

Metadata

Metadata

Assignees

No one assigned

    Labels

    multithreadingBase.Threads and related functionality

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions